--- title: "Math 150 - Methods in Biostatistics - Homework 3" author: "your name here" date: "Due: Wednesday, February 13, 2019, in class" output: pdf_document --- ```{r global_options, include=TRUE, message=FALSE, warning=FALSE} knitr::opts_chunk$set(message=FALSE, warning=FALSE, fig.height=3, fig.width=5, fig.align = "center") library(tidyverse) library(broom) ``` Note: there are two places to check for hints on R code. One is the class notes (http://st47s.com/Math150/Notes/, see R Examples) and the other is the R manual associated with the textbook which is on Sakai. ```{r warning=FALSE, message=FALSE, include=FALSE} # Multiple plot function # # ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects) # - cols: Number of columns in layout # - layout: A matrix specifying the layout. If present, 'cols' is ignored. # # If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE), # then plot 1 will go in the upper left, 2 will go in the upper right, and # 3 will go all the way across the bottom. # multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) { library(grid) # Make a list from the ... arguments and plotlist plots <- c(list(...), plotlist) numPlots = length(plots) # If layout is NULL, then use 'cols' to determine layout if (is.null(layout)) { # Make the panel # ncol: Number of columns of plots # nrow: Number of rows needed, calculated from # of cols layout <- matrix(seq(1, cols * ceiling(numPlots/cols)), ncol = cols, nrow = ceiling(numPlots/cols)) } if (numPlots==1) { print(plots[[1]]) } else { # Set up the page grid.newpage() pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout)))) # Make each plot, in the correct location for (i in 1:numPlots) { # Get the i,j matrix positions of the regions that contain this subplot matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE)) print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row, layout.pos.col = matchidx$col)) } } } ``` 1. Chp 6, A23 Show that the null hypothesis $H_0: \pi_1 = \pi_2$ is mathematically equivalent to the null hypothesis $H_0: \theta_1 / \theta_2 = 1$ where $\pi$ represents the proportion successful and $\theta$ represents the odds of success for any two groups (labeled 1 and 2). 2. Chp 6, E7 Cancer Cells: Testing for Homogeneity of Odds Use the data from Table 6.1 and define a benign cell as a success. Conduct a hypothesis test for the homogeneity of odds. (a) State the null and alternative hypotheses. (b) Calculate the odds ratio and the test statistics (the Z statistic!). (c) Provide the p-value and state your conclusions within the context of the study. 3. Chp 6, E11 Zocor Again The extended activities in Section 6.7 discussed a clinical study on Zocor, a drug used in lowering cholesterol, to determine if there was a difference between the treatment (Zocor) and the placebo in reducing the number of deaths from heart attacks. Table 6.14 shows the original data from this study. (a) Conduct a chi-square test to test the hypothesis that the proportion of deaths is different depending on the drug (treatment or placebo). Write the null and alternative hypotheses and clearly state your conclusions. [The R code is `chisq.test`, you should be able to run the anlaysis and interpret the output even if the details of the test are unfamiliar to you. We will follow-up this assignment by covering the chi-square test in class.] (b) The extended activities showed that the percentage of deaths from heart attacks only changed from 8.5% to 5% over a five-year time period. Is this difference of 3.5% too small to be of *practical* importance? Why or why not? 4. Chp 6, E12 The Pill Scare: understanding relative risk reduction In October 1995, the United Kingdom Committee on Safety of Medicines (CSM) issued a warning to 190,000 general practitioners, pharmacists, and directors of public health about oral contraceptive pills containing gestodene or desogestrel. The warning, based on three unpublished epidemiological research studies, stated "It is well known that the pill may rarely produce thrombosis (blood clots) involving veins of the legs. New evidence has become available indicating that the chance of thrombosis occurring in a vein increases about two-fold for some types of pills compared to others." Table 6.15 provides data from one of the studies. Since the occurrence of venous thrombosis is very rare (1 in 7000 for people using the second generation pill), 259 subjects were selected who had thrombosis and 651 similar subjects (from hospitals and community) who did not have thrombosis. Then these subjects were classified by the type of contraceptive they used. (a) Was either the explanatory (row) or the response (column) variable fixed before the study was conducted? (b) Is this an example of an experiment or an observational study? (c) Is this a cross-classification, cohort, or case-control study? (d) Create a segmented bar chart for the data. (e) Use a two-sided hypothesis and Fisher's exact test to determine if the type of contraceptive impacts the likelihood of thrombosis. Do you expect the researchers took care to collect a simple random sample of subjects? What conclusions can be drawn? The warning contained no numerical information other than the fact that the chance of blood clots was likely to double when birth control pills contained gestodene or desogestrel. This warning was widely publicized throughout the press, and evidence suggests that, as a result of this warning, many women ceased contraception altogether. Evidence shows a strong association between the warning and an increase in the number of unintended pregnancies and abortions (especially in women younger than 20 years old). This resulted in an estimated increase in cost of $\textsterling$ 21 million for maternity care and $\textsterling$ 4 to $\textsterling$ 6 million for abortion provision. (f) Remember that the actual occurrence of venous thrombosis is only 1 in 7000. If third generation pills double the chances of venous thrombosis, the likelihood of occurrence is still only 2 in 7000. Explain the difference between absolute risk reduction and relative risk reduction in this study. (g) Death from venous thrombosis related to third generation pills is estimated to be 1 in 11 million, much lower than the probability of death resulting from pregnancy. In 2005, the lifetime risk of maternal death in developed countries was 1 in 7300. The CSM warning did suggest that patients see a doctor before altering their contraceptives; however, it appears that many women simply stopped taking any contraceptives. Write a brief statement (just a few sentences!) to the press, general practitioners, pharmacists, and directors of public health about this study.