R/pcorhc4.R

pcorhc4 <-
function(x,y,alpha=.05,CN=FALSE){
#
#   Compute a .95 confidence interval for Pearson's correlation coefficient.
#   using the HC4 method
#
# CN=F, degrees of freedom are n-p; seems better for general use.
# CN=T  degrees of freedom are infinite, as done by Cribari-Neto (2004)
#
xy<-elimna(cbind(x,y))
x<-xy[,1]
y<-xy[,2]
z1=(x-mean(x))/sqrt(var(x))
z2=(y-mean(y))/sqrt(var(y))
ans=olshc4(z1,z2,alpha=alpha,CN=CN)
list(r=cor(x,y),ci=ans$ci[2,3:4],p.value=ans$ci[2,5])
}
musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.