Power calculations in R
My first huge disappointment with R. My boss wanted me to do simple power calculations to see how adding 2 animals to one of groups will improve statistical power. Yeah, I know, you are not supposed to do “retrospective power calculations”. Tell it to people providing lab animals, they always give you couple more just in case something happened to one or two you have. So, sometimes we have to do just that. Well, not in R.
There is this nice and simple power.t.test function, with
n= for number of subjects in a group
delta = for difference between groups
sd= for standard deviation
sig.level= for desired alpha
power= for power, obviously
All you need to do is to define all but one and the remaining is calculated. Great, but how about if your groups are of unequal sizes? There is always Google? Not this time.
There is nice package pwr, if you happen to work on proportions and can use beauty of binomial distribution. That’s it.
Solution? I opened SAS and did what I needed in 1 min.
Proc power works like power.t.test, but you can do calculations with different sd’s in groups, different group sizes and different experimental design. Wonder, when R catches up…
Technorati Tags: power calculations, power.t.test, pwr, Proc power