Assignment: 6.6, 6.12, 6.20, 6.28, 6.44, 6.48

On June 28, 2012 the U.S. Supreme Court upheld the much debated 2010 healthcare law, declaring it constitutional. A Gallup poll released the day after this decision indicates that 46% of 1,012 Americans agree with this decision. At a 95% confidence level, this sample has a 3% margin of error. Based on this information, determine if the following statements are true or false, and explain your reasoning.

We are 95% confident that between 43% and 49% of Americans in this sample support the decision of the U.S. Supreme Court on the 2010 healthcare law.

FALSE - we know that 46% of this sample supports the decision of the U.S. Supreme Court on the 2010 healthcare law. The confidence level is meant be applied to the population.

We are 95% confident that between 43% and 49% of Americans support the decision of the U.S. Supreme Court on the 2010 healthcare law.

TRUE - We are using the confidence interval to make this inference on the proportion of Americans who support the decision of the U.S. Supreme Court on the 2010 healthcare law.

If we considered many random samples of 1,012 Americans, and we calculated the sample proportions of those who support the decision of the U.S. Supreme Court, 95% of those sample proportions will be between 43% and 49%.

TRUE - This is the definition of a 95% confidence level.

The margin of error at a 90% confidence level would be higher than 3%.

FALSE - A lower confidence level produces a narrower interval. Therefore, when confidence level decreases, margin of error also decreases.

The 2010 General Social Survey asked 1,259 US residents: “Do you think the use of marijuana should be made legal, or not?” 48% of the respondents said it should be made legal.

Is 48% a sample statistic or a population parameter? Explain.

48% is a sample statistic, since the survey includes 1,259 US residents - not all US residents.

Construct a 95% confidence interval for the proportion of US residents who think marijuana should be made legal, and interpret it in the context of the data.

\(ME = 1.96\times SE = 1.96\times\sqrt{p(1-p)/n}\)

```
p = .48
n = 1259
ME = 1.96 * sqrt(p*(1-p)/n)
lower = p - ME
upper = p + ME
print(paste0("The confidence interval is (", lower, ", ", upper, ")"))
```

`## [1] "The confidence interval is (0.452402769762903, 0.507597230237097)"`

If we considered many random samples of 1,259 US residents, and we calculated the sample proportions of those who support the use of marijuana being legal, 95% of those sample proportions will be between 45.24% and 50.76%.

A critic points out that this 95% confidence interval is only accurate if the statistic follows a normal distribution, or if the normal model is a good approximation. Is this true for these data? Explain.

The normal model would be a good approximation because the sample size of both success and failures is large: 48% of 1259 is 604 and 52% of 1259 is 655. Also, each person is independent and the sample size is less than 10% of the total population.

A news piece on this survey’s findings states, “Majority of Americans think marijuana should be legalized.” Based on your confidence interval, is this news piece’s statement justified?

This news piece’s statement is an exaggeration, since although our confidence interval includes values greater than 50%, it also includes values below 50%. It is not certain that the true population proportion is above 50%.

As discussed in Exercise 6.12, the 2010 General Social Survey reported a sample where about 48% of US residents thought marijuana should be made legal. If we wanted to limit the margin of error of a 95% confidence interval to 2%, about how many Americans would we need to survey ?

We would need to survey at least 2398 Americans to limit the margin of error of a 95% confidence interval to 2%.

```
p = 0.48
ME = 0.02
n = (1.96^2 * (p*(1-p))) / ME^2
print(paste0("The necessary sample size to limit the margin of error of a 95% confidence interval to 2% is n = ", ceiling(n)))
```

`## [1] "The necessary sample size to limit the margin of error of a 95% confidence interval to 2% is n = 2398"`

According to a report on sleep deprivation by the Centers for Disease Control and Prevention, the proportion of California residents who reported insufficient rest or sleep during each of the preceding 30 days is 8.0%, while this proportion is 8.8% for Oregon residents. These data are based on simple random samples of 11,545 California and 4,691 Oregon residents. Calculate a 95% confidence interval for the difference between the proportions of Californians and Oregonians who are sleep deprived and interpret it in context of the data.

If we considered many random samples of 11,545 California and 4,691 Oregon residents, and we calculated the difference between sample proportions of California and Oregon residents who reported being sleep deprived, 95% of those sample proportion differences will be between -0.15% and 1.75%.

```
#california
p1 = .08
n1 = 11545
#oregon
p2 = .088
n2 = 4691
p = p2 - p1
SE = sqrt((p1 * (1-p1)/n1) + (p2 * (1-p2)/n2))
ME = 1.96 * SE
lower = p - ME
upper = p + ME
print(paste0("The confidence interval is (", lower, ", ", upper, ")"))
```

