| dfM1<-24 # degrees of freedom of M1 |
| dfM2<-27 # degrees of freedom of M2 |
| delta<-dfM2*.05ˆ2 # define delta in the alternative hypothesis |
| alpha<-.05 |
| cv<-qchisq(1-alpha,df=dfM2-dfM1) # Critical value under the null hypothesis |
| for (n in 1:100000) { |
| power<-1-pchisq(cv,df=dfM2-dfM1,ncp=n*delta) |
| if (power>=.80) break # reach the desirable power |
| } |
| N<-n+1 |
| print(N) |