R Lab7
R Lab7
R Lab7
B 185 169 173 173 188 186 175 174 179 180
R code
• z.test2sam = function(a, b, var.a, var.b)
• {
• n.a = length(a)
• n.b = length(b)
• zeta = (mean(a) - mean(b)) / (sqrt(var.a/n.a + var.b/n.b))
• return(zeta)
• }
• a = c(175, 168, 168, 190, 156, 181, 182, 175, 174, 179)
• b = c(185, 169, 173, 173, 188, 186, 175, 174, 179, 180)
• zcal=abs(z.test2sam(a, b, 5, 8.5))
• alpha=0.05
• ztab=qnorm(1-alpha/2)
• if(zcal < ztab) {print("Accept H0")} else {print("Reject H0")}
Inference
The value of z is greater than the critical value
of z tabulated for alpha equal to 0.05 (z-
tabulated = 1.96 for a two-tailed test): we
reject the null hypothesis and conclude that
the two means are significantly different.
Assignment
• The Trial Urban District Assessment (TUDA) is a study
sponsored by the government of student achievement in
large urban school district. In 2009, 1311 of a random
sample of 1900 eighth-graders from Houston performed at
or above the basic level in mathematics . In 2011, 1440 of a
random sample of 2000 eighth-graders from Houston
performed at or above the basic level . (The study reports
the proportions).
(A ) Is there an increase in the proportion of eighth-graders
who performed at or above the basic level in mathematics
from 2009 to 2011 at the 5% significance level?
(B) Compute the 95% confidence interval for the difference in
proportion of eighth- graders who performed at or above
the basic level in mathematics from 2009 to 2011.