HW6

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.

  1. 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. The confidence interval estimate the population population, not the sample.

  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.

TRUE: The CI is .46 +- .03, which leads to a CI of [.43, .49]

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

TRUE: This is what the confidence interval means.

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

FALSE: the SE is 0.025. When we use a 90% CI, we use a Z score of 1.645, therefore, the ME would be smaller than 3%.

z <- 1.96
ME <- .03
SE <- .03/z
ME.2 <- SE*1.645
ME.2
## [1] 0.02517857

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.

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

48% is a sample statistic due to it being part of a survey

  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.

Since we do not know the SE. We have to estimate with a worst case scenario with p-hat = .5. ** using this value, SE would be \(SE=\sqrt { \frac { (.5)(.5) }{ 1259 } }\) **The Z score is (.48-.50 = -.02)/SE. ME is z*SE. This comes out to roughly 0.02**

** The confidence interval is .48 +- .02 = [.45, .51]

n <- 1259
SE <- sqrt((0.5^2)/n)
SE
## [1] 0.0140915
Z <- 1.96
Z
## [1] 1.96
ME <- abs(Z)*SE
ME
## [1] 0.02761933
upper <- .48 + Z*SE
lower <- .48 - Z*SE
CI <- c(round(lower,4), round(upper,4))
paste0("The confidence interval is: ", CI)
## [1] "The confidence interval is: 0.4524"
## [2] "The confidence interval is: 0.5076"
  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.

Assuming that the sampling has independent observations and we can see 10 successes and 10 failuress in our sample, then we can assume that the sampling is nearly normal. The critic points out a true statement

  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?

This can be true, but it can also be false. The CI indicates that the true proportion should be between 45% and 51%. to be more precise, it is between 0.4524 and 0.5076. It is more likely that it falls below the 50% mark if we assume the midpoint to be accurate.

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 ?

Using the following formula, we construct the following equation: \(1.96*\sqrt { \frac { (.5)(.5) }n } <\quad 0.02\) \({ 1.96 }^{ 2 }*\frac { .25 }{ n } <\quad { 0.02 }^{ 2 }\) \({ 1.96 }^{ 2 }*\frac { .25 }{ { 0.02 }^{ 2 } } <\quad { n }\)

2401

# Assuming that we go with a worst case scenario and that we do not know what the assume proportion is, we will get the following value:
1.96^2*(.25/.02^2)
## [1] 2401

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

The CI is calculated below

** Our CI is [ -0.0015 0.0175] We are 95% confident that the difference in proporation of sleep deprivation is between CA and OR is between (-0.0015 0.0175).**

# Prop of CA who reported sleep deprivation
CA <- .08
# Prop of OR who reported sleep deprivation
OR <- .088
# CA n sample size
CA.n <- 11545
# OR sample size
OR.n <- 4691

# SE
SE <- sqrt(((CA*(1-CA))/CA.n)+((OR*(1-OR))/OR.n))
# Z score for .95 CI
z<- 1.96
# point estimate of the difference between OR and CA
PE <- OR-CA
# Upper boundary
upper <- round(PE + SE*z,4)
# Lower boundary
lower <- round(PE - SE*z,4)
# Confidence intervel
CI <- c(lower, upper)
CI
## [1] -0.0015  0.0175

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.

barking.deer <- matrix(c(4,16,67,345,426), nrow=1, byrow = TRUE)

colnames(barking.deer) <- c("Woods", "Cultivated grassplot", "Deciduous forests", "Other", "Total")


Expected.percent <- c(0.048, 0.147, 0.396, 0.409, 1.0)
barking.deer <- rbind(barking.deer, Expected.percent)

val <- barking.deer[2,1:4]*426
val <- append(val, sum(val))
names(val[5]) <- "Total"
barking.deer <- rbind(barking.deer, val)
barking.deer
##                   Woods Cultivated grassplot Deciduous forests   Other
##                   4.000               16.000            67.000 345.000
## Expected.percent  0.048                0.147             0.396   0.409
## val              20.448               62.622           168.696 174.234
##                  Total
##                    426
## Expected.percent     1
## val                426
  1. Write the hypotheses for testing if barking deer prefer to forage in certain habitats over others.

H0: Deers do not have a preference to forage in one area over another. H1: Deers do prefer to forage in some areas over others

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

The Chi Square test can help us answer this test based on the known forest areas vs the observed.

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

One of our cell counts has only observed 4 items. For the chi-square test, we need at least 5 expected observations. We are able to get an observed value of 20.448. Based on the general population of deers, there is no reason to assume that this test is not independent.

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

We need to calculate the chi-square test. Since we obtain a chi-square some of 276. We now need to conduct a p-test using 3 DF (k-1). We get a value of 1.144396e-59, which is almost zero. Therefore, the probability of this value given that H0 is true is extremely low, so we reject the null hypothesis.

chi.vals <- barking.deer[1,1:4] - barking.deer[3,1:4]
chi.vals <- chi.vals^2
x.square.vals <- chi.vals/barking.deer[3,1:4]
chi.square <- sum(x.square.vals)
chi.square
## [1] 276.6135
# 4 -1 
df <- 3
# Use built-in value to calculate chi-square p value
p.test <- pchisq(chi.square, df = df, lower.tail = FALSE)
p.test
## [1] 1.144396e-59

6.48

Coffee and Depression. Researchers conducted a study investigating the relationship between caffinated 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 caffinated coffe 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 co↵ffe consumption.

  1. What type of test is appropriate for evaluating if there is an association between coffe intake and depression?

We look at the deviations of counts from expected counts, e.g. An independence test.

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

H0: There is no correlation between coffee intake and risk of depression. H1: There is a correlation between coffee intake and risk of depression.

  1. Calculate the overall proportion of women who do and do not suffer from depression.
prop.women.depressed <- 2607/50739
prop.women.not.depressed <- 48132/50739

paste0("The prop of women who are depressed is: ", round(prop.women.depressed,4))
## [1] "The prop of women who are depressed is: 0.0514"
paste0("The prop of women who are not depressed is: ", round(prop.women.not.depressed,4))
## [1] "The prop of women who are not depressed is: 0.9486"
  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.
# Expected Value for 2-6 cups/week
expected.two.six.cups.week <- prop.women.depressed * 6617
expected.two.six.cups.week
## [1] 339.9854
chi.cell.value <- (373 - expected.two.six.cups.week)^2/expected.two.six.cups.week
paste0("The contribution of this cell is: ", round(chi.cell.value,4))
## [1] "The contribution of this cell is: 3.2059"
  1. The test statistic is x^2 = 20.93. What is the p-value?

In our calculation, we get a p-value of 0.000327.

# the DF is (5-1)(2-1) or 4
# using the formula, we get
pchisq(20.93, 4, lower.tail = FALSE)
## [1] 0.0003269507
  1. What is the conclusion of the hypothesis test?

** BAsed on the p-value, there appears to be some level of correlation between caffiene intake and depression and therefore, we can reject the null hypothesis, however, this is not 100% conclusive as there may be other factors that contribute.

  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.

As Mentioned in item f, there may be other factors that may be contributing to the apparent correlation (negative) between caffience intake and depression.