Dear Sir or Madam,
What is the formula for power.t.test(delta=delta, sd=segma, sig.level=0.05, power=0.8, type="one.sample", alternative="one.sided")$n?
See the code of power.t.test by just typing the name of that function into the console:
power.t.test
and you'll easily see that the code collapses in your case to:
tsample <- 1 tside <- 1 p.body <- quote({ nu <- (n - 1) * tsample pt(qt(sig.level/tside, nu, lower = FALSE), nu, ncp = sqrt(n/tsample) * delta/sd, lower = FALSE) }) n <- uniroot(function(n) eval(p.body) - power, c(2, 1e+07))$root
Uwe Ligges
Thank you very much for the help!
Best,
Xiaorong
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html