Hi

Sorry for the rather long message.

I am trying to use the cfa command in the lavaan package to run a CFA however I am unsure over a couple of issues.

I have @25 dichotomous variables, 300 observations and an EFA on a training dataset suggests a 3 factor model.

After defining the model I use the command

fit.dat <- cfa(model.1, data=my.dat, std.lv = T, estimator="WLSMV", ordered=c("var1","var2" and so on for the other 23 variables))

Is it right that I define the variables as ordered (the output returns thresholds suggesting I should). Does the cfa command calculate tetrachoric correlations in the background?

However, output for the command returns two variables with  small negative variances (-0.002) which I think is due to the correlation matrix not being positive definite. Is it reasonable to force these to be zero when defining the model or is this more a sign of problems with the model?

As an alternative is it possible to calculate the tetrachoric correlations using hetcor (which applies smoothing) and then use the smoothed sample correlation as the input to the model, such as

fit.cor <- cfa(model.1, sample.cov=my.hetcor, sample.nobs=300, std.lv = T,estimator="ML", ordered=c("var1","var2" and so on for the other 23 variables)).

This however does not produce thresholds suggesting what I have tried is nonsense but is there a way to do this?

Final question is I have a lot of missing data - listwise deletion leaves 90 subjects. Is there a way to calculate estimates using pairwise deletion (this is another reason why I tried using the correlation matrix as the input).



I have tried the analysis using John Fox's SEM package / command.

I calculate the correlation matrix with smoothing

my.cor<-hetcor(north.dat.sub,use="pairwise.complete.obs")$correlations

This returns the warning indicating that the correlation matrix was adjusted to make it positive definite. However the following sem model does not run, with the error message that the matrix is non-invertible.

mod1<-sem::sem(sem .model.1, S=my.cor, 300)

Should the smoothing not allow it to be inverted?

thanks for help, david


________________________________

The University of Glasgow, charity number SC004401

	[[alternative HTML version deleted]]

