I am a newbie, so my question is probably basic. I'm trying to use cor.ci
for to obtain polychoric correlations with significance tests. I came across this code but I've been struggling all day to apply it to my data:
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)
My question is, where do I place my variables? I have a total of 13 variables in my dataset and I'd like to produce a correlation matrix for all of them. I'd be grateful if someone could walk me through the process. Thanks!
========
UPDATES:
Following suggestions, I used the code below - which now contains reference to mydata in place of sim.poly - but it did not work:
install.packages("Hmisc")
library(Hmisc)
mydata <- spss.get("S-IAT for R.sav", use.value.labels=TRUE)
install.packages('psych')
library(psych)
poly.example <- cor.ci(mydata(nvar = 10,n = 100)$items,n.iter = 10,poly = TRUE)
poly.example
print(corr.test(poly.example$rho), short=FALSE)
Here is the error message it gives:
library(psych)
poly.example <- cor.ci(mydata(nvar = 10,n = 100)$items,n.iter = 10,poly = TRUE)
Error in cor.ci(mydata(nvar = 10, n = 100)$items, n.iter = 10, poly = TRUE) :
could not find function "mydata"
poly.example
Error: object 'poly.example' not found
print(corr.test(poly.example$rho), short=FALSE) Error in is.data.frame(x) : object 'poly.example' not found
How can I make it recognize mydata and/or select certain variables from my dataset for the analysis? Thanks!