Typing either
round(binom.test(78, 100, 0.75)$p.value, 2)or
1 - pbinom(77, 100, 0.75) + pbinom(75-3, 100, 0.75)returns 0.56 as a p-value.
f <- c(25,50,25) fhat <- c(35,43,22) lnL <- sum(fhat*log(fhat/f)) G <- 2*lnL round(1-pchisq(G,2),3)yields a p-value of 0.084.
round(1-pchisq(sum((f-fhat)^2/f),2),3)or
chisq.test(c(35,43,22),p=c(0.25,0.5,0.25))yields a p-value of 0.069.
[ Main page | 4th term syllabus | R for Windows ] | Last modified: Tue Mar 28 17:52:38 EST 2006 |