pt(1.3, 38)[1] 0.8992843
Due: Thursday, February 26, 11:59pm
For this assignment you will begin a new Quarto file. To do this, go to RStudio and click File > New File > Quarto Document. A pop-up will appear asking for a title, author, and format. You may leave these as the default options for now. Click OK and a new file will open. Update the YAML with your title, name, and date.
As a reminder, \(\mu\) and variance \(\sigma^2\) are the arguments for the parameters in the normal distribution. For instance, a random variable \(X \sim N(2, 25)\) would have mean \(\mu = 2\) and variance \(\sigma^2 = 25\) (such that \(\sigma\), the standard deviation, is 5).
We can calculate probabilities and quantiles of the t distribution in a similar fashion to the same calculations for the normal distribution:
Use the pt function to calculate left-tail probabilities (i.e., the area under the curve, to the left of the point you choose)
Use the qt function to determine the value corresponding to a specific quantile of the t distribution
Note: The t distribution only has one parameter, the degrees of freedom.
Example: Suppose we are interested in the left-tailed probability P(T < 1.3), where T is a random variable that follows a t distribution with 38 degrees of freedom. The syntax for the pt() function is pt(value, df).
Example: Suppose we are interested in the 90th percentile of a t distribution with 64 degrees of freedom. The syntax for the qt() function is qt(value, df).
Example: Suppose we are interested in the left-tailed probability \(P(Z < 140)\) of a normal distribution with mean \(\mu = 150\) and standard deviation \(\sigma = 7\). We could calculate it with the following:
Example: Suppose we are interested in the right-tailed probability \(P(Z > 140)\) of a normal distribution with mean \(\mu = 150\) and standard deviation \(\sigma = 7\). We could calculate it with the following:
Equivalently:
Suppose it is known from NHANES (a representative population-level survey) that systolic blood pressure (SBP) among US adults follows a normal distribution with \(\mu = 122\) mmHg and \(\sigma = 23\) mmHg (Wright et al., 2011). (i.e. Assume for this question that the population standard deviation here is known - which rarely happens in real life.) The CDC considers systolic blood pressure above 130 to be hypertensive, which may lead to serious cardiovascular morbidities and complications.
What is the probability that a randomly selected US adult has SBP > 130 mmHg? Show your work using R. No conclusion statement is necessary, just the R code calculating the answer.
Suppose we take a random sample of 5 US adults. What is the distribution of their mean SBP? (Hint: See Lecture 8 Slide 14.)
Type your answer for question 1(b) using LaTeX.
As an example, typing $\bar{X} \sim N(0, \frac{5}{\sqrt(10)})$ into your Quarto document will render as \(\bar{X} \sim N(0, 5/\sqrt(10))\).
Use the same SBP context for parts (c)-(e) below. For each of the following, show your work using R. No conclusion statement is necessary, just the R code calculating the answer.
…that a random sample of 5 US adults has mean SBP > 130 mmHg (Hint: Use the distribution of the sample mean. It may be helpful to pre-define your new standard deviation as \(\sigma/\sqrt(n)\).)
…that a random sample of 30 US adults has mean SBP > 130 mmHg
…that a random sample of 50 US adults has mean SBP > 130 mmHg
Exercise 1 (c), (d), and (e) ask about the probability that average values from some sample are 8 mmHg higher than the population values. How do these probabilities change as sample size increases? Explain why this is the case.
Suppose we took a random sample of 10 UNC students and found that the sample mean SBP was 112 mmHg. You may suppose that the distribution of SBP among UNC students is normally distributed and that \(\sigma\) is known to be 14 mmHg. Suppose you are interested in constructing a 99% two-sided confidence interval for the true mean SBP.
For parts (a)-(b), use R to show your work.
Find the confidence multiplier. In doing so, pre-define your \(\alpha\) to demonstrate reproducibility in your code.
Using your result from part (a), construct a 99% two-sided confidence interval for the true mean SBP among UNC students. Hint: use the sqrt() function to calculate square root in R.
Interpret your confidence interval.
When calculating the confidence interval for a population mean under the following conditions, does the margin of error get wider, narrower, stay the same width, or can we not know for sure?
(A)…sample size same, variability increases, confidence level same
(B)…sample size decreases, variability increases, confidence level increases
(C)…sample size increases, variability same, confidence level same
(D)…sample size same, variability same, confidence level increases
(E)…sample size increases, variability decreases, confidence level increases
(F)…sample size decreases, variability decreases, confidence level decreases
Researchers calculated a 90% confidence interval for the mean SBP among a random sample of ten adults in North Carolina and found it to be (114.836, 125.164). In calculating this interval, the researchers assumed that the underlying distribution was normally distributed, but did NOT assume that they knew the population standard deviation of SBP.
Interpret this confidence interval.
What was the sample mean and sample standard deviation in their sample? Show your work using R. Include units in your response.
Did you use AI for this assignment? (Refer to our AI policy in the syllabus.) If so, list all prompts used below and the corresponding questions. If not, answer “AI was not used on this assignment”. You are expected to at least rewrite answers in your own words.
As you’ve seen previously, we can Render into an .html file that can be opened by any web browser. To export it as a .pdf, open the file in your web browser and then print to or save as a .pdf document. Contact your TAs in Ed Discussion if you need help!
You will submit the PDF documents for labs and homework to Gradescope as part of your final submission.
To submit your assignment:
Access Gradescope through the menu on the BIOS 600 Canvas site.
Click on the assignment, and you’ll be prompted to submit it.
Mark the pages associated with each exercise. All of the pages of your lab should be associated with at least one question (i.e., should be “checked”).
Select the first page of your .PDF submission to be associated with the “Formatting” section.
| Component | Points |
|---|---|
| Ex 1 | 6 |
| Ex 2 | 1 |
| Ex 3 | 4 |
| Ex 4 | 3 |
| Ex 5 | 3 |
| Ex 6 | 1 |
| Formatting | 3 |
The “Formatting” grade is to assess the document format. This includes having a neatly organized document (no excessive output, warnings/messages when loading packages and/or data) with readable code and your name and the date updated in the YAML.