faulty warning message?

Hermine's picture
Project:OpenMx
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Warning message:
The job for model 'ccc' exited abnormally with the error message: Objective function returned a value of NaN at iteration 0.1.

The attached file is an RData file (but saved as .sav to upload)
However, the objective function looks fine in the fitted model object and summary.
estimated parameters: 0 (all parameters were intentially fixed to starting values)
degrees of freedom: 2266
-2 log likelihood: 2885.098

> mxEval(MZf.objective,cccFit)
         [,1]
[1,] 754.0471
> mxEval(MZm.objective,cccFit)
        [,1]
[1,] 719.298
> mxEval(DZm.objective,cccFit)
         [,1]
[1,] 355.4492
> mxEval(DZf.objective,cccFit)
         [,1]
[1,] 251.3265
> mxEval(DZo.objective,cccFit)
         [,1]
[1,] 804.9774

AttachmentSize
cccModel.sav7.36 KB

Comments

mhunter's picture

#1

When I load the workspace, there is no cccFit object. Evaluating the cccModel object yields NA.

mxEval(objective, cccModel, compute=TRUE)

Similarly for each of the submodels objectives.

> mxEval(MZf.objective, cccModel, compute=TRUE)
     [,1]
[1,]   NA
> mxEval(DZf.objective, cccModel, compute=TRUE)
     [,1]
[1,]   NA
> mxEval(MZm.objective, cccModel, compute=TRUE)
     [,1]
[1,]   NA
> mxEval(DZm.objective, cccModel, compute=TRUE)
     [,1]
[1,]   NA
> mxEval(DZo.objective, cccModel, compute=TRUE)
     [,1]
[1,]   NA

cccFit could be left over from a different model run where the objective was well not NA.

neale's picture

#2

Ah yes, I think one is supposed to do this:

cccFit <- mxRun(cccModel, unsafe=T)

in order to generate the error code and to make the mxEval's work.

mhunter's picture

#3

I haven't been able to figure out much about this issue. I do know that it is not a faulty warning message, rather it is a faulty error.

Making some changes only leads to more mysteries. The m2LL algebra seems to compute okay, and the model runs fine without an objective function.

dddModel <- mxModel("Container",
	cccModel[["MZf"]],
	cccModel[["MZm"]],
	cccModel[["DZm"]],
	cccModel[["DZf"]],
	cccModel[["DZo"]],
	mxAlgebra(MZf.objective + MZm.objective + DZm.objective + DZf.objective + DZo.objective, name="m2LL")
)
dddRun <- mxRun(dddModel)
dddRun$m2LL@result

Moreover, replacing the algebra with a simpler one and using an algebra objective gives the same error as before.

eeeModel <- mxModel("Container",
	cccModel[["MZf"]],
	cccModel[["MZm"]],
	cccModel[["DZm"]],
	cccModel[["DZf"]],
	cccModel[["DZo"]],
	mxAlgebra(DZf.objective, name="m2LL"),
	mxAlgebraObjective("m2LL")
)
eeeRun <- mxRun(eeeModel)

Could this be a corner case of badness for the algebra objective when there are submodels, an algebra objective, and no free parameters? Do the same errors persist when there is a free parameter?

Not with this example:

testMZf <- cccModel[["MZf"]]
testMZf$af@free[1,1] <- TRUE
testDZf <- cccModel[["DZf"]]
testDZf$af@free[1,1] <- TRUE
testDZo <- cccModel[["DZo"]]
testDZo$af@free[1,1] <- TRUE
fffModel <- mxModel("Container",
	testMZf,
	cccModel[["MZm"]],
	cccModel[["DZm"]],
	testDZf,
	testDZo,
	mxAlgebra(MZf.objective + MZm.objective + DZm.objective + DZf.objective + DZo.objective, name="m2LL"),
	mxAlgebraObjective("m2LL")
)
fffRun <- mxRun(fffModel) #give warning
fffRun$m2LL@result

Thoughts?

jpritikin's picture

#4

I bet this is fixed in SVN trunk. Can somebody test it again?

If it's still broken, can we have an R script to reproduce the problem? Thanks.

mhunter's picture

#5

Status:active» closed

Current thought is this was related to

http://openmx.psyc.virginia.edu/thread/3871

where setting independent=TRUE fixed the problem. The code in the linked thread runs fine unmodified in the r3750 Beta, so I'm closing this.