Re: [R] Power Analysis

From: David Cross <d.cross_at_tcu.edu>
Date: Mon, 18 Apr 2011 17:23:05 -0500

It seems to me, with deltas this large (relative to the SD), that a significance test is a moot point!

David Cross
d.cross_at_tcu.edu
www.davidcross.us

On Apr 18, 2011, at 5:14 PM, Albyn Jones wrote:

> First, note that you are doing two separate power calculations,
> one with n=2 and sd = 1.19, the other with n=3 and sd = 4.35.
> I will assume this was on purpose. Now...
>

>> power.t.test(n = 2, delta = 13.5, sd = 1.19, sig.level = 0.05)

>
> Two-sample t test power calculation
>
> n = 2
> delta = 13.5
> sd = 1.19
> sig.level = 0.05
> power = 0.9982097
> alternative = two.sided
>
> Now, with n=2, the power is already .99. With n=1, there are zero df.
> So, what n corresponds to a power of .8?
>
>> power.t.test(n = 1.6305, delta = 13.5, sd = 1.19, sig.level = 0.05)

>
> Two-sample t test power calculation
>
> n = 1.6305
> delta = 13.5
> sd = 1.19
> sig.level = 0.05
> power = 0.8003734
> alternative = two.sided
>
> It looks like 1.63 subjects will do the job :-)
>
> Finally, look at the power.t.test function, there is a line that explains
> your error message:
>
> else if (is.null(n))
> n <- uniroot(function(n) eval(p.body) - power, c(2, 1e+07))$root
>
> power.t.test() is making the sensible assumption that we only care about
> sample sizes of at least n = 2....
>
> albyn
>
> On Mon, Apr 18, 2011 at 02:31:19PM -0700, Schatzi wrote:
>> I am trying to do a power analysis to get the number of replicas per
>> treatment.
>> 
>> If I try to get the power it works just fine:
>> setn=c(2,3)
>> sdx=c(1.19,4.35)
>> power.t.test(n = setn, delta = 13.5, sd = sdx, sig.level = 0.05,power =
>> NULL)
>> 
>> If I go the other way to obtain the "n" I have problems.
>> sdx=c(1.19,4.35)
>> pow=c(.8,.8)
>> power.t.test(n = NULL, delta = 13.5, sd = sdx, sig.level = 0.05, power =
>> 0.8)
>> 
>> Is there any way to do this? Thank you.
>> 
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Power-Analysis-tp3458786p3458786.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> 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.
>> 

>
> --
> Albyn Jones
> Reed College
> jones_at_reed.edu
>
> ______________________________________________
> 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.


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. Received on Mon 18 Apr 2011 - 22:25:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Apr 2011 - 23:50:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive