Sampling distribution of prices

And now the real challenge: running a loop.

Since you have access to the population, we can simulate the sampling distribution for \(\overline{x}\) by taking 5000 samples of size 50 from the population and compute 5000 sample means.

This exercise is part of the course

Data Analysis and Statistical Inference

View Course

Exercise instructions

  • Initialize an object sample_means50 with 5000 NAs.
  • Use a for loop to create 5000 samples of size 50 of price.
  • Inside the loop, calculate the mean of each sample and assign it to its place in sample_means50.
  • Inspect the result by printing sample_means50 using the head() function.
  • Based on this sampling distribution, think about what the mean home price of the population will be?

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# The ames data frame and area and price objects are already loaded into the workspace

# Initialize sample_means50
sample_means <-

# Code the for loop
for (i in ___) {

}

# Print out the head of sample_means50