help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Confidence-intervall for correlation?


From: stn
Subject: Re: Confidence-intervall for correlation?
Date: Sat, 22 Oct 2011 20:42:51 +0200



2011/10/19 Muhali <address@hidden>

I don't think it is a vague request. Correlation coefficient estimates have a well known approximative distribution via the Fisher transform, see here e.g. A Matlab implementation is here.

The confidence interval is a very important diagnostic that should be part of octave (easy to implement).

Hi,

correct, the confidence-interval I was referring to is the one calculated with the fisher-transformation.

For now I have written my own function.

Later I found a script in the link you find further down. There the t-distribution is used.
Every other source uses the normal distribution.

Not sure which one is correct.


see here for script: http://saswiki.org/images/9/92/4.KSFE-2000-rohlmann-Konfidenzintervalle-f%C3%BCr-Raten-und-Korrelationskoeffizienten-zwei-SAS-Macros.pdf


This is what I did:
# korr_int( r , n , alpha )
# F() and Finv() are the fisher-transformation and -retransformation

function F    = F(r)      ; F    = log( (1+r)/(1-r)  ) / 2 ; end
function Finv = Finv(z)   ; Finv = ( ( exp(2*z) - 1 ) / ( exp(2*z) + 1 ) ) ; end
function [lb ub] = korr_int(r , n , alpha)
  # fisher-transform of r
  Z      = F(r) ;
  # width of the the confidence-interval for Z
  DZ     = norminv(1-((1-alpha)/2));
  DZ     = DZ / sqrt(n-3);
  # calculate lower and upper bound of interval, retransform to original distribution
  lb     = Z - DZ  ; lb = Finv(lb) ;
  ub     = Z + DZ  ; ub = Finv(ub) ;
end


stn


reply via email to

[Prev in Thread] Current Thread [Next in Thread]