meyerjp@jmu.edu
2004-Sep-23 21:27 UTC
[Rd] noncentrality paramter in power.anova.test (PR#7244)
Full_Name: Version: 1.9.0 OS: Windows XP Submission from: (NULL) (134.126.93.191) I believe the noncentrality parameter, lambda, in power.anova.test is incorrect. The noncentrality paramter is defined as lambda <- (groups - 1) * n * (between.var/within.var). The n should not be there. The function pf defines the noncentrality parameter as the sum of squares of the means. Therefore, the noncentrality paramter, lambda, in power.anova.test should be lambda <- (groups - 1) * (between.var/within.var). The following code shows the difference in results. I've compared a few power computations using the new lambda to values from a text on power. The new lambda produces more correct values for power. groups <- 3 n <- 5 between.var <- 10.295 within.var <- 1 sig.level <- 0.05 #The first, incorrect lambda is used in power.anova.test #incorrect labmda lambda <- (groups - 1) * n * (between.var/within.var) pf(qf(sig.level, groups - 1, (n - 1) * groups, lower = FALSE), groups - 1, (n - 1) * groups, lambda, lower = FALSE) #This correct lambda should be used instead lambda <- (groups - 1) * (between.var/within.var) pf(qf(sig.level, groups - 1, (n - 1) * groups, lower = FALSE), groups - 1, (n - 1) * groups, lambda, lower = FALSE)
Peter Dalgaard
2004-Sep-23 22:05 UTC
[Rd] noncentrality paramter in power.anova.test (PR#7244)
meyerjp@jmu.edu writes:> Full_Name: > Version: 1.9.0 > OS: Windows XP > Submission from: (NULL) (134.126.93.191) > > > I believe the noncentrality parameter, lambda, in power.anova.test is incorrect. > The noncentrality paramter is defined as lambda <- (groups - 1) * n * > (between.var/within.var). The n should not be there. The function pf defines the > noncentrality parameter as the sum of squares of the means. Therefore, the > noncentrality paramter, lambda, in power.anova.test should be lambda <- (groups > - 1) * (between.var/within.var). The following code shows the difference in > results. I've compared a few power computations using the new lambda to values > from a text on power. The new lambda produces more correct values for power.Correct by which measure? Surely not by consistency with power.t.test in the groups==2 case! I think you're forgetting that there is a scale factor of n needed to make the variance of the sample means comparable to the sample variance. The means referred to in the definition of ncp for pf are only indirectly related to the actual group means.> groups <- 3 > n <- 5 > between.var <- 10.295 > within.var <- 1 > sig.level <- 0.05 > > > #The first, incorrect lambda is used in power.anova.test > #incorrect labmda > lambda <- (groups - 1) * n * (between.var/within.var) > pf(qf(sig.level, groups - 1, (n - 1) * groups, lower = FALSE), > groups - 1, (n - 1) * groups, lambda, lower = FALSE) > > #This correct lambda should be used instead > lambda <- (groups - 1) * (between.var/within.var) > pf(qf(sig.level, groups - 1, (n - 1) * groups, lower = FALSE), > groups - 1, (n - 1) * groups, lambda, lower = FALSE) > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
Apparently Analagous Threads
- solve cdf for noncentrality (PR#11527)
- Noncentral t & F distributions
- Sometimes having problems finding a minimum using optim(), optimize(), and nlm() (while searching for noncentral F parameters)
- Memory Allocation in R and S-Plus: And functions from R to S-Plus
- anova power calculations