6.6, 6.12, 6.20, 6.28, 6.44, 6.48

data(package = 'openintro')

6.6

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, CI applied to a population and not just the sample.

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

False, this is estimating American support for the decision. CI defines a range of values where the parameter lies in.

(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, this is the definition of CI.

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

False, the CI would actually lower since the z-score is 1.645 at 90% as opposed to 1.96 at 95%

6.12

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. The survey asked 1259 US residents, and reports 48% saying legal. 1259 is a sample of the US population, therefore 48% is a sample statistic.

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

SE = sqrt(p*(1-p)/n)

n = 1259
p = 0.48
SE = sqrt(p*(1-p)/n)
SE
## [1] 0.01408022

lower and upper limits of CI

lower_lim = round(p - qnorm(.975)*SE,2)
upper_lim = round(p + qnorm(.975)*SE,2)
print(paste0("(",lower_lim,",",upper_lim,")"))
## [1] "(0.45,0.51)"

“We are within 95% confidence that between 45% and 51% of Americans believe Marijuana should be legal”

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

We assume that the observations are idependent, (conditions 1) The sample size is large enough, (condition 2)

The 2 conditions are met for this sample data so if we repeate the sample multiple times, we would follow a normal distribution.

(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 CI includes 51%, which would technically be a majortiy of Americans. However, I don’t believe that it is justified since it’s just 1% over.

6.20

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?

n = p*(1-p)/(ME/qnorm(0.975))^2

ME = 0.02
n = p*(1-p)/(ME/qnorm(0.975))^2
n
## [1] 2397.07

We would need a sample size of 2398 Americans to achieve a ME of 2% with a 95% CI.

6.28

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

find SE for each, then combined

p_cal <- 0.08
n_cal <- 11545
p_ore <- 0.088
n_ore <- 4691
se_cal <- sqrt(p_cal*(1-p_cal)/n_cal)
se_ore <- sqrt(p_ore*(1-p_ore)/n_ore)
se_comb <- sqrt(se_cal+se_ore)

calculate CI

p_diff <- p_ore-p_cal
lower <- round(p_diff-qnorm(0.975)*se_comb,3)
upper <- round(p_diff+qnorm(0.975)*se_comb,3)
ci <- paste0("(",lower,",",upper,")")
ci
## [1] "(-0.152,0.168)"

We are 95% confident that the difference in sleep deprivation between Oregon residents and California residents lies between -15.2% and 16.8% in samples taken with the given sample sizes.

6.44

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.

h0: The barking deer does not prefer to forage in certain habitats over others ha: The barkings deer has a preference in which habitat to forage in.

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

Chi-square test

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

Independence: we assume that the barking deer habitate variables are independent of one another Size: we have a sufficient size per senario.

(d) Do these data provide convincing evidence that barking deer prefer to forage in certain habitats over others? Conduct an appro- priate hypothesis test to answer this research question.

chi square calc

woods = ((0.9-4.8)^2)/4.8
grass = ((3.8-14.7)^2)/14.7
forest = ((14.3-39.6)^2)/39.6
other = ((81-40.9)^2)/40.9

combined = woods + grass + forest + other

1 - pchisq(combined,3)
## [1] 2.14273e-14

The p_value for the chi sq calculation is approx 0, we can therefore reject h0 and conclude that deers have a preference in where deer forage.

6.48

Researchers conducted a study investigating the relationship between ca↵einated co↵ee 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 ca↵einated 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 caffinated coffee consumption.

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

Chi sq

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

h0: There is no association between coffee intake and depression ha: There is an accociation between coffee intake and depression

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

prop_depression <- round(100*2607/50739,2) #5.14%
prop_norm <- round(100*48123/50739,2) #94.86%

*(d) Identify the expected count for the highlighted cell, and calculate the contribution of this cell to the test statistic, i.e. (Observed

expected <- 6617*prop_depression/100 # ~ 340
observed <- 373

contr = ((observed-expected)^2/expected)
contr
## [1] 3.179824

*(e) The test statistic is

p_val <- 1-pchisq(20.93,(5-1)*(2-1))
p_val
## [1] 0.0003269507

(f) What is the conclusion of the hypothesis test?

We fail to reject the h0

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

Correct, based off of our results we do not have enough evidence to reject h0, therefore we do not have enough evidence to confluce there is a relationship between coffee comsumption and depression.