Re: [R] Power graph for two Proportion

2014-06-17 Thread Jim Lemon
On Tue, 17 Jun 2014 10:30:17 AM suganthiny cumarasamy wrote:
> Dear R mailing listers,
> 
> I am try to find the different power calculation for
> p1=0.2 and p2=0.4 , with significant level=0.05  (one sided test)
> I would like to  have a graph   y -axis as a power and
> x-axis as a sample size .
> 
> I run this command for different value of power. and get the n and 
power
> pwr.2p.test(h=ES.h(0.4,0.2), power = 0.87,
> sig.level=0.05,alternative="greater")
> 
>  Is there is any easy way i can do power graph using the two proportion 
in
> R.
> 
Hi Suga,
I'm not familiar with pwr.2p.test, but if it takes a vector of power values, 
you could do something like this:

# get a vector of sample sizes for different values of power
# it probably won't be this straightforward
powers<-seq(0.5,0.95,by=0.05)
sample_sizes<-pwr.2p.test(h=ES.h(0.4,0.2),power=powers,
 sig.level=0.05,alternative="greater")
plot(sample_sizes,powers)

Jim

__
R-help@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.


Re: [R] Power graph for two Proportion

2014-06-17 Thread Adams, Jean
Suga,

Perhaps something like this ...

library(pwr)
n <- 50:100
power <- pwr.2p.test(h=ES.h(0.4,0.2), n=n, sig.level=0.05,
alternative="greater")$power
plot(n, power)

Jean


On Mon, Jun 16, 2014 at 10:44 AM, Suganthie Jeyaganth 
wrote:

> Dear R mailing listers,
> I am try to find the different power calculation for
>
> p1=0.2 and p2=0.4 , with significant level=0.05  (one sided test)
>
> I would like to  have a graph   y -axis as a power and
>
> x-axis as a sample size .
>
> I run this command for different value of power. and get the n and power
>
> to draw a graph
>
> pwr.2p.test(h=ES.h(0.4,0.2), power = 0.87,
> sig.level=0.05,alternative="greater")
>
>
> Is there is any easy way i can do this in R.
> Thanks
>
>
> Suga
> [[alternative HTML version deleted]]
>
>
> __
> R-help@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@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.