`## [1] "The confidence interval is (-0.00149812840882135, 0.0174981284088213)"`

Microhabitat factors associated with forage and bed sites of barking deer in Hainan Island, China were examined from 2001 to 2002. In this region woods make up 4.8% of the land, cultivated grass plot makes up 14.7% and deciduous forests makes up 39.6%. Of the 426 sites where the deer forage, 4 were categorized as woods, 16 as cultivated grassplot, and 61 as deciduous forests. The table below summarizes these data.

Write the hypotheses for testing if barking deer prefer to forage in certain habitats over others.

\(H_0\): The forage and bed sites of barking deer in Hainan Island are independent of microhabitat factors.

\(H_1\): The forage and bed sites of barking deer in Hainan Island are influenced by microhabitat factors.

What type of test can we use to answer this research question?

Goodness of fit using chi-square.

Check if the assumptions and conditions required for this test are satisfied.

We assume that the sites of barking deer are selected randomly, and independently of each other. Each category is mutually exclusive (a region cannot be both woods and grass plot, for example). The expected value of number of sample observations in each level should at least be 5. Woods have the smallest proportion of 0.048, and 0.048 * 426 = 20.4, which is greater than 5.

Do these data provide convincing evidence that barking deer prefer to forage in certain habitats over others? Conduct an appropriate hypothesis test to answer this research question.

Since the Chi-squared test for given probabilities produces a p-value of almost 0, we reject the null hypothesis. These data provide convincing evidence that barking deer prefer to forage in certain habitats over others

```
n = 426
region <- c(.048, .147, .396, 1 - sum(.048, .147, .396))
deer <- c(4, 16, 61, 426 - sum(4, 16, 61))
chisq.test(deer, p = region)
```

```
##
## Chi-squared test for given probabilities
##
## data: deer
## X-squared = 284.06, df = 3, p-value < 2.2e-16
```

Researchers conducted a study investigating the relationship between caffeinated coffee consumption and risk of depression in women. They collected data on 50,739 women free of depression symptoms at the start of the study in the year 1996, and these women were followed through 2006. The researchers used questionnaires to collect data on caffeinated coffee onsumption, asked each individual about physician-diagnosed depression, and also asked about the use of antidepressants. The table below shows the distribution of incidences of depression by amount of caffeinated coffee consumption.

What type of test is appropriate for evaluating if there is an association between coffee intake and depression?

Chi-square test for two-way tables.

Write the hypotheses for the test you identified in part (a).

\(H_0\): There is no association between coffee intake and risk of depression in women.

\(H_1\): There is an association between coffee intake and risk of depression in women.

Calculate the overall proportion of women who do and do not suffer from depression.

```
yes <- c(670,373,905,564,95)
no <- c(11545,6244,16329,11726,2288)
yes_prop = sum(yes) / sum(yes+no)
no_prop = sum(no) / sum(yes+no)
print(paste0("Proportion of women who suffer from depression: ", yes_prop))
```

`## [1] "Proportion of women who suffer from depression: 0.051380594808727"`

`print(paste0("Proportion of women who do not suffer from depression: ", no_prop))`

`## [1] "Proportion of women who do not suffer from depression: 0.948619405191273"`

Identify the expected count for the highlighted cell, and calculate the contribution of this cell to the test statistic, i.e. \(\frac{(Observed - Expected)^2}{Expected}\).

```
exp <- as.table(rbind(yes, no))
dimnames(exp) <- list(depression = c("Yes", "No"),
Coffee = c("less than 1/week","2-6/week", "1/day","2-3/day","greater than 4/day"))
Xsq <- chisq.test(exp)
Xsq$expected
```

```
## Coffee
## depression less than 1/week 2-6/week 1/day 2-3/day
## Yes 627.614 339.9854 885.4932 631.4675
## No 11587.386 6277.0146 16348.5068 11658.5325
## Coffee
## depression greater than 4/day
## Yes 122.44
## No 2260.56
```

The test statistic is 2 = 20.93. What is the p-value?

The p-value is 0.0003267.

`chisq.test(exp)`

```
##
## Pearson's Chi-squared test
##
## data: exp
## X-squared = 20.932, df = 4, p-value = 0.0003267
```

What is the conclusion of the hypothesis test?

Since the p-value is less than 0.05, we reject the null hypothesis. There is an association between coffee intake and risk of depression in women.

One of the authors of this study was quoted on the NYTimes as saying it was “too early to recommend that women load up on extra coffee” based on just this study. Do you agree with this statement? Explain your reasoning.

I agree with this statement, because correlation does not indicate causation. It is likely that there is some confounding variable that influenced the association between coffee intake and risk of depression in women.