<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FAQ/fishrpow</title><revhistory><revision><revnumber>5</revnumber><date>2013-03-08 10:17:23</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>4</revnumber><date>2008-02-28 16:42:20</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>3</revnumber><date>2008-02-28 16:35:51</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>2</revnumber><date>2008-02-28 16:35:08</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>1</revnumber><date>2008-02-28 16:33:50</date><authorinitials>PeterWatson</authorinitials></revision></revhistory></articleinfo><section><title>Comparing correlations form two separate samples using fisher's transformation in R</title><para>Copy and paste the below into R. </para><screen><![CDATA[fn <- function(r1,r2,n1,n2,alpha) {
]]><![CDATA[
a <- abs((1+r1)/(1-r1))
b <- abs((1+r2)/(1-r2))
a <- 0.5*log(a)
b <- 0.5*log(b)
c <- 1/(n1-3)
d <- 1/(n2-3)
chisq <- abs((a-b)/sqrt(c+d))
]]><![CDATA[
pow <- 1 - pchisq(abs(qchisq(1-alpha,1)),1,chisq*chisq)
cat("Power for Fisher's test is")
print(pow)
 }]]></screen><para>Input the (two-tailed) type one error, alpha, correlations, r1 and r2, and sample sizes, n1 and n2 as below into R. </para><screen><![CDATA[alpha <- 0.05
r1 <- 0.7
r2 <- 0.8
n1 <- 67
n2 <- 10000]]></screen><para>then copy and paste, or type in, the below to obtain the power. </para><screen><![CDATA[fn(r1,r2,n1,n2,alpha)]]></screen></section></article>