Displaying 1 result from an estimated 1 matches for "ntotal1".
Did you mean:
ntotal
2001 Dec 09
1
Help for Power analysis
...y data value of the first two line
x1 <- c(6,9)
x2 <- c(6,6)
nc <-cbind(x1)
nr <-rbind(x2)
data1 <- 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[...