HW 7: BSTA 511-611 F23
Due 11/18/23
Download the .qmd file for this assignment from https://github.com/niederhausen/BSTA_511_F23/blob/main/homework/HW_7_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
- 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
8.2 Young Americans, Part I
8.8 Legalization of marijuana, Part I
Additional instructions:
- (b): Calculate the CI both using the formula and using the appropriate R statistical test.
- Add parts (e) & (f) as instructed below.
(a)
(b)
(c)
(d)
(e)
Test whether the proportion of US residents who think marijuana should be made legal is different than 0.586. Do the test using both the formulas and running it in R (without a continuity correction).
(f)
Are the results from CI and hypothesis test consistent? Why or why not?
8.10 Legalize Marijuana, Part II
8.14 2010 Healthcare Law
8.24 Prenatal vitamins and Autism
Additional instructions:
- (b): Do the hypothesis test both using the formula and using the appropriate R statistical test.
- Add part (d) as instructed below.
(a)
(b)
(c)
(d)
Calculate and interpret the 95% confidence interval for the difference in proportions using the formula. Is it consistent with CI from the R output of the hypothesis test?
8.26 An apple a day keeps the doctor away
8.28 True or false, Part II
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.
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.
1 PSS
1.1 PSS1: Legalize Marijuana, Part III.
1.1.1 Power
In exercise 8.8 (e), we tested whether the proportion of US residents who think marijuana should be made legal is different than 0.586. Calculate the power for the hypothesis test and include an interpretation of the power in the context of the research question. Was it sufficiently powered?
1.1.2 Sample size
For the same test, what sample size would be needed for 80% power? How about 90% power?
1.1.3 Effect size
If we increase the sample size, and keep the power and significance level the same, does the effect size increase or decrease? Why?