Dear useRs
I need to compute studentized confidence intervals for a correlation,
using the boot library.

For this CIs we need to compute a variance estimate of the statistic
(here correlation coeff) from each boostrap sample. There are 2
important points, I think:
(1) We need to do a fisher transformation (atanh(x)) to correct for
non-normality, this can be done easily be specifying h, hinv, and hdot
parameteres in the boot.ci call.
(2) an estimate for the variance is (as far as I remember)
1-correlation2)2/n (For fisher transformed data, an estimator is: 1/(n-3))

do you think, this is the correct way:

library(boot)
fisher <- function(r) 0.5*log((1+r)/(1-r))
fisher.dot <- function(r) 1/(1-r2)
fisher.inv <- function(z) (exp(2*z)-1)/(exp(2*z)+1)

boot.fun <- function(data, i) {
  n <- length(i)
  correlation <- cor(data[i,1],data[i,2])
  v <- (1-correlation2)2/n
  c(correlation, v)
}

td.boot <- boot(td, boot.fun, R=9999)
boot.ci(td.boot, h = fisher, hdot = fisher.dot,
        hinv = fisher.inv, conf = c(0.95))

?. many thanks for your thoughts

cheers
christoph






-- 
Weitersagen: GMX DSL-Flatrates mit Tempo-Garantie!
Ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to