HW 5: BSTA 511-611 F23
Due 11/4/23
Download the .qmd file for this assignment from https://github.com/niederhausen/BSTA_511_F23/blob/main/homework/HW_5_F23_bsta511.qmd
Directions
- Please upload your homework to Sakai. Upload both your .qmd code file and the rendered .html file.
- For each question, make sure to include all code and resulting output in the html file to support your answers.
R & LaTeX code for probability distributions
- See the .qmd files with the code from class notes for LaTeX and R code.
- The LaTeX code will make it easier to show your work in computations.
It is a good idea to try rendering your document from time to time as you go along! Note that rendering automatically saves your Qmd file and rendering frequently helps you catch your errors more quickly.
Book exercises
4.4 Mental health, Part I
4.6 Thanksgiving spending, Part I
4.8 Age at first marriage, Part I
5.6 Working backwards, Part II
5.10 t⋆ vs. z⋆
5.12 Auto exhaust and lead exposure
5.16 Paired or not, Part II
5.22 DDT exposure
1 R exercises
1.1 Load all the packages you need below here.
1.2 R1: Youth weights
In this exercise you will use the YRBSS dataset again that we used in class on Days 8-9, to simulate the distribution of mean weights from repeated samples.
1.2.1 Use the set.seed()
command to set a randomization seed. Use whatever number you want for the seed.
1.2.2 CI
Suppose you took a random sample of size 50 from the YRBSS data, that has mean weight 130 pounds. Calculate and interpret a 90% confidence interval using the standard deviation of weights from the YRBSS “population.”
1.2.3 Another CI
Calculate and interpret a 90% confidence interval assuming the standard deviation of weights from the random sample is 40.
1.3 R2: Swim times
- In these exercises you will use R to work through the swim times example from Section 5.2 in the textbook.
- The data are in the
oibiostats
package and calledswim
.
1.3.1 Mean & SD of differences
Calculate the mean and standard deviation for the differences in swim times, and compare them to the ones in the book. Which order were the differences calculated, wet suit - swim suit or the opposite? Were all the differences positive?
1.3.2 Dot plot of differences
Create a dot plot of the differences in swim times and comment on the distribution shape.
1.3.3 Hypothesis test
Run the appropriate statistical test in R as both a one-sample t-test and a paired t-test to verify the test statistic, p-value, and CI in the text. Use inline R code to pull these values from the test output when writing up your comparison of these values to the book’s values.