# obtain power
power <- array(numeric(nr*np), dim=c(nr,np))
for (i in 1:np){
  for (j in 1:nr){
    result <- pwr.t.test(n = r[j], d = p[i],
    sig.level = .05, power = NULL,
    alternative = "two.sided")
    power[j,i] <- ceiling(result$power)
  }
}

First problem. Why are you calling ceiling, which will return 1 for any value of a power? What were you thinking that line was doing?


Ah, after visiting the link you posted, I see why. Ceiling makes sense when computing sample sizes, since you can't sample fractions of units, but not here. Just get rid of that ceiling call wrapping the results, and see if it does what you want.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to