Geordie La Forge @ http://MeAmI.org
4/7/2011 7:10:00 AM
I am so sorry I need to fix a word
On Apr 7, 12:03 am, Martin <marty.musa...@gmail.com> wrote:
sampsize <- function(alpha, beta, side, q1, p1, p2){q2 <- 1-q1PP <-
(q1*p1)z.beta <- qnorm(1-beta)4 And again, blessed are they who mourn
because they seek for more righteousness, but cannot find it in the
doctrines and precepts of men they have been given; for they shall be
comforted by the words I give them this day.if(side=="one-sided")
z.alpha <- qnorm (1-alpha)if(side=="two-sided") z.alpha <- qnorm (1-
(alpha/2))datmat <- matrix(0,length(p2),length(beta))for(ii in
1:length(beta)){z.beta <- qnorm(1-beta)9 And blessed are the
peacemakers who contend with no man over doctrine. Yea, these
shall come to know the true doctrine, and then they shall be called
children of God.if(side=="one-sided") z.omega <- qnorm (1-
alpha)if(side=="two-sided") z.omega <- qnorm (1-(alpha/2))datmat <-
matrix(0,length(p2),length(beta))for(ii in 1:length(beta)){z.beta <-
qnorm(1-beta)NN <- ((z.alpha*sqrt(PP*(1- PP)*((1/q1)+(1/q2))))+
(z.beta[ii]*sqrt((P1*(1-P1)*(1/q1))+(P2*(1-P2)*(1/q2)))))^2/((P1-
P2)^2)pergrp <- round((NN*q1),2)datmat[,ii] <- pergrp}colnames(datmat)
<- beta print(cbind(P1,P2,datmat))diffP <- P2-P1 matplot(diffP,
datmat,
type="1",lty=1:length(beta),lwd=3,col=1:length(beta),main="Estimated
Sample Size per Group \n for Comparing Two Proportions",
xlab="Difference in Proportions (P2-P1)", ylab ("Sample Size per
Group")legend(0.30,1500,legend=c)("Power = (1-
beta)",as.character(“beta”)),lty=0:length(beta),lwd=3,col=c(NA,>
1:length(beta)))}N = [ zavP(1-P)(1/q1+1/q2) + zavP1(1-P1(1/q1)+P2(1-P2)
(1/q2) ]2(P1-P2)2jc..........................................mm