Thu, 02/02/2012 - 16:25

Hi all,

I ran a relatively simple path analytic model with four manifest variables, three causal paths, and one unanalyzed relationship. The model has 2 df. I used the code below but got the following error message:

"In model 'Apgar Model 2' NPSOL returned a non-zero status code 1. The final iterate satisfies the optimality conditions to the accuracy requested, 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). "

Any idea what the problem could be? Does it simply mean that the model didn't converge?

Thanks -- M

data_apgar <- read.spss("data_apgar.sav", to.data.frame = T)

manifests <- c ("apgar", "gestat", "smokes", "wgtgain")

apgar_model2 <- mxModel ("Apgar Model 2",

type="RAM",

manifestVars = manifests,

mxPath(from="smokes", to="gestat", values=.1, label="b"),

mxPath(from="wgtgain", to="apgar", values=.1, label="e"),

mxPath(from="gestat", to="apgar", values=.1, label="f"),

mxPath(from="smokes", to="wgtgain", arrows=2, values=.5, label="a"),

mxPath(from=manifests, arrows=2, free=TRUE, values=1, labels=c("da","dg","vars","varw")),

mxCI(c("a", "b", "e", "f", "vars", "varw", "dg", "da")),

mxPath(from="one", to=manifests, arrows=1, free=TRUE, values=1),

mxData(data_apgar, type="raw")

)

apgar2out <- mxRun(apgar_model2, intervals=TRUE)

summary(apgar2out)

Attachment | Size |
---|---|

data_apgar.sav | 1.43 KB |

search for green on this site: it is almost never a problem, but there are good explanations of what it reflects, and what it means are here....

I am not sure I understand your answer. What do you mean by "search for green on this site"? I did go through the entire forum "OpenMx Error Messages" before posting my question, but there was no thread to "status code 1".

--M

As Tim said, there are explanations around. In a recent thread, I discussed the meaning of optimality (first derivatives of the likelihood function are zero) and convergence (expected step size is zero). Status 1 means that the likelihood function is at what looks like a minimum, but the optimizer was expecting to take a step. This usually happens when the optimizer happens to hit the right answer a lot quicker than it expects to. You can always rerun with different starting values, but you should be pretty confident that everything ran fine.

Hi,

thank you for your reply. I checked and you are right. I get the same estimates than with AMOS. The model seemed to have run fine.

One reason I thought there was a problem is that OpenMx didn't give me any fit indices. I looked at numerous threads on the OpenMx forums. Back in 2010, someone that it is necessary to explicitly compute these indices (maybe with a script similar to the one I posted below). Is this still the case? Will "sumary(mymodel)" not give me any fit indices?

Thanks, -- M

fit.index <- function(indepfit,modelfit) {

indep <- summary(indepfit)

indep.chi <- indep$Chi

indep.df <- indep$degreesOfFreedom

model <- summary(modelfit)

model.chi <- model$Chi

model.df <- model$degreesOfFreedom

model.ml <- as.numeric(modelfit$objective@result)

N <- model$numObs # sample size

N.est.param <- model$estimatedParameters # t

N.manifest <- length(modelfit@manifestVars) # n

observed.cov <- modelfit@data@observed # S

estimate.cov <- modelfit@matrices$S@values[1:N.manifest,1:N.manifest] # C, W

observed.cor <- cov2cor(observed.cov)

estimate.cor <- cov2cor(estimate.cov)

residual.cov <- observed.cov-estimate.cov

residual.cor <- observed.cor-estimate.cor

F0 <- (model.chi-model.df)/N

if (F0<0) { F0 <- 0 }

NFI <- (indep.chi-model.chi)/indep.chi

NNFI <- (indep.chi-indep.df/model.df*model.chi)/(indep.chi-indep.df)

PNFI <- (model.df/indep.df)*NFI

IFI <- (indep.chi-model.chi)/(indep.chi-model.df)

CFI <- 1.0-(model.chi-model.df)/(indep.chi-indep.df)

RMSEA<- sqrt(F0/model.df) # need confidence intervals

MFI <- exp(-0.5*(model.chi-model.df)/N)

GFI <- sum(estimate.cov*estimate.cov)/sum(observed.cov*observed.cov) # definitely not right!

AGFI <- 1.0 - (1.0-GFI)/(1.0-N.est.param/N)

PGFI <- (1.0-N.est.param/N)*GFI

AIC <- model.chi-2*model.df

AIC2 <- model.chi+2*N.est.param

CAIC <- model.chi-(log(N)+1.0)*model.df

CAIC2<- model.chi+(log(N)+1.0)*N.est.param

BIC <- model.chi-log(N)*model.df

BIC2 <- model.chi+log(N)*N.est.param

RMR <- sqrt(2.0*sum((residual.cov*residual.cov)/(N.est.param*(N.est.param+1))))

SRMR <- sqrt(2.0*sum((residual.cor*residual.cor)/(N.est.param*(N.est.param+1)))) # not right!

indices <- rbind(NFI,NNFI,PNFI,IFI,CFI,RMSEA,MFI,GFI,AGFI,PGFI,AIC,AIC2,CAIC,CAIC2,BIC,BIC2,RMR,SRMR)

return(indices)