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])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.