6.6 2010 Healthcare Law.

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

False. The confiden interval appies to the population.

(b) We are 95% confident that between 43% and 49% of Americans support the decision of the US Supreme Court on the 2010 healthcare law.

True, because the confidence interval is 46-3, 46+3 (43, 49).

(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 US Supreme Court, 95% of those sample proportions will be between 43% to 49%.

False. A 95% confidence level indicates that 95% of the population will be in the range of the confidence interval.

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

False. 90% will have a lower margin of error. 

6.12 Legalization of marijuana, Part I.

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

It is a sample statistics because they are from the sample of American population.

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

Observations are independent. The sample is nore more than 10% of population. 
Success-failure condition. The success and failure are both greater than 10. 

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

The confidence interval is (0.45, 0.51). It includes values greater than 50%, so it is not justified.

6.20 Legalization of marijuana, Part II.

n <- (0.48 * (1-0.48))/ (0.02 / (qnorm(0.975)))^2
ceiling(n)
## [1] 2398

6.28 Sleep depreivation, CA vs. OR, Part I.

SE_cal <- sqrt((0.08 * (1-0.08))/11545)
SE_org <- sqrt ((0.088 * (1-0.088))/4691)
SE_org_cal <- sqrt(SE_cal+SE_org)
LI <- (0.088-0.08) - (qnorm(0.975)*SE_org_cal)
UI <- (0.088-0.08)+ (qnorm(0.975)*SE_org_cal)
CI <- c(LI,UI)
CI
## [1] -0.1519639  0.1679639

6.44 Barking deer.

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

H0: The barking deer does not prefer a certain habitat to forage.
HA: The barking deer has certain habitats that it prefer to forage.

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

A chi-square test.

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

It is independent and all habitats have at least 5 expected cases, therefore this condition is 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.

   Zwood <- (0.9-4.8)^2/4.8
   Zgrass <- (3.8 - 14.7)^2 / 14.7
   Zforest <- (14.3-39.6)^2 / 39.6
   Zoth <- (81.0-40.9)^2 / 40.9
   Z_all <- Zwood + Zgrass + Zforest + Zoth
   Z_all
## [1] 66.7306
   1-pchisq(Z_all, 3)
## [1] 2.14273e-14

6.48 Coffe and Depression.

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

A Chi-Square test

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

H0: There is no relationship between coffee consumption and clinical depression
HA: There is relationship between coffee consumption and clinical depression

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

yes <- 2607
no <- 48132
total <- 50739
yes_prop <- yes/total
no_prop <- no/total
yes_prop
## [1] 0.05138059
no_prop
## [1] 0.9486194

(d) Identify the expected count for the highlighted cell, and calculated the contribution of this cell to the test statistic, i.e. (observed - expected)^2/expected.

p_depressed <- (2607/50739) * 100
p_normal <- ( 48132/50739) * 100
exp_cnt <- 6617 * 0.0514
obs_cnt <- 373
(obs_cnt - exp_cnt)^2 / exp_cnt
## [1] 3.179824

(e) The test statistic is chi-squared = 20.93. What is the pvalue?

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

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

We will reject H0 and accept HA because P-value is very small.

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

Yes. Because the result shows that there is a relationship between the coffee consumption and the depression.