Skip to content

polycor package

5 messages · Laura Maria Schwirz, John Fox, yrosseel

#
Dear Laura,

As I explained to you when you wrote to me directly, you're not having trouble with the polycor package, since you have AFAICS successfully computed polychoric correlation among your variables. The error is produced when you call sem(), apparently in the lavaan package (though you don't mention that), and you should address your question to the author of that package (or use an appropriate title line in your r-help posting).

Best,
 John

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
	
On Fri, 16 Nov 2012 12:58:03 +0000
Laura Maria Schwirz <schwirzl at tcd.ie> wrote:
#
Dear Laura,

John is correct. The error is produced by the sem() function in the 
lavaan package. The reason is that you did not use proper names for the 
function arguments. The correct call should be:

sem.cdu= sem(cdu, sample.cov=hetcor, sampl.nobs=1861, 
meanstructure=F,fixed.x=F)

But more importantly, using a polychoric correlation as input, and using 
ML estimation will not produce correct standard errors and test 
statistics. A better approach is to use the categorical capabilities of 
lavaan and provide the full data to sem(), indicating which variables 
can be considered as 'ordered'. For example:

sem.cdu= sem(cdu, data=germany2009, ordered=c("cdupid", "MERKELLIKE", 
"CDULIKE", "MERKELPROX", "CDUPROX"))

Here, I assumed all variables can be considered as ordered. If some of 
them should be treated as conintuous/numeric, omit them from the 
ordered= argument.

By default, lavaan will use the WLSMV estimator when ordered variables 
are involved.

Yves.
On 11/16/2012 10:13 PM, John Fox wrote:
1 day later
#
Yes. Sample.cov should always be a covariance matrix, not a correlation 
matrix. It is pretty useless for categorical data.
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.