[R] how to determine power in my analysis?

Rolf Turner r.turner at auckland.ac.nz
Sun Nov 9 02:15:11 CET 2014


To chip in with my (possibly not-too-well-informed) opinion:

What your current study gives you is a handle on the *variability* that 
data gathered in a future study will have.  You need to have an estimate 
of this variability in order to calculate power.

To design a future study you need to:

(1) Decide what effect size you are interested in; i.e. what effect size 
is of *practical* significance.  Call this effect size, say, e_0.

(2) Choose the significance level at which you wish to test your 
hypothesis.  (Probably 0.05).

(3) Choose what power you wish to achieve.  (E.g. the value 0.80 is 
often used.)

(4) Determine an estimate of the variability in the data which you will 
collect.  (This is where your current study comes in.)

(5) Do some more-or-less intricate calculations (depending on the nature 
of the study) to produce a study design such that if the true
effect size is at least e_0 then a test conducted at the 0.05 
significance level will have a probability of at least 0.80 of rejecting 
the null hypothesis.

In real life it is usually the case that the sample sizes required to
achieve the specified power at the specified effect size are far larger 
than what your budget will stretch to.

That's one of the (many) reasons why so much crap research is
produced! :-)

cheers,

Rolf Turner

On 09/11/14 11:56, Kristi Glover wrote:
> Dear Dennis, I really appreciated for your and Bert's help. I read
> thepaper and it seems that once the study is completed, power calculations
> do not inform us in any way as to the conclusions of the present study.
> But I am really now confused whether we can't improve the research
> design for future or next year monitoring based on the present results.
> I would really be grateful for your suggestions and insights. Can't we
> take reference from the present study for improving future
> sampling?Thanks KG
>> Date: Sat, 8 Nov 2014 13:36:35 -0800
>> Subject: Re: [R] how to determine power in my analysis?
>> From: djmuser at gmail.com
>> To: kristi.glover at hotmail.com
>> CC: gunter.berton at gene.com; r-help at stat.math.ethz.ch
>>
>> Hi Kristi:
>>
>> I think this paper elucidates the problem Bert mentioned. A thorough
>> and careful reading of the last two sections should clarify what
>> post-hoc power is and is not.
>>
>> http://www.stat.uiowa.edu/files/stat/techrep/tr378.pdf
>>
>> Dennis
>>
>> On Sat, Nov 8, 2014 at 11:25 AM, Kristi Glover
>> <kristi.glover at hotmail.com> wrote:
>>> Hi Bert, Thanks for the message. So far I know we can test whether my sample size in my analysis is enough or not. It is also post hoc property. For example, we can calculate standard deviations, error variance  etc in the data sets, and then we can use them to determine whether the sample size was enough or not with certain level of alpha and power. we can do it is some of the statistical programs, but I was not aware in R. thanks KG
>>>
>>>> Date: Sat, 8 Nov 2014 10:55:56 -0800
>>>> Subject: Re: [R] how to determine power in my analysis?
>>>> From: gunter.berton at gene.com
>>>> To: kristi.glover at hotmail.com
>>>> CC: r-help at stat.math.ethz.ch
>>>>
>>>> Kristi:
>>>>
>>>> Power is a prespecified property of the design, not a post hoc
>>>> property of the analysis (SAS procedures notwithstanding). So you're a
>>>> day late and a dollar short.
>>>>
>>>> I suggest you consult with a local statistician about such matters, as
>>>> you appear to be out of your depth.
>>>>
>>>> Cheers,
>>>> Bert
>>>>
>>>> Bert Gunter
>>>> Genentech Nonclinical Biostatistics
>>>> (650) 467-7374
>>>>
>>>> "Data is not information. Information is not knowledge. And knowledge
>>>> is certainly not wisdom."
>>>> Clifford Stoll
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Nov 8, 2014 at 3:49 AM, Kristi Glover <kristi.glover at hotmail.com> wrote:
>>>>> Hi R Users,
>>>>> I was trying to determine whether I have enough samples and power in my analysis. Would you mind to provide some hints?.  I found a several packages for power analysis but did not find any example data. I have two sites and each site has 4 groups. I wanted to test whether there was an effect of restoration activities and sites on the observed value. I used a two way factorial ANOVA and now I wanted to test the power of the analysis (whether the sample sizes are enough for the analysis? what are the alpha and power in the analysis using this data set? if it is not enough, how much samples should be collected for alpha 0.05 and power=0.8 and 0.9 for the analysis (two way factorial analysis).
>>>>> The example data:data<-structure(list(observedValue = c(0.08, 0.53, 0.14, 0.66, 0.37, 0.88, 0.84, 0.46, 0.3, 0.61, 0.75, 0.82, 0.67, 0.37, 0.95, 0.73, 0.74, 0.69, 0.06, 0.97, 0.97, 0.07, 0.75, 0.68, 0.53, 0.72, 0.34, 0.12, 0.49, 0.77, 0.45, 0.07, 0.97, 0.34, 0.68, 0.48, 0.65, 0.7, 0.57, 0.66, 0.4, 0.29, 0.88, 0.36, 0.68, 0.32, 0.8, 0, 0.11, 0.48, 0.85, 0.94, 0.12, 0.12, 0, 0.89, 0.66, 0.2, 0.57, 0.09, 0.27, 0.81, 0.53, 0.09, 0.5, 0.41, 0.89, 0.47, 0.39, 0.85, 0.71, 0.89, 0.01, 0.71, 0.42, 0.72, 0.62, 0.3, 0.56, 0.99, 0.97, 0.03, 0.09, 0.27, 0.27, 0.94, 0.23, 0.97, 0.81, 0.95), condition = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("g!
>   ood!
>>>   ", "!
>>>>>   medium", "poor", "verygood"), class = "factor"), areas = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Restored", "unrestored"), class = "factor")), .Names = c("observedValue", "condition", "areas"), class = "data.frame", row.names = c(NA, -90L))
>>>>> test= aov(observedValue~condition*areas,data=data)summary(test)
>>>>> power of the analysis?
>>>>> thanks for your help.
>>>>> Sincerely, KG
>>>>>
>>>>>          [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> R-help at 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.
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at 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.
>   		 	   		
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>


-- 
Rolf Turner
Technical Editor ANZJS



More information about the R-help mailing list