You are here

how to make fit model?

5 posts / 0 new
Last post
siti nur azizah's picture
Joined: 03/12/2014 - 13:01
how to make fit model?

I want to ask about optimalization my SEM model. i confused how to set a starting value for each variable? i send my code but in result, i get still NaN in the standar estimation.
in my result, RMSEA still more than 0.08 and the CFI still less than 0.9. so, what should i do?

RobK's picture
Joined: 04/19/2011 - 21:00
The starting values for each

The starting values for each free parameter are the numbers you provide to the values argument in each mxPath() statement. For example, in your first mxPath(), you provide a start value of 0.5 for each of those two-headed path coefficients. (BTW, you could just use values=0.5 instead, and R will automatically expand it to that vector of 0.5s).

As you said in your post, you are seeing standard errors of NaN for some, but not all, of the free parameters. The most likely reason for this is that the optimizer has not found a minimum of the deviance (-2loglikelihood) function. There are several things you could do about this. The simplest is probably to re-run your model from the initial solution. After you run twoFactorFitskripsi<- mxRun(FactorModelskripsi), then run twoFactorFitskripsi<- mxRun(twoFactorFitskripsi), and see if you still get standard errors of NaN. Another thing you could do is go back and change the start values in your model; you could set each start value to be closer to its resulting value from your fitted model (i.e., the values you see in the summary() output).

You can be pretty sure that the optimizer has found the minimum if there are no standard errors of NaN, the -2 log likelihood in the output is smaller than it is now, and you can run your model without getting any warnings.

Regarding the absolute fit indices you mentioned (RMSEA and CFI), you will want to wait until it looks like the deviance is at the minimum before you try to interpret them. Beyond that, you might want to consider a suggestion M. Hunter made in another one of your threads, which is to run several different alternative models and compare how well they fit. Since I don't know anything about your data or your research questions, I can't really be more specific than that.

tbates's picture
Joined: 07/31/2009 - 14:25
Hard to get SEs when fit is poor

Rob's explanation is clear and helpful: because mxRun returns a model, you can run it multiple times, and sometimes see an improvement in fit. It's also the case that if your starting values are too far from the well-fitting values, then picking some new starts might be helpful.

In this case it seems likely that the poor RMSEA is telling you this model doesn't adequately capture your data: You need to modify it, adding some paths somewhere.

You'll find it much easier to read and maintain your models if you code more like this:

 yVars = c("y1","y2","y3","y4","y5","y6","y7","y8","y9","y10","y11","y12","y13","y14","y15","y16","y17","y18","y19","y20","y21","y22","y23","y24")
    xVars = ("x1","x2","x3","x4","x5","x6","x7")
    allVars = c(yVars, xVars)
    mxPath(from = allVars, arrows = 2, free = TRUE, values= .5, labels = paste0("e", 1:length(allVars) )

than this:

        from=c ("y1","y2","y3","y4","y5","y6","y7","y8","y9","y10","y11","y12","y13","y14","y15","y16","y17","y18","y19","y20","y21","y22","y23","y24","x1","x2","x3","x4","x5","x6","x7"),
            values=c (.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5,.5),
            labels=c ("e1","e2","e3","e4","e5","e6","e7","e8","e9","e10","e11","e12","e13","e14","e15","e16","e17","e18","e19","e20","e21","e22","e23","e24","e25","e26","e27","e28","e29","e30","e31")
siti nur azizah's picture
Joined: 03/12/2014 - 13:01
thank you for your answer, i

thank you for your answer, i try to change starting value, and then the result no observation is NaN. but my problem still same, criteria of fit model is not good (look from RSMEA, P Value, CFI). history in the SEM, we can't add path if we don't know historical in early model. is there any other way to make the criteria of RSMEA, CFI etc be better apart from adding path?

neale's picture
Joined: 07/31/2009 - 15:14
Under-identified model?

It's difficult to tell without seeing the code, but I suspect that you are trying to estimate factor variances AND all factor loadings to the indicators. An easy solution is to fix the factor variances to 1.0

If the model is under identified, you will get NaN's for at least some of the Standard Errors. The solution reported may be one of thousands that would fit equally well (and different starting values may find different, equally good, solutions).