Sampling from Ames, Iowa

If you have access to data on an entire population, say the size of every house in Ames, Iowa, it’s straight forward to answer questions like, “How big is the typical house in Ames?” and “How much variation is there in sizes of houses?”. If you have access to only a sample of the population, as is often the case, the task becomes more complicated. What is your best guess for the typical size if you only know the sizes of several dozen houses? This sort of situation requires that you use your sample to make inference on what your population looks like.

The Data

In the previous lab, “Sampling Distributions”, we looked at the population data of houses from Ames, Iowa. Let’s start by loading that data set.

In this lab we’ll start with a simple random sample of size 60 from the population. Specifically, this is a simple random sample of size 60. Note that the data set has information on many housing variables, but for the first portion of the lab we’ll focus on the size of the house, represented by the variable Gr.Liv.Area.

Q1. Describe the distribution of your sample. What would you say is the “typical” size within your sample? Also state precisely what you interpreted “typical” to mean.

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     756    1153    1497    1476    1696    2828

Answer: The distribution of our sample is right skewed. Because the sample is skewed, instead of mean, I prefer to use the median as an estimate for what a “typical” size within the sample.

Q2. Would you expect another student’s distribution to be identical to yours? Would you expect it to be similar? Why or why not?
Answer: Althought theoritically possible, it is highly unlikely that another random draw of 60 samples from the population would yield an identical distribution of mine. However, I would expect it to be similar because the sample size of 60 is sufficiently large (n >= 30) for Central Limit theorem to be applied.

Confidence Intervals

One of the most common ways to describe the typical or central value of a distribution is to use the mean. In this case we can calculate the mean of the sample using,

Return for a moment to the question that first motivated this lab: based on this sample, what can we infer about the population? Based only on this single sample, the best estimate of the average living area of houses sold in Ames would be the sample mean, usually denoted as \(\bar{x}\) (here we’re calling it sample_mean). That serves as a good point estimate but it would be useful to also communicate how uncertain we are of that estimate. This can be captured by using a confidence interval.
We can calculate a 95% confidence interval for a sample mean by adding and subtracting 1.96 standard errors to the point estimate.

## [1] 1366.04 1585.16

This is an important inference that we’ve just made: even though we don’t know what the full population looks like, we’re 95% confident that the true average size of houses in Ames lies between the values lower and upper. There are a few conditions that must be met for this interval to be valid.

Q3. For the confidence interval to be valid, the sample mean must be normally distributed and have standard error \(s / \sqrt{n}\). What conditions must be met for this to be true?
Answer: Observations in the sample are independent and the sample is large enough. ## Confidence Levels

Q4. What does “95% confidence” mean?
Answer: A 95% conficence interval is a range of values that you can be 95% cerntain contains the true mean of the population.
In this case we have the luxury of knowing the true population mean since we have data on the entire population. This value can be calculated using the following command:

## [1] 1499.69

Q5. Does your confidence interval capture the true average size of houses in Ames
Answer: Yes.

Q6. Calculate the means and standard deviations of 50 random samples with sample size n=60

##   Lower CI Upper CI
## 1 1366.040 1585.160
## 2 1371.566 1602.368
## 3 1410.392 1646.574
## 4 1307.458 1517.809
## 5 1418.508 1667.492
## 6 1353.377 1595.956

On Your Own

Answer: 2 out of 50 confidence intervals do not include the true population mean. That means 48/50 = 96% of the CI include the true population mean. It is not exactly equal to the confidence level of 95%. 95% confidence level means that at LEAST 95% of the sample intervals cover the population mean which is consistent with our case.

##   Lower CI Upper CI
## 1 1373.883 1720.750
## 2 1306.662 1569.738
## 3 1404.913 1739.320
## 4 1331.654 1636.946
## 5 1327.801 1639.632
## 6 1335.811 1646.322

Observation: It is expected that as we increase the confidence level, there is a increased chance that (95% -> 99%) the population mean falls within the sample intervals.