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

Answer

False : We know 46% of Americans in this sample support the health care law. Therefore we are 100% confident. The confidence interval applies to the entire population and not just to the sample taken.

phat <- .46
n <- 1012
alpha <- 0.05
ME<- .3


Z <- qnorm(alpha, lower.tail = FALSE)
SE <- sqrt( 
 phat*(1-phat)  /n
)
SE
## [1] 0.01566699
MarginOfErro <- Z*SE
MarginOfErro
## [1] 0.0257699
phat+MarginOfErro
## [1] 0.4857699
phat-MarginOfErro
## [1] 0.4342301

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

Answer

True. That’s what the confidence interval tells us ***

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

Answer

FALSE: Here question is reffering to Sample propotion, but % derived is from Confidence Interval. Our confidence interval gives us a range of possible values for the true population proportions not the sample Propotions.


  1. The margin of error at a 90% confidence level would be higher than 3%. ### Answer
phat <- .46
n <- 1012
alpha <- 0.05
ME<- .3


Z <- qnorm(alpha, lower.tail = FALSE)
SE <- sqrt( 
 phat*(1-phat)  /n
)
SE
## [1] 0.01566699
MarginOfErro <- Z*SE
MarginOfErro
## [1] 0.0257699
phat+MarginOfErro
## [1] 0.4857699
phat-MarginOfErro
## [1] 0.4342301
alpha <- 1-.90
Z <- qnorm(alpha, lower.tail = FALSE)
SE <- sqrt( 
 phat*(1-phat)  /n
)
SE
## [1] 0.01566699
MarginOfErro90 <- Z*SE
MarginOfErro90
## [1] 0.02007805
MarginOfErro
## [1] 0.0257699
phat+MarginOfErro90
## [1] 0.4800781
phat-MarginOfErro90
## [1] 0.4399219

at 95% ME : 0.0257699 with CI : c(0.4342301, 0.4857699 ), at 90% MarginOfErro 0.0200781, with CI : c(0.4399219, 0.4800781 )

The CI will be narrower and the so the margin of error will be smaller.


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.44 (a) Is 48% a sample statistic or a population parameter? Explain.

Answer

48% is Sample statistic, becuase it was taken from a sample of the population

n<- 1259
phat <- .48

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

Answer

n<- 1259
phat <- .48
alpha <- .05/2 # As its 2 tail 
Z <- qnorm(alpha, lower.tail = FALSE)
SE1 = sqrt((0.48 * (1 - 0.48))/1259)
SE <- sqrt( 
 phat*(1-phat)  /n
)
SE
## [1] 0.01408022
SE1
## [1] 0.01408022
MarginOfErro <- Z*SE
MarginOfErro
## [1] 0.02759672
HI =phat+MarginOfErro

# HI
LI =phat-MarginOfErro

# LI

c(LI,HI)
## [1] 0.4524033 0.5075967

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

Answer

Yes, All required conditions have been met.The sample size is large enough and Samples are independent.

  1. Observations are independent. The sample taken must have been and should not be more than 10% of the population. For this survey, we can reasonably say that this is true.

  2. Success-failure condition. The sample size must also be sufficiently large - that is the success and failure rates must be greater than 10. In this case, this condition is true - 48% and 52% of 1,259 are greater than 10.


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

Answer

CI (0.4524033, 0.5075967), We cannot reject the hypothesis that the proportion of Americans who think marijuana should be legalized is above 50%, however we also cannot reject the hypothesis that the proportion is below 50%. It is possible considering the upper tail of our confidence interval 0.5076233 is above 50%.

Some check by setting psuccess= .5 , we see that we are Failed to Reject this null hypothessis. where p= 50%.

n<- 1259
phat <- .48
psuccess <- .50

alpha <- .05/2 # As its 2 tail 
Z <- qnorm(alpha, lower.tail = FALSE)

SE <- sqrt( 
 phat*(1-phat)  /n
)
SE
## [1] 0.01408022
MarginOfErro <- Z*SE
MarginOfErro
## [1] 0.02759672
HI =phat+MarginOfErro

# HI
LI =phat-MarginOfErro

# LI

c(LI,HI)
## [1] 0.4524033 0.5075967
Ztest <- (phat - psuccess)/sqrt((psuccess*psuccess)/n)
Ztest
## [1] -1.419296
pval <- 1- pnorm(Ztest)
pval
## [1] 0.9220936
alpha95 <- 1-.95

pval <= alpha95 # Reject 
## [1] FALSE
pval >= alpha95 # Failed to Reject 
## [1] TRUE
# Also qnorm(alpha95) = 1.645 , Ztest =  0.7096478, Zstattics is in Failed to Reject region . 

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 ?

Answer

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

n= ?

ME = 0.02 z = 1.96 # for 95% conf level n = ((z^2) *p(1-p))/(ME^2)

phat <- .48
alpha <-  .05
ME = 0.02
z = 1.96 # for 95% conf level
z <- 1.96
# n = ((z^2) *p(1-p))/(ME^2)
n <- (z^2 * (phat)*(1-phat))/ ME^2
ceiling(n)
## [1] 2398

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 di???erence between the proportions of Californians and Oregonians who are sleep deprived and interpret it in context of the data.53

Answer

Claim nH : No difference in sleep deprivation i.e. Pcal = POre aH : Difference in sleep deprivation i.e. Pcal Not = POre


