iteration in one factor model not converge

9 replies [Last post]
iram's picture
Offline
Joined: 09/28/2012

i have four observed vaiables and fit one factor model on these four observed variable.when i am try to fit one factor model on my data which consist of ordered categorical variable with fiv ecategories. when r code run the whole programme warning message appear that "NPSOL is returned a non zero status code 1.The final iterate satisfies the optimality conditions to the accuracy requesed but the sequence of iterates has not yet converged. NPSOL was terminated because no further improvement could be made in the merit function (Mx status GREEN). "

what it mean please give help

iram

AttachmentSize
F3.r3.32 KB
iram's picture
Offline
Joined: 09/28/2012
Generate var-cov matrix of model

hi everyone

thank a lot of you people for making me a member of SEM discussion community. your responses help me to share more problems regarding my research problem . today i faced a problem of generating varience covarience matrix of my model which produced during the model fitting process.i want generate it. please help me in this regard.
i hereby uploaded my r model script with data file

AttachmentSize
ICT_data1.sav 8.3 KB
Ryne's picture
Offline
Joined: 07/31/2009
Status 1s are fine most of

Status 1s are fine most of the time. The confusion is based on the fact that OpenMx and the optimizer that underlies it (NPSOL) use two different criteria to assess convergence. I'll make this fairly basic as a service to all users, and I apologize if it is beneath your level. I think I've answered this question before, and I believe there's some discussion of status codes on the wiki, so I'll take this opportunity to explain the codes at a deeper level.

So the optimizer takes your starting values, wiggles each one a little bit in every direction and finds the likelihood of all of these values. These evaluations are called minor iterations, and from them the optimizer detects (a) how the likelihood of the model changes as a function of the parameters (gradient, or the first derivative of the likelihood function), and (b) how fast the likelihood function is changing (hessian, or the second derivative of the likelihood function). The gradient is a vector (one entry for each parameter), and the hessian is a matrix (number of parameters by number of parameters). The optimizer then uses this information to determine where the next guess or major iteration should be. This cycle of major and minor iterations repeats until the model converges, or the optimizer can't make the -2 log likelihood function of the model any lower. When that happens, the model is "at a minimum" and we've hopefully found the maximum likelihood estimates for the model.

NPSOL uses two criteria to determine whether a minimum has been reached. The first one ("optimality conditions") refer to whether or not the current set of parameter values look like a minimum, i.e. that the gradient is (close enough to) zero. The second criteria is step size, which NPSOL is calling convergence. The optimizer has a step size parameter that is uses to determine how big a jump to make between major iterations. After every major iteration, NPSOL reduces the value of that parameter based on the gradient and hessian so that the optimization slowly approaches the real value.

Status 0 means that both criteria are met, which is great.

Status 6 means that neither were met, which is bad. The solution seems incorrect by the gradient, and the optimizer thinks it should take a step (i.e., step size parameter is still pretty big), but the combination of the gradient and hessian says to take a step in a conflicting, illogical or impossible dimension (i.e., solution is in front of you, jump forward -1 feet to reach it).

Status 1 (which you got) means that the first was met, but not the second. The solution looks right, but NPSOL got there much faster than it expected, so the optimizer is "worried" that you got caught on a local rather than global minimum. You're usually OK in these cases, but if you want to be sure, run the model again with different starting values. If you get the same solution, you can be pretty confident that everything is working well. I'd try starting values that are on the other side of the solution. For example, if you initially selected 0.8 as a starting value and the model with the status 1 converged at 0.7, I'd pick something around 0.5-0.6.

Hope this wall of text helps.

iram's picture
Offline
Joined: 09/28/2012
standard error for SEM four factor model are NA

i am working on Sem model with three exogenous and one endogenous variable.first factor which i hypothsize is constructed with three menifest categorical variables with four categories x1, x2, x3. second also by three menifest variables w1, w2, w3, third by four menifest variables z1, z2 ,z3 ,z4. Fouth factor which is endogenous is also constructed by two menifest variables y1 ,y2 .Total i have twelve observed variables and all are ordered categorical. threshold matrix for the ordered categorical variables is 4x12 matrix.when run this model Standard error of this model are NA.

what its meaning and how respecify model so that its gives results of standard error

AttachmentSize
Ordinal SEM.r 8.33 KB
ICT_data1.sav 8.3 KB
neale's picture
Offline
Joined: 07/31/2009
Data emptied

