Displaying 1 result from an estimated 1 matches for "chicrit".
Did you mean:
charit
2001 Dec 09
1
Help for Power analysis
...t;- rbind(x1,x2)
chi2<- chisq.test(data1,correct=F)$statistic
Ntotal<-sum(data1)
df<- ncol(nc-1)*nrow(nr-1)
ifelse(df==1,w<- sqrt(chi2/Ntotal), w<-sqrt(chi2/(chi2+Ntotal)))
Ntotal1<-900 #change this if power not enough
alpha <-0.05 #change this for One tailed =0.05
ncp<-0
chicrit<-NULL
power<-NULL
n<-NULL
samplesize<-NULL
for (i in 1:Ntotal1){
ncp[i] <- w^2 * i
chicrit<-qchisq(1-alpha,df)
power[i] <- 1-(pchisq(chicrit , df, ncp[i]))
n[i]<-i
samplesize<-cbind(n, ncp,power) }
samplesize
plot(n,power,type="l",col="red&qu...