virtual_shovel <- bowl |>
rep_slice_sample(n = 50)simulating repeated samples with moderndive
the sampling distribution p-hat
rep_slice_sample()summarize()geom_histogram()A bowl of red and white balls, sampled over and over
Keep these straight and the rest of the chapter follows.
Population, Sample, Parameter, Statistic
Take repeated random samples from a data frame. Each replicate is a fresh sample, tagged with its own replicate number.
Sample Again & Again
Example
the population to sample from
the verb (function) how many balls in one scoop
Reduce each sample to a single number. With repeated samples there is no group_by() needed: the replicates are already grouped.
Example
the verb (function) what to call the result the proportion that are red
Ask for a thousand samples instead of one, and the statistic you get back becomes a distribution.
Example
one proportion per replicate
1,000 separate samples
The distribution of a statistic across repeated samples. Not the distribution of the data: the distribution of the estimate.
How Much Does It Vary?
Its center sits near the parameter. Its spread is the standard error.
Look at the sampling distribution the same way you look at any other numerical variable.
Example
the statistic, not the data
ggplot(virtual_prop_red, aes(x = prop_red)) +
geom_histogram(binwidth = 0.05, boundary = 0.4, color = "white")bin width
One number for how much an estimate bounces around.
The Spread Of The Estimate
Why so many sampling distributions look the same shape.
Bell-Shaped, Eventually