I generally use simulation to calculate power:

library(MASS)

out1 <- replicate(10000, 
 {tmp <- mvrnorm(100, mu=c(0,0), Sigma=matrix( c(1,.2,.2,1), 2 ) );
  cor.test( tmp[,1], tmp[,2] )$p.value } )

mean( out1 <= 0.05 )



-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[email protected]
801.408.8111


> -----Original Message-----
> From: [email protected] [mailto:r-help-boun...@r-
> project.org] On Behalf Of Jumlong Vongprasert
> Sent: Tuesday, October 19, 2010 12:49 AM
> To: [email protected]
> Subject: [R] calculate power of test
> 
> Dear All
>     I want to calculate power of test. I want to test H0: Rho = 0 VS
> H1: Rho
> != 0.
>     Assume, I have r=0.2 and sample size = 100.
>     How I can do this.
> Many Thanks
> Jumlong
> 
> --
> Jumlong Vongprasert Assist, Prof.
> Institute of Research and Development
> Ubon Ratchathani Rajabhat University
> Ubon Ratchathani
> THAILAND
> 34000
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> [email protected] 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.

______________________________________________
[email protected] 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.

Reply via email to