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.
False. We know that 46% of Americans in this sample support the decision.
True. This is what the sample is trying to estimate.
True. That is essentially the definition of the confidence interval.
False. A smaller confidence interval implies a smaller z score, so our confidence interval would actually shrink.
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.
48% is a sample statistic. It is not representative of the population as a whole.
p_hat <- 0.48
n <- 1259
z <- qnorm(0.975)
SE <- sqrt(p_hat*(1-p_hat)/n)
c(p_hat-z*SE, p_hat+z*SE)
## [1] 0.4524033 0.5075967
We are confident that the true population mean would be captured in the confidence interval 95% of the time.
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
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%.
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
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.
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.
Ho: Barking deer have no preference in foraging habitats
Ha: Barking deer do have a preference in foraging habitats
We can use the Chi-squared goodness of fit test
The conditions for this test:
- Independence
- Each scenario must have at least 5 expected case
The conditions are satisfied.
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
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.
We can use the chi-squared goodness of fit test.
Ho: there is no link between caffeine consumption and depression
Ha: there is a link between caffeine consumption and 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
# 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
df <- 5-1
pchisq(q = 20.93, df = df, lower.tail = FALSE)
## [1] 0.0003269507
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.