Chapter 6 - Inference for Categorical Data Graded: 6.6, 6.12, 6.20, 6.28, 6.44, 6.48
6.6 2010 Healthcare Law. 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.
F: The confidence interval is for the population proportion, not the sameple proportion.
T: The confidence interval is for the population parameter.
T: This is how the confidence interval is defined.
F: As the confidence interval goes down, the margin of error goes down.
6.12 Legalization of marijuana, Part I. 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 statistics as 48% of those sampled responded that way.
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.
We are 95% confident that the population proportion of U.S. residents who think marijuana should be made legal lies between the range (0.4524, 0.5076).
n <- 1259
p <- 0.48
se <- sqrt((p * (1-p))/n)
me <- 1.96 * se
.48-me
## [1] 0.4524028
.48+me
## [1] 0.5075972
The observations are independent of each other, and there are at least 10 successes and 10 failures in our sample, so the 95% confidence interval is accurate in this case.
This news piece is not justified because our 95% confidence interval ranges between 45.24% and 50.76% of Americans thinking that marijuana should be legalized. So, our proportion could very likely be less than 50%, and the statement that the majority of Americans believe in legalization would be false.
6.20 Legalize Marijuana, Part II. 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 2398 Americans.
p <- 0.48
me <- 0.02
se <- me / 1.96
n <- p * (1-p) / (se^2)
n
## [1] 2397.158
6.28 Sleep deprivation, CA vs. OR, Part I. 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 diffrence between the proportions of Californians and Oregonians who are sleep deprived and interpret it in context of the data.
We are 95% confident that the true difference in the proportion of those sleep deprived in California and those in Oregon falls between (-0.001, 0.017). Since 0 falls within this range, we can conclude that there is no significant evidence that there is a difference between these proportions and might in fact be equal.
n1 <- 11545
p1 <- .08
se1 <- sqrt(p1* (1-p1) / n1)
n2 <- 4691
p2 <- .088
se2 <- sqrt(p2* (1-p2) / n2)
p <- p2 - p1
se_p <- sqrt(se1^2 + se2^2)
me_p <- 1.96 * se_p
u <- p - me_p
l <- p + me_p
u
## [1] -0.001498128
l
## [1] 0.01749813
6.44 Barking deer. 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.
H0: There is no preference for foraging in certain habitats Ha: There is a preference to forage in certain habitats
We can use a chi-square test to answer this question.
Each case is independent from the others and each scenario (habitat) has at least 5 cases, so the assumptions and conditions are satisfied.
The p-value for our chi-test is 1.1358e-59 < 0.05, so we reject the null hypothesis and conclude that there is a preference to forage in certain habitats.
habitats <- c(4, 16, 67, 345)
exp <- c(20.45, 62.62, 168.70, 174.23)
test <- 0
for(i in 1:4) {
test <- test + ((habitats[i] - exp[i])^2 / exp[i])
}
p <- pchisq(test, df=3, lower.tail=FALSE)
test
## [1] 276.6286
p
## [1] 1.135815e-59
6.48 Coffee and Depression. 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 co↵ee consumption, 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). H0: Depression outcomes are the same regardless of how many cups of coffee were consumed per week. Ha: Depression outcomes varies by the number of cups of coffee consumed per week.
Calculate the overall proportion of women who do and do not suffer from depression. 5.14% of women sufffer from depression and 94.86% of women do not suffer from depression.
2607/50739
## [1] 0.05138059
48132/50739
## [1] 0.9486194
The expected count for the highlighted cell is 339.99. The contribution of this cell to the test statistics is 3.21.
percentdep <- 2607/50739
expVal <- percentdep * 6617
obsVal <- 373
expVal
## [1] 339.9854
contrib <- (obsVal - expVal)^2/expVal
contrib
## [1] 3.205914
The p-value is 0.00032 < 0.05.
pVal <- pchisq(20.93, df=4, lower.tail=FALSE)
pVal
## [1] 0.0003269507
Since our p-value is 0.00032 < 0.05, we reject the null hypothesis and conclude that depression outcomes differ by the number of cups of coffee consumed per week.
I agree with this statement as this is just an observational study and there may have been several other factors that correlate with lower depression and led individuals to drink more coffee to begin with.