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]]
Hi: One answer comes from the pwr.r.test() function in package pwr (read its code to see how it calculates power): pwr.r.test(n = 100, r = 0.2, sig.level = 0.05, alternative = 'two.sided') approximate correlation power calculation (arctangh transformation) n = 100 r = 0.2 sig.level = 0.05 power = 0.5142056 alternative = two.sided If you're looking for the power function, that's another matter entirely :) HTH, Dennis On Mon, Oct 18, 2010 at 11:48 PM, Jumlong Vongprasert < jumlong.ubru@gmail.com> wrote:> 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]] > > ______________________________________________ > 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]]
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 greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Jumlong Vongprasert > Sent: Tuesday, October 19, 2010 12:49 AM > To: r-help at r-project.org > 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]] > > ______________________________________________ > 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.