2010 Healthcare Law. (6.48, p. 248) 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, this refers to a sample size not the total population.
The 95% CI includes 43%-49% because .46 +/- 0.03.
n<-1012
p<-0.46
1.96*sqrt((p*(1-p))/n)
## [1] 0.0307073
True, meets all the conditions and as calculated above.
#z score for 90% confidence level is 1.282
ME=0.02
p=.46
n=1012
ME=1.282*sqrt((p*(1-p))/n)
ME
## [1] 0.02008508
Legalization of marijuana, Part I. (6.10, p. 216) The 2010 General Social Survey asked 1,259 US res- idents: “Do you think the use of marijuana should be made legal, or not?” 48% of the respondents said it should be made legal.
Sample statistic because it was from 48% of the respondents.
p<-0.48
n<-1259
1.96*sqrt((p*(1-p))/n)
## [1] 0.02759723
0.48 +/- 0.0276
Yes because it meets all the conditions: independent cases, less than 10% of the population, n>30 and at least 10 successes or fails.
False. H0- majority in favor of legalizing HA- not legalizing
p<-0.5
n<-1259
SE=sqrt((p*(1-p)/n))
SE
## [1] 0.0140915
PE<-0.48
null<-0.50
Z=(PE-null)/SE
Z
## [1] -1.419296
Based on the z-score, we can calculate the p value to be 0.0778. Since it’s greater than 0.05 we fail to reject the null hypothesis of the majority in favor of legalizing.
Legalize Marijuana, Part II. (6.16, p. 216) 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 ?
We need to survey 2397 Americans to have a margin of error of a 95% confidence interval to 2%.
p<-0.48
ME<-0.02
n=(p*(1-p))/((ME/1.96)^2)
n
## [1] 2397.158
Sleep deprivation, CA vs. OR, Part I. (6.22, p. 226) 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.
P3+/-1.96*SE3 -.008 +/- 0.009498128 (-0.01749813, 0.001498128)
We are 95% confidence that the difference of proportion of California and Oregon who are sleep deprived because the difference falls within the interval calculated.
#Cali
n1=11545
p1=0.08
#Oregon
n2=4691
p2=0.088
p3=p1-p2
p3
## [1] -0.008
SE1=(p1*(1-p1)/n1)
SE1
## [1] 6.375054e-06
SE2=((p2*(1-p2))/n2)
SE2
## [1] 1.710851e-05
SE3=sqrt(SE1+SE2)
SE3
## [1] 0.004845984
1.96*SE3
## [1] 0.009498128
p3+1.96*SE3
## [1] 0.001498128
p3-1.96*SE3
## [1] -0.01749813
Barking deer. (6.34, p. 239) 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.
H0=Barking deer have no preference. HA=Barking deer prefer to forage in certain habitats over others.
observed <- c(4, 16, 61, 345, 426)
expected <- c(20.448, 62.622, 168.696, 174.234, 426)
deer<-rbind(observed, expected)
colnames(deer) <-c("woods", "grassplot", "deciduous forests", "other", "total")
deer
## woods grassplot deciduous forests other total
## observed 4.000 16.000 61.000 345.000 426
## expected 20.448 62.622 168.696 174.234 426
Chi-square test statistic
Each expected count must be at least 5. There are independences between each cases.
k<-4
df<-k-1
z1<-(observed[1]-expected[1])/sqrt(expected[1])
z2<-(observed[2]-expected[2])/sqrt(expected[2])
z3<-(observed[3]-expected[3])/sqrt(expected[3])
z4<-(observed[4]-expected[4])/sqrt(expected[4])
x2<-(z1^2)+(z2^2)+(z3^2)+(z4^2)
x2
## [1] 284.0609
(p_value <- 1 - pchisq(x2, df))
## [1] 0
P value is close to 0. We do reject the null hypothesis. Barking deer prefer to forage in certain habitats over others.
Coffee and Depression. (6.50, p. 248) 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.
{}
Chi-square for two-way tables
Write the hypotheses for the test you identified in part (a). H0=The risk of depression remains the same despite the amout of coffee consumed. HA=The risk of depression Varies upon the amount of coffee consumed.
Calculate the overall proportion of women who do and do not suffer from depression.
Women who suffer from depression - 0.05138059 Women who do not suffer from despression - 0.9486194
#Women who suffer from depression
2607/50739
## [1] 0.05138059
#Women who do not suffer from despression
48132/50739
## [1] 0.9486194
Expected Count is 339.9854.
Contribution of this cell to the test statistic is 3.206.
Row1<-2607
Col2<-6617
tabletotal<-50739
(Row1*Col2)/(tabletotal)
## [1] 339.9854
O<-373
E<-339.9854
((O-E)^2)/E
## [1] 3.205914
df=(2-1)*(5-1)=4 p-value = 0.0003269507
df<-4
x2<-20.93
(p_value <- 1 - pchisq(x2, df))
## [1] 0.0003269507
We reject the null hypothesis. HA=The risk of depression Varies upon the amount of coffee consumed.
Yes because this study is just observational.