Chapter 6 - Inference for Categorical Data

2010 Healthcare Law. (6.48, p. 248)

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.

(a) 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 Americans in this sample support the decision.

(b) 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. This is what the sample is trying to estimate.

(c) 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. That is essentially the definition of the confidence interval.

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

False. A smaller confidence interval implies a smaller z score, so our confidence interval would actually shrink.


Legalization of marijuana, Part I. (6.10, p. 216)

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.

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

48% is a sample statistic. It is not representative of the population as a whole.

(c) 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.

Yes it is true for this data. np is greater than 10 (see below), the sample size is less than 10% of the overall population so the observations are considered independent. Although not stated, we can assume that the sample is randomized.

n*p_hat
## [1] 604.32
(d) 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?

The majority of americans implies greather than 50%. Our confidence interval is (45.24%, 50.76%). Although the upper bound of the interval is greater than 50% it is not sufficient to make the above claim as the true mean could be less than 50% which is likely given the lower bound. In order to make that statement, we would need the lower bound of the confidence interval to be greater than 50%.


Legalize Marijuana, Part II. (6.16, p. 216)

As discussed in Exercise above, 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 ?

\(ME = z^{*} \times\ SE\)
\(where\ SE = \sqrt{\frac{p(1-p)}{n}}\)

Solve for n:

z_star <- 1.96
p <- 0.48
n <- (p*(1-p))*(z_star/0.02)^2
n
## [1] 2397.158

Sleep deprivation, CA vs. OR, Part I. (6.22, p. 226)

According to a report on sleep deprivation by the Centers for Disease Control and Prevention, the proportion of California residents who reported insuffient 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.

\(\hat{p}_c = 0.08\ \ n=11,545\)
\(\hat{p}_o = 0.088\ \ n=4691\)

Ho: \(\hat{p}_c = \hat{p}_o\)
Ha: \(\hat{p}_c \neq \hat{p}_o\)

phat_c = 0.08
nc = 11545
phat_o = 0.088
no = 4691

p_diff = phat_o - phat_c

SE = sqrt((phat_c*(1-phat_c))/nc + (phat_o*(1-phat_o))/no)
ME = 1.96 * SE
CI <- c(p_diff - ME, p_diff + ME)
CI
## [1] -0.001498128  0.017498128

The confidence interval contains 0 so the difference between the proportions is not statistically significant.


Barking deer. (6.34, p. 239)

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.

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

Ho: Barking deer have no preference in foraging habitats
Ha: Barking deer do have a preference in foraging habitats

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

We can use the Chi-squared goodness of fit test

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

The conditions for this test:
- Independence
- Each scenario must have at least 5 expected case

The conditions are satisfied.

(d) 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.
observed <- c(4, 16, 61, 345, 426)
expected_prop <- c(0.048, 0.147, 0.396, 1-0.048-0.147-0.396, 1)
expected <- expected_prop * 426
habitats <- rbind(observed, expected)
colnames(habitats) <- c("woods", "grassplot", "forests", "other", "total")
habitats
##           woods grassplot forests   other total
## observed  4.000    16.000  61.000 345.000   426
## expected 20.448    62.622 168.696 174.234   426

There are 4 cells, so 3 degrees of freedom. The test statistic is 284 which is very high so we should reject Ho in favor of Ha.

k <- 4
df <- k-1

chi2 <- sum((habitats[1,] - habitats[2,])^2/habitats[2,])
chi2
## [1] 284.0609

We verify the p value and see that it is essentially 0 which backs up how conclusion that we should reject Ho and that deer do have a preference in foraging habitat.

pchisq(q = chi2, df = df, lower.tail = FALSE)
## [1] 2.799724e-61

Coffee and Depression. (6.50, p. 248)

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 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.

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

We can use the chi-squared goodness of fit test.

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

Ho: there is no link between caffeine consumption and depression
Ha: there is a link between caffeine consumption and depression

(c) Calculate the overall proportion of women who do and do not suffer from depression.
# proportion of women suffering from depression
dep_yes <- 2607/50739
dep_yes
## [1] 0.05138059
# proportion of women not suffering from depression
dep_no <- 48132/50739
dep_no
## [1] 0.9486194
(d) Identify the expected count for the highlighted cell, and calculate the contribution of this cell to the test statistic, i.e. (\(Observed - Expected)^2 / Expected\)).
# proportion of women who drink 2-6 cups a week
round(6617*dep_yes)
## [1] 340
# expected number of depressed women
(373-340)^2/340
## [1] 3.202941
(e) The test statistic is \(\chi^2=20.93\). What is the p-value?
df <- 5-1
pchisq(q = 20.93, df = df, lower.tail = FALSE)
## [1] 0.0003269507
(f) What is the conclusion of the hypothesis test?

The p value is very small so there is evidence to reject Ho in the favor of Ha and we can conclude that there is an association between caffeine consumption and depression in women.

(g) 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.

All that we’ve established is that there is a link but the experiment was only observation and not designed to demonstrate causation.