Skip to content

R packages for power analysis

3 messages · varin sacha, David Winsemius, Greg Snow

#
Dear all,

I do know very well the pwr packages from St?phane Champely.?
I would have known if somebody knows others packages for power analysis ??
I think here more about the calculation of the power analysis of the nonparametric tests like the mann whitney or the kruskall wallis.

Best Regards,

Sacha
#
On Aug 28, 2014, at 12:29 PM, varin sacha wrote:

            
The Hmisc/rms package combo has some power oriented functions and I have a vague memory that Harrell has suggested that some of them can be configured to give powpr analysis for M-W. Search the Archives.
David Winsemius
Alameda, CA, USA
#
While there are tools that claim to compute power for tests beyond
what you find in the pwr package, I don't like to use them because
either I don't agree with the assumptions that they make, or I don't
know what assumptions are being made (and therefore I don't know
whether I agree with them or not).  Once you are beyond the basics
there are a lot more assumptions/conditions to think about.  A tool
that you can just plug a few values into will need to make some
assumptions for you.  To do a proper power analysis without having the
assumptions made for us you need a tool that is more a programming
language than a plug-and-chug toy.  Luckily R is such a programming
language.  You can compute power using simulation with just the main R
packages.  Here is some sample code for a simulation to compute power
for the Mann-Whitney (also called the Wilcoxon) test:

simfun <- function(n1=25, n2=n1, mu1=5, mu2=mu1) {
x1 <- rexp(n1, 1/mu1)
x2 <- rexp(n2, 1/mu2)
wilcox.test(x1,x2)$p.value
}

out <- replicate(10000, simfun(mu1=5,mu2=8))
hist(out)
abline(v=0.05,col='red')
mean(out <= 0.05)

Change the means/sample sizes/etc. and rerun for additional information.
On Thu, Aug 28, 2014 at 1:29 PM, varin sacha <varinsacha at yahoo.fr> wrote: