HW 5: BSTA 511/611 F25
Due THURSDAY 11/20/25
Download the .qmd file for this assignment from https://github.com/niederhausen/BSTA_511_F25/blob/main/homework/HW_5_F25_bsta511.qmd
Graded exercises
The exercises listed below will be graded for this assignment. You are strongly encouraged to complete the entire assignment. You will receive feedback on exercises you turn in that are not being graded.
- Book exercises
- 8.32, 8.34, 8.38
Directions
- Complete ALL exercises in this assignment using Quarto.
- I highly recommend using LaTeX to format equations.
- See the .qmd files from class notes for LaTeX code to make it easier to show your work in computations.
- For instructions on creating equations in the Visual editor, check out https://quarto.org/docs/get-started/authoring/rstudio.html#equations. html
- Also check out examples of LaTeX formatting for statistics created by recent biostats alum Ariel Weingarten.
- If you have difficulty rendering the LaTeX equations, I recommend installing and running the R package
tinytex. See this website for instructions.
Hypothesis test instructions
For book exercises, make sure to include all steps in a hypothesis test (where applicable) as outlined in the class notes.
Do not forget to include a discussion on whether you think the test (or CI) assumptions have been satisfied. Are there assumptions you need to make in order for them to be satisfied? Whether you believe they are satisfied or not, continue to run the hypothesis test (or CI) as instructed.
- Please upload your homework to Sakai. Upload both your .qmd code file and the rendered .html file (or just your pdf if completing the assignment by hand).
- Use the assignment .qmd file linked to above as a template for your own assignment.
- Please always use the following naming convention for submitting your files:
- Lastname_Firstname_HWx.qmd, such as Niederhausen_Meike_HW2.qmd
- Lastname_Firstname_HWx.html, such as Niederhausen_Meike_HW2.html
- For each question, make sure to show all of your work.
- This includes all code and resulting output in the html file to support your answers for exercises requiring work done in R (including any arithmetic calculations).
- For non-calculation questions, this includes an explanation of your answer (why did you choose your answer?).
- For each question, include a sentence summarizing the answer for that question in the context of the research question.
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
8.32 Diabetes and unemployment
(a)
(b)
(c)
In addition to answering the question in (c), run the 2 proportions test in R and calculated the “z” test statistic and p-value using the normal distribution based on the \(\chi^2\) output in R’s test.
(d) extra part
Run the test as a \(\chi^2\) as well, and compare your results to those in (c).
8.34 Coffee and Depression
- Do not create a dataset and run the test in R. Use just the information given in the problem.
- For (e), calculate the p-value “directly” (not using \(\chi^2\) test command in R). Also comment on whether you think the sample size condition would be met without computing the expected cell counts.
(a)
(b)
(c)
(d)
(e)
For (e), calculate the p-value “directly” (not using \(\chi^2\) test command in R). Also comment on whether you think the sample size condition would be met without computing the expected cell counts.
(f)
(g)
8.38 (a) & (extra) Salt intake and CVD
Do not do parts (b)-(c) in the book
(a)
- You can use the expected cell counts from R’s chi-squared test (you do not need to compute them using the formula).
- Comment on whether the sample size condition is met or not for these data.
(extra)
Run a Fisher’s Exact test. Include the hypotheses and a conclusion in the context of the problem.