Data 606 Homework 6.44, 6.48

6.6

  1. False. Our confidence interval is made to estimate a population not a sample. b True.
  2. True.
  3. False. The margin of error would be smaller than 3%

6.12

  1. It is a sample statistic, since it was decided from a sample population
n <- 1259
p <- .48
SE <-sqrt((p*(1-p))/n)
ME <- 1.96 * SE
ME
## [1] 0.02759723
  1. We assume the sample is random and independant. The sample is smaller than 10% of the population.
n*p
## [1] 604.32
n*(1-p)
## [1] 654.68

Both sucesses and failures are over 10 d. No, this pieces of news is not justified. It is based on a small portiion of the population and .48 is less than the 50%

6.20

p <- .48
ME <- .02
z <- 1.96
SE <- ME/z
n <- ((p * (1-p)) / (SE^2))
n
## [1] 2397.158

We would need to survey 2397 people

6.28

p1 <- .08
p2 <- .088
n1 <- 11545
n2 <- 4691
z <- 1.96
SE1 <- (p1 * (1-p1)) / n1
SE2 <- (p2 * (1-p2)) / n2
SE <- sqrt (SE1 + SE2)
ME <- z * SE
ME
## [1] 0.009498128
p3 <- p1 - p2
z * SE + p3
## [1] 0.001498128
z * SE - p3
## [1] 0.01749813

95% confidence intercal is betweeen (.001498. .017498)

6.44

  1. H0:Barking deer have no preference to forage in certain habitats HA:Barking deer do have a preference to forage in a certain habitat
  2. goodness of fit using chi-square
  3. assumption is deer did not influence each other, so the samples are independant.
.048*426
## [1] 20.448

20.448 is greater than 5, satisfying the condition. d.

k <- 4
df <- (k - 1)
chi <- 0
for (i in 1:k)
{
  chi <- chi + ((k - k[i]^2) / k[i])
}
chi
## [1] NA

6.48

  1. the chi-squared test for two-way tables.
  2. H0: There is no association between caffeine consumption and depression HA: There is an association between cafeeine consumption and depression
wdep<- (2607/50739)
wodep<- (48132/50739)
wdep*100 
## [1] 5.138059
wodep*100
## [1] 94.86194
exp <- wdep*6617
cellcont <- ((373 - exp)^2)/exp
cellcont
## [1] 3.205914
k <- 5
df <- (k-1)
pval <- pchisq(20.93,df, lower.tail = FALSE)
pval
## [1] 0.0003269507
  1. pval is less than .05, we reject the null hypothesis