Polychoric correlation matrix with significance in R

£可爱£侵袭症+ 提交于 2019-11-29 15:28:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!