问题
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
回答1:
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)
来源:https://stackoverflow.com/questions/19506180/polychoric-correlation-matrix-with-significance-in-r