Problem Set 3
Please render this file to .html and submit via Brightspace.
Normal distribution
Scenario 1: Using *norm()
For a particular population of brown seaweed, the winter carbon:nitrogen ratio is distributed approximately normally among individuals as \(y \sim Norm(\mu=27.6, \sigma=2.5)\).
What proportion of the population would you expect to have a C:N ratio greater than 30?
What is the probability of sampling an individual with a ratio between 23 and 24?
What ratio would delineate the lowest 30% of the population?
Generate a random sample of 12 individuals from this population. Calculate the sample mean and sample standard deviation.
What is the difference between your sample mean and the true population mean called? Why does it occur and what are two aspects of your sampling design that affect it?
Repeat your random sampling 1000 times, calculate a sample mean for each of the 1000 samples, and make a histogram of them. Calculate the mean of these sample means.
Hint
# y_bar <- rep(0, 1000)
# for(i in 1:1000) {
# y_bar[i] <- ...
# }How does this mean (and the histogram) compare to the population mean?
Scenario 2: Transformations
The swiss dataset in R gives standardised fertility and socioeconomic indicators for each of the 47 French-speaking provinces of Switzerland in ca. 1888:
str(swiss)'data.frame': 47 obs. of 6 variables:
$ Fertility : num 80.2 83.1 92.5 85.8 76.9 76.1 83.8 92.4 82.4 82.9 ...
$ Agriculture : num 17 45.1 39.7 36.5 43.5 35.3 70.2 67.8 53.3 45.2 ...
$ Examination : int 15 6 5 12 17 9 16 14 12 16 ...
$ Education : int 12 9 5 7 15 7 7 8 7 13 ...
$ Catholic : num 9.96 84.84 93.4 33.77 5.16 ...
$ Infant.Mortality: num 22.2 22.2 20.2 20.3 20.6 26.6 23.6 24.9 21 24.4 ...
The values are given as percentages ranging from 0-100. Make a histogram for the Education column, setting the x-axis limits to the theoretical range of the variable.
What transformation would be most appropriate for these kinds of data?
Apply this transformation and make a histogram of the transformed values.
What do you notice about the shape of the original and transformed distributions?
Standard error of the mean
For the seaweed population in Scenario 1, we simulated a sample of 12 individuals from the population. In my particular sample, I found a sample mean of 26.154. Recall that the true population was distributed as \(y \sim Norm(\mu=27.6, \sigma=2.5)\).
Using the true population standard deviation \(\sigma=2.5\), calculate the standard error of the mean.
In your own words, describe what the standard error of the mean is.
The distribution of sample means can be simulated in R. Write code to 1) simulate 100 different samples from the seaweed population with \(n=12\), and 2) calculate a sample mean from each of these 100 samples.
Make a plot to show the distribution of these sample means, and indicate the true population mean \(\mu\).
Calculate the standard deviation of the 100 sample means.
How does it compare to the standard error of the mean you calculated above? Try increasing the number of samples to 3,000 and recalculate.
Lastly, repeat the process, this time with \(n=120\) for each sample. Calculate the standard error of the mean, simulate 100 sample means, and compare the standard deviation of these with the calculated standard error.
Why does the standard error decrease? What does this tell us about our level of confidence in the sample statistics we calculate (\(\bar{y}\), \(s\)) and our inferences about the population parameters we are interested in (\(\mu\), \(\sigma\))?