#GOF for midterm scores with 73 data points x=c(10,20,30,40,50,60,70,80,90) # 10 intervals' cut point z=(x-35.93)/27.33 z Fz=pnorm(z) Fz a<-c(Fz[-1],1) a p<-c(Fz[1],a-Fz) E=73*p E O=c(11, 16, 6,11,5,7,7,4,3,3) x2=sum((O-E)^2/E) x2 df=length(E)-1-2 # why -2? 2 unknown par.'s......... df alpha=0.05 qchisq(1-alpha,df) # chisquare table using R x2 > qchisq(.95,df) # Is "Ho: score is normally distributed" rejected at level 0.05? x2 > qchisq(.9,df) # Is "Ho: score is normally distributed" rejected at level 0.1? #E[9]<5, E[10]<5 may combine two cells e=c(E[1:8],E[9]+E[10]) e o=c(O[1:8],O[9]+O[10]) o xx2=sum((o-e)^2/e) dfx=length(e)-1-2 # why -2? you know........ xx2 > qchisq(.95,dfx) # Is "Ho: score is normally distributed" rejected at level 0.05? xx2 > qchisq(.9,dfx) # Is "Ho: score is normally distributed" rejected at level 0.05? # #### R's OUTPUT with above commands #### # > #GOF for midterm scores with 73 data points > > x=c(10,20,30,40,50,60,70,80,90) # 10 intervals' cut point > z=(x-35.93)/27.33 > z [1] -0.9487742 -0.5828760 -0.2169777 0.1489206 0.5148189 0.8807172 [7] 1.2466154 1.6125137 1.9784120 > Fz=pnorm(z) > Fz [1] 0.1713677 0.2799884 0.4141129 0.5591919 0.6966602 0.8107645 0.8937307 [8] 0.9465749 0.9760589 > a<-c(Fz[-1],1) > a [1] 0.2799884 0.4141129 0.5591919 0.6966602 0.8107645 0.8937307 0.9465749 [8] 0.9760589 1.0000000 > p<-c(Fz[1],a-Fz) > E=73*p > E [1] 12.509844 7.929310 9.791086 10.590766 10.035189 8.329616 6.056532 [8] 3.857624 2.152330 1.747702 > O=c(11, 16, 6,11,5,7,7,4,3,3) > x2=sum((O-E)^2/E) > x2 [1] 14.00259 > df=length(E)-1-2 # why -2? 2 unknown par.'s......... > df [1] 7 > alpha=0.05 > qchisq(1-alpha,df) # chisquare table using R [1] 14.06714 > x2 > qchisq(.95,df) # Is "Ho: score is normally distributed" rejected at level 0.05? [1] FALSE > x2 > qchisq(.9,df) # Is "Ho: score is normally distributed" rejected at level 0.1? [1] TRUE > > #E[9]<5, E[10]<5 may combine two cells > e=c(E[1:8],E[9]+E[10]) > e [1] 12.509844 7.929310 9.791086 10.590766 10.035189 8.329616 6.056532 [8] 3.857624 3.900032 > o=c(O[1:8],O[9]+O[10]) > o [1] 11 16 6 11 5 7 7 4 6 > xx2=sum((o-e)^2/e) # why -2? you know........ > dfx=length(e)-1-2 > xx2 > qchisq(.95,dfx) # Is "Ho: score is normally distributed" rejected at level 0.05? [1] TRUE > xx2 > qchisq(.9,dfx) # Is "Ho: score is normally distributed" rejected at level 0.05? [1] TRUE >