Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polychoric correlation matrix with significance in R

I have been desperately looking for a way to compute a polychoric correlation matrix, with significance in R. If that is very hard then polychoric correlation between two variables with significance would be sufficient.

What I have tried so far:

library(polychor)
poly <- polychor(var1,var2)
poly <- polychor(DatM) #where DatM is a DF converted to matrix

library(polycor)
hetcor(Dat2) #I am however uncertain hetcor is something I would want if I am looking for polychoric correlation.

library(psych)
polychoric(Dat$for2a,smooth=TRUE,global=TRUE,polycor=FALSE, ML = FALSE, std.err=TRUE)

None of these give significance. I have read that the Permutation test [could give me significance][1] for the corr=0 hypothesis for each correlation pair. The packages coin and lmPerm do allow one to compute the Permutation test. However, I am unsure how.

thanks in advance, Helgi

like image 858
Helgi Guðmundsson Avatar asked Oct 21 '13 22:10

Helgi Guðmundsson


1 Answers

Sorry for the late reply.

cor.ci may be what you want, as you can specify poly = TRUE. Bill also recently altered cor.plot so that it scales the text size with the correlation significance, but you may have to install the latest psych package from our server:

install.packages('psych', type = 'source', repos = 'http://personality-project.org/r/')

Here is a brief example:

library(psych)
poly.example <- cor.ci(sim.poly(nvar = 10,n = 100)$items,n.iter = 10,poly = TRUE)
poly.example
print(corr.test(poly.example$rho), short=FALSE)  
like image 67
Jason French Avatar answered Nov 08 '22 19:11

Jason French