Dif of two propotion phat <- p1-p2 SE <- sqrt((p1(1-p1)/n1) + (p2(1-p2)/n2) ) ME <- Zalpha * SE

CI (point estimate + - ME)

point estimate = P1- p2

nCal<- 11545
phatsleepCal <- .08
nOre<- 4691
phatsleepOre <- .088
aplha <- .05 # for 95% cof interval 
phatdiff <-  phatsleepCal  - phatsleepOre 
phatdiff
## [1] -0.008
# Compute standard error and margin of error for the proportion difference.
Z <- qnorm(alpha/2, lower.tail = FALSE) #1.96 #


SEDiff <- sqrt((phatsleepCal*(1-phatsleepCal)/nCal)  +  (phatsleepOre*(1-phatsleepOre)/nOre) )


MarginOfErro <- Z*SEDiff 
MarginOfErro
## [1] 0.009497954
HI =phatdiff+MarginOfErro

# HI
LI =phatdiff-MarginOfErro

# LI

c(LI,HI)
## [1] -0.017497954  0.001497954
# -----Calcualte Z test statics so we can find pvalue 
# Also since its two categorical vlaue we need to get ppool ie. phatpool <- (p1+p2)/(np1+np2)
phatpool <- (phatsleepCal+phatsleepOre)/(nCal+nOre)
phatpool
## [1] 1.034738e-05
Ztest <- (phatdiff-0)/sqrt(((phatpool*(1-phatpool))/nCal) + 
                           ((phatpool*(1-phatpool))/nOre))

Ztest
## [1] -143.6373
pvalueProp <- 1 - pnorm(Ztest)

pvalueProp <= alpha # Reject 
## [1] FALSE
pvalueProp > alpha # Failed to Reject 
## [1] TRUE

We fail to reject Null hypothessis as Pvalue is greater than Alpha . ***

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.62 Woods Cultivated grassplot Deciduous forests Other Total 4 16 67 345 426

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

Answer

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


  1. What type of test can we use to answer this research question?

Answer

We can use a chi-squared test to answer this research question. Since we have cases that can be classified into several groups (deer habitats where they forage), we can determine if the forage habitats proportion is representative of the land make up.


  1. Check if the assumptions and conditions required for this test are satisfied.

Answer

Independence: We will have to assume it since is not given in the description.

Sample size / distribution: In our expected cases scenario, all habitats have at least 5 expected cases, therefore this condition is satisfied since it has at least 5 expected cases.


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

Answer

habitats <- c(4, 16, 67, 345)
region <- c(20.45, 62.62, 168.70, 174.23)
k <- length(habitats)
df <- k - 1
# Compute the chi2 test statistic
chi <- (habitats - region ) ^ 2 / region
chi <- sum(chi)

# check the chi2 test statistic and find p-val
p_Val <- 1 - pchisq(chi, df = df)

The chi-Square value is large enough that the p-value is 0. Hence, we conclude that there is convincing evidence the barking deer forage in certain habitats over others.


6.48 Co???ee and Depression. 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 ca???einated co???ee consumption.63 Ca???einated co???ee consumption ???1 2-6 1 2-3 $ 4 cup/week cups/week cup/day cups/day cups/day Total Clinical Yes 670 373 905 564 95 2,607 depression No 11,545 6,244 16,329 11,726 2,288 48,132 Total 12,215 6,617 17,234 12,290 2,383 50,739 (a) What type of test is appropriate for evaluating if there is an association between co???ee intake and depression?

Answer

The Chi-squared test for two-way tables is appropriate for evaluating if there is an association between coffee intake and depression.


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

Answer

The hypotheses for the Chi-squared two-way table test are as follows.

H0: There is no association between caffeinated coffee consumption and depression.

HA: There is an association between caffeinated coffee consumption and depression.


  1. Calculate the overall proportion of women who do and do not suffer from depression.

Answer

yes_dep <- 2607
no_dep <- 48132
total_dep <- yes_dep + no_dep
total_dep
## [1] 50739
p_depressed = (2607/total_dep) * 100; 
round(p_depressed, digits=2) #women who are depressed
## [1] 5.14
p_normal = (48132/total_dep) * 100; 
round(p_normal, digits=2) #women who are normal  
## [1] 94.86

The overall proportion of women who do suffer from depression is 5.14%. The overall proportion of women who do not suffer from depression is 94.86%


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

Answer

groups = 5
dF = 4
expected = ((2607/50739 )*6617)
Observed <- 373
chipart = (Observed - expected)^2/expected
chipart
## [1] 3.205914

The expected count for the highlighted value is 3.2059144


  1. The test statistic is X^2 = 20.93. What is the p-value?

Answer

n <- 5
k <- 2

df <- (n-1)*(k-1)
chi2 <- 20.93

pValue = pchisq(chi2,dF,lower.tail = FALSE)
pValue
## [1] 0.0003269507

The p-value is 0.0003269507


  1. What is the conclusion of the hypothesis test?

Answer

Since the p-value is very small (0.0003), since its smaller than the 0.05 we reject the null hypothesis that There is no association between caffeinated coffee consumption and depression.


  1. 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.64 Do you agree with this statement? Explain your reasoning.

Answer

I agree it is too early to recommend that women load up on extra coffee. Based on this study, there is a very weak relationship between coffee consumption and depression among women. further tests would need to be conducted a before we can explicitly state that coffee effectively treats depression in women.