Data 606 Homework 6.44, 6.48
n <- 1259
p <- .48
SE <-sqrt((p*(1-p))/n)
ME <- 1.96 * SE
ME
## [1] 0.02759723
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%
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
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)
.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
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