[R] polycor package
yrosseel
yrosseel at gmail.com
Sun Nov 18 17:27:36 CET 2012
> The reason I was working with a correlation matrix is because I wanted
> to calculate polychoric correlations first before submitting it to the
> actual sem command. I was unsure whether R would use polychoric
> correlations when indicating which of the variables are ordered. A final
> question on the sample.cov=hetcor command. Does this not assume it is a
> sample variance-covariance rather than a correlation matrix (as
> calculated using the polycor package)?
Yes. Sample.cov should always be a covariance matrix, not a correlation
matrix. It is pretty useless for categorical data.
> I also tried using the command (thanks for the tip!)
>
> sem.cdu= sem(cdu, data=germany2009, ordered=c("cdupid", "MERKELLIKE",
> "CDULIKE", "MERKELPROX", "CDUPROX"))
>
> but I always get the error result:
>
> semcdu=sem(cdu, data=germany2009, ordered=c("cdupid", "MERKELLIKE",
> "CDULIKE", "MERKELPROX", "CDUPROX"), fixed.x=F)
> Error in tmp[cbind(REP$row[idx], REP$col[idx])] <- partable$free[idx] :
> NAs are not allowed in subscripted assignments
It looks like you have some issues with your model specification. Could
you remove all '~~' statements and try again?
If the problem remains, please send me your R script, and a snippet of
the data (just enough to replicate the error).
Yves.
More information about the R-help
mailing list