Inductive reasoning · Statistical generalization · R

Sample size and the sampling distribution

Below is a classic illustration of inductive statistical generalization: inferring a feature of a population by analyzing a random sample.

Everything below is a simulation: we build a population we can actually see, then pretend we can only draw samples from it. That is a luxury you never have in real work, and it is what makes the exercise worth doing.

Question 1. Begin by creating a population

The code below calls rnorm() to draw 50,000 values from a Normal distribution with a mean of 1 and a standard deviation of 1. Those 50,000 values are our population.

Question 2

Question 3

Question 4

Hint 1sample() needs three things here: what to draw from (data), how many (sample_size), and whether a value can be drawn more than once.
Hint 2sample(data, sample_size, replace = TRUE) draws the sample; the function should return its mean().

Question 5

One or two sentences, before you run the loops.

Question 6. Repeat function 1000 times, 10 observations each time

Hint 1Each pass of the loop should call the function you wrote in Question 4.
Hint 2sample_fn(10) returns the mean of one sample of 10.

Question 7

Question 8. Repeat function 1000 times, 100 observations each time

Hint 1The loop in Question 6 does almost exactly this.
Hint 2Copy that loop, change the sample size from 10 to 100, and store into stor_sampsize100.

Question 9

Question 10

  1. Report the interquartile range of each, and the ratio between them. Where does that ratio come from?
  2. Both distributions are centred on the same point. What is that point? As the sample grows, the centre stays put but the spread shrinks. What does that tell you?
  3. In the language of inductive reasoning: what does a larger sample buy you in the strength of a generalization, and what does it cost?

Question 11

Question 12

As the sample size grows, what happens to the spread of the sampling distribution of the mean?

Question 13

Suppose the sample size were suddenly 100 times larger: say, 1,000 instead of 10. Here, “spread” means the standard deviation of the sample means.

What happens to the spread of the sampling distribution of the mean?