Hi

I took a look at this, and the attempt to use mxFactor() somehow resulted in no data, which in turn makes for a very under identified model, hence no standard errors. If you comment out the lines using mxFactor, and add a value for the 4th threshold for variable x2 (which has 5 levels) then the model runs. However, there are several additional problems. One is that it is specified to estimate means, variances and thresholds. This is not identified. The best solution is to fix the first two thresholds at, e.g., 0 and 1, and then you can estimate means and variances as usual. See Mehta PD, Neale, M.C., Flay BR: Squeezing interval change from ordinal panel data: latent growth curves with ordinal outcomes. Psychol Methods 2004; 9:301-333 for details.

A further problem is that the thresholds are not constrained to be ordered 1 < 2 < 3 etc. This can be achieved by a trick using an algebra such that one estimates the first threshold and then deviations from the previous threshold, and giving these a lower bound of zero.

Finally, the residual errors should be bounded to be non-negative (a simple lbound argument).

Even then, the model appears underidentified. I suspect that this is due to trying to estimate latent factor variances (e.g., varF1, try fixing that to 1) as well as paths from those factors to observed variables. Sorry, I am not going to investigate further - other demands are pressing.

I attach the modified script which at least runs and can be changed to see if it can be identified by some additional parameter constraints.

AttachmentSize
Ordinal SEM.R 8 KB
iram's picture
Offline
Joined: 09/28/2012
Structural model estimates cant find in the analysis

Thank you neale you have solved a much difficult problem i have faced during the analysis of my research problem. the modified r code model works and give analysis of standard errors but its works with the no estimates of the structural model coefficients. i also need to estimate the coefficients of b1, b2 and b3. please try to modify r code with the "TRUE" arguments for the regression coefficients.

AttachmentSize
Ordinal SEM_0.R 8 KB
iram's picture
Offline
Joined: 09/28/2012
How to estimate Structual model coefficients

Hello Neale,
i find you veryhelpful and responsive over my query.your help have great value for me.please spare some time and review model again for the estimates of the structural model coefficients. also how i access that the fit of model is either good or bad what are the method for evaluating fit indices.

i hereby attach a r code and the data file for my model if you have a solution of my problem please give me answer

neale's picture
Offline
Joined: 07/31/2009
Sorry for delay!

Very busy teaching a workshop... I took a look at your model and I must say I really admire your clean R scripting style, it makes it a lot easier to work with.

In the end, optimization failed because the predicted covariance matrix became negative definite, so the log-likelihood became undefined. With path-style model input, it is difficult to get hold of the expected covariance matrix, but it can be done. Checking the eigenvalues after running with mxRun(FourFactor, unsafe=TRUE) showed the problem:

eigen(attr(FourFactorFit@output$algebras$`Four Factor Model Path Specification.objective`,"expCov"))
$values
[1] 45.8860728857 8.2826838585 5.4066628599 5.0125694368 4.2469841505 1.8184688658 1.2007557309 0.7800600382 0.6586014679
[10] 0.5174468151 0.3604171669 -0.0002740988

- the smallest is less than zero. This is unusual in SEM's because the error variance usually overcomes negative definiteness due to "Heywood case" non-positive definiteness of the latent variable covariance structure. One could specify a model which forces the latent variables to have posdef covariance structure. I took a shortcut instead of bounding one or two of the parameters in the model as is, and it runs (slowly). However, there was a code red (NPSOL 6) so we should really re-run with

FourFactorFit2 <- mxRun(FourFactorFit)

AttachmentSize
Ordinal SEM.R 8.05 KB
iram's picture
Offline
Joined: 09/28/2012
thank u so much,problem of negative definitness

Hi Neale
Thanks a lot lot Neale for sparing your valuable time from busy schedule for my problem. your suggesions are very helpful for me because i am beginner in SEM and my concepts about SEM are not so strong and yet very primary but i learn lot from you. The model u modified runs and give the required results, i just want to know either imposing some additional constraints on the model, could it solve the problem of negative definitness. if you have some suggession about this please forward to me i try to impose it on the model so that the negative definitness at least changed into semi positive definiteness.

mdewey's picture
Offline
Joined: 01/21/2011
Well it may not have helped

Well it may not have helped the OP but it certainly helped me.