CH 11 Quiz R COde.docx - 1 >...

This preview shows page 1 - 4 out of 8 pages.

1. > prop.test(c(113,97),c(469,615),alternative = "greater",conf.level=.99,correct = F) 2-sample test for equality of proportions without continuity correction data: c(113, 97) out of c(469, 615) X-squared = 11.796, df = 1, p-value = 0.0002967 alternative hypothesis: greater 99 percent confidence interval: 0.02594852 1.00000000 sample estimates: prop 1 prop 2 0.2409382 0.1577236 > sqrt(11.796) [1] 3.434531 2. > A <- c(7,2,4, 6, 4, 6,2,3,12,9,3,14,3,7,5,5,2,14, 6,6,6,6,5,7, 8,4,13,7,5,0) > B <- c(0,5,5,4,7,1,6,2,9,2,8,8,2,10,4,3,3,4,1,9,3,5,1,3,3,3,5,2,7,2) > par(mfrow= c(1,2)) > boxplot(A) > NPPH <- qqnorm (A) > qqline (A) > boxplot(B)
> nppQ <-qqnorm (B) > qqline (B) > cor(NPPH$x,NPPH$y) [1] 0.9545909 > cor(nppQ$x,nppQ$y) [1] 0.9697697 > t.test (A,B,alternative = "two.sided",paired = T) Paired t-test data: A and B t = 2.5006, df = 29, p-value = 0.0183 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.3277743 3.2722257 sample estimates: mean of the differences 1.8 3. > prop.test(c(710,690),c(1205,1310),conf.level = .95,correct = F)$conf.int [1] 0.02373041 0.10125772 attr(,"conf.level") [1] 0.95 4. > prop.test(c(195,215),c(561,542),alternative = "greater",correct = F)
2-sample test for equality of proportions without continuity correction data: c(195, 215) out of c(561, 542) X-squared = 2.844, df = 1, p-value = 0.9541 alternative hypothesis: greater 95 percent confidence interval: -0.09692171 1.00000000

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture