# 1 ?chisq.test chi.res<-chisq.test(x=c(10, 25, 18, 6), p=rep(1/4,4)) # Chi-squared test for given probabilities # # data: c(10, 25, 18, 6) # X-squared = 14.559, df = 3, p-value = 0.002235 chi.res$observed-chi.res$expected # [1] -4.75 10.25 3.25 -8.75 chi.res$stdres # [1] -1.4281275 3.0817487 0.9771398 -2.6307611 #2 chisq.test(c(125, 60, 50, 12), p=c(9/16, 3/16,3/16, 1/16)) # Chi-squared test for given probabilities # # data: c(125, 60, 50, 12) # X-squared = 6.5025, df = 3, p-value = 0.08956 #3 exp.p<-c(1200, 200, 650, 200) chisq.test(c(41, 5, 30, 2), p=exp.p/sum(exp.p)) # Chi-squared test for given probabilities # # data: c(41, 5, 30, 2) # X-squared = 6.5322, df = 3, p-value = 0.0884 #4 pchisq(5.04, df=3, lower.tail = F) # [1] 0.1688915 #5 qchisq(0.05, df=3, lower.tail = F) # [1] 7.814728 qchisq(0.01, df=3, lower.tail = F) # [1] 11.34487 qchisq(0.05, df=8, lower.tail = F) # [1] 15.50731 qchisq(0.01, df=8, lower.tail = F) # [1] 20.09024