Hi, is there a function in R that computes the mean of two (or more) correlations? (that is doing the z-transformation of the correlations, computing the mean of the z-values and then retransform it to a correlation). Or is there a fisher-table implemented? I have not found anything via help.search() or google so far. thank you!
Hi Martin, Off hand I do not know of a pre-defined function to do it, but the "z-transformation" is just the inverse hyperbolic function, the mean is just the mean, and the back transformation is the hypoerbolic function so... ############ x <- c(.5, .4) tanh(mean(atanh(x))) ############ should do it. Cheers, Josh On Mon, Jul 25, 2011 at 7:11 AM, Martin Batholdy <batholdy at googlemail.com> wrote:> Hi, > > > is there a function in R that computes the mean of two (or more) correlations? > (that is doing the z-transformation of the correlations, computing the mean of the z-values and then retransform it to a correlation). > > Or is there a fisher-table implemented? > > > I have not found anything via help.search() or google so far. > > > thank you! > ______________________________________________ > 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. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles https://joshuawiley.com/
At 15:47 25/07/2011, Joshua Wiley wrote:>Hi Martin, > >Off hand I do not know of a pre-defined function to do it, but the >"z-transformation" is just the inverse hyperbolic function, the mean >is just the mean, and the back transformation is the hypoerbolic >function so... > >############ >x <- c(.5, .4) >tanh(mean(atanh(x))) >############ > >should do it.Assuming the correlations are based on the same sample size as I would have thought one would otherwise have wanted to weight them.>Cheers, > >Josh > >On Mon, Jul 25, 2011 at 7:11 AM, Martin Batholdy ><batholdy at googlemail.com> wrote: > > Hi, > > > > > > is there a function in R that computes the mean of two (or more) > correlations? > > (that is doing the z-transformation of the correlations, > computing the mean of the z-values and then retransform it to a correlation). > > > > Or is there a fisher-table implemented? > > > > > > I have not found anything via help.search() or google so far. > > > > > > thank you! > > ______________________________________________ > > 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. > > > > > >-- >Joshua Wiley >Ph.D. Student, Health Psychology >University of California, Los Angeles >https://joshuawiley.com/Michael Dewey info at aghmed.fsnet.co.uk http://www.aghmed.fsnet.co.uk/home.html
Viechtbauer Wolfgang (STAT)
2011-Jul-26 12:09 UTC
[R] compute the mean of two (or more) correlations
And at that point, one is essentially doing a meta-analysis. For example: library(metafor) ri <- c(.5, .4) ni <- c(40, 25) res <- rma(ri=ri, ni=ni, measure="ZCOR", method="FE") predict(res, transf=transf.ztor, digits=2) pred se ci.lb ci.ub 0.46 NA 0.24 0.64 You also get the CI (in addition to the back-transformed average). Best, Wolfgang -- Wolfgang Viechtbauer Department of Psychiatry and Neuropsychology School for Mental Health and Neuroscience Maastricht University, P.O. Box 616 6200 MD Maastricht, The Netherlands Tel: +31 (43) 368-5248 Fax: +31 (43) 368-8689 Web: http://www.wvbauer.com> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > On Behalf Of Michael Dewey > Sent: Tuesday, July 26, 2011 12:23 > To: Joshua Wiley; Martin Batholdy > Cc: r-help at r-project.org > Subject: Re: [R] compute the mean of two (or more) correlations > > At 15:47 25/07/2011, Joshua Wiley wrote: > >Hi Martin, > > > >Off hand I do not know of a pre-defined function to do it, but the > >"z-transformation" is just the inverse hyperbolic function, the mean > >is just the mean, and the back transformation is the hypoerbolic > >function so... > > > >############ > >x <- c(.5, .4) > >tanh(mean(atanh(x))) > >############ > > > >should do it. > > Assuming the correlations are based on the same sample size as I > would have thought one would otherwise have wanted to weight them. > > > >Cheers, > > > >Josh > > > >On Mon, Jul 25, 2011 at 7:11 AM, Martin Batholdy > ><batholdy at googlemail.com> wrote: > > > Hi, > > > > > > > > > is there a function in R that computes the mean of two (or more) > > correlations? > > > (that is doing the z-transformation of the correlations, > > computing the mean of the z-values and then retransform it to a > correlation). > > > > > > Or is there a fisher-table implemented? > > > > > > > > > I have not found anything via help.search() or google so far. > > > > > > > > > thank you! > > > ______________________________________________ > > > 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. > > > > > > > > > > >-- > >Joshua Wiley > >Ph.D. Student, Health Psychology > >University of California, Los Angeles > >https://joshuawiley.com/ > > Michael Dewey > info at aghmed.fsnet.co.uk > http://www.aghmed.fsnet.co.uk/home.html > > ______________________________________________ > 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.