You are here

estimated parameters: 0

11 posts / 0 new
Last post
karobro's picture
Offline
Joined: 01/16/2013 - 10:41
estimated parameters: 0
AttachmentSize
Binary Data Sat_3var_5groups.R6.93 KB

Hi,
I am trying the Beta version to run a multivariate saturated model with ordinal data. However, I am getting no estimated parameters. Could I be missing something in the script (attached)? Any help is greatly appreciated.

Here is the output message:

> SatFit<- mxRun(SatModel, intervals=F)
Running Sat
> summary(SatFit)
Summary of Sat

observed statistics: 7099
estimated parameters: 0
degrees of freedom: 7099
-2 log likelihood: NA
number of observations: 1394
Information Criteria:
| df Penalty | Parameters Penalty | Sample-Size Adjusted
AIC: NA NA NA
BIC: NA NA NA
Some of your fit indices are missing.
To get them, fit saturated and independence models, and include them with
summary(yourModel, SaturatedLikelihood=..., IndependenceLikelihood=...).
timestamp: 2014-08-22 13:59:41
wall clock time: 0.390008 secs
OpenMx version number: 2.0.0.3751

mhunter's picture
Offline
Joined: 07/31/2009 - 15:26
Add top level fitfunction

I think the top level model does not have a fit function, and that's what's causing the estimated parameters to be zero.

Replace

SatModel     <- mxModel( "Sat", modelMZM, modelMZF, modelDZM, modelDZF, modelDZO)

with

mgfitfunction <- mxFitFunctionMultigroup(c("MZM", "MZF", "DZM", "DZF", "DZO"))
SatModel    <- mxModel( "Sat", modelMZM, modelMZF, modelDZM, modelDZF, modelDZO, mgfitfunction)

Hopefully that makes it work!

karobro's picture
Offline
Joined: 01/16/2013 - 10:41
1.#QNAN0 ()

Thank you very much! I tried this and now get an error message that I don't know what means:

> SatFit<- mxRun(SatModel, intervals=F)
Running Sat
Error: The job for model 'Sat' exited abnormally with the error message: MxComputeGradientDescent: fitfunction Sat.fitfunction evaluated to 1.#QNAN0 ()

In addition: Warning message:
In model 'Sat' Optimizer returned a non-zero status code 6. The model does not satisfy the first-order optimality conditions to the required accuracy, and no improved point for the merit function could be found during the final linesearch (Mx status RED)

> summary(SatFit)
Error in summary(SatFit) :
error in evaluating the argument 'object' in selecting a method for function 'summary': Error: object 'SatFit' not found

RobK's picture
Offline
Joined: 04/19/2011 - 21:00
Adjust start values

The first error you're seeing is saying that the fit function for the top-level model returned a value of NaN (Not a Number). This probably happened on its first evaluation, at the start values, since CSOLNP and NPSOL can both deal with NaN once optimization has gotten underway. But, if it happens at the very start, they don't know what to do next, and terminate prematurely.

It's a bit peculiar that you got the warning about "Mx status RED," but you can ignore it for now, since the real problem is that your model won't run.

The last error you got is just R saying it cannot find an object called SatFit. This is because SatFit was never created; the line that would have created it, SatFit<- mxRun(SatModel, intervals=F), led to an error.

You should change the start values for your CorMZM and CorMZF, because those matrices are not positive definite at the values you're currently using. You can see this with, for example, eigen(CorMZM$values)$values, which should all be positive, but that's not the case. You could try lowering the biggest off-diagonal values. Also, it looks like you're starting all of your thresholds at positive numbers. That might be suitable for your data, but it might also be something you'd want to adjust.

BTW, are you running this on a Windows machine?

karobro's picture
Offline
Joined: 01/16/2013 - 10:41
Problem solved

Excellent...Thanks so much guys! Changing the starting values for the covariance matrices of the MZ groups did the trick.

Yes, I'm running this on a Windows machine.

RobK's picture
Offline
Joined: 04/19/2011 - 21:00
Re: Windows

I thought so. For some reason, under Windows, the end of that error message gets garbled to 1.#QNAN0 ().

jpritikin's picture
Offline
Joined: 05/24/2012 - 00:35
consistent stringification of special non-finite numbers

It would be really helpful if OpenMx stringified non-finite numbers consistently across platforms.

AdminHunter's picture
Offline
Joined: 03/01/2013 - 11:03
Agree

I completely agree.

RobK's picture
Offline
Joined: 04/19/2011 - 21:00
Yes

Indeed. There is a model in the test suite that spuriously throws an error on my system because omxCheckError() detects a mismatch due to the way NaN gets printed.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
things todo about fitfunction evaluated to NAN or INF

DeJa Vu, we discussed this this morning :-) This might be a good place to collect that knowledge.

From Mike "the matrix" Neale: "This message is usually caused by parameter values that lead to a likelihood of zero. A non-positive definite covariance matrix (check eigenvalues of the expected covariance matrix) or data vectors that are far from the mean, in standardized units. It may help to bound parameters, or to improve the starting values."

You can sometimes get a model to mxRun with unsafe = TRUE, that can either let it find a good solution - perhaps after another couple of runs - or at least give you something more to work with.

# Explore values of the matrices and algebras driving the expectation
m1 = mxRun(m1 unsafe = T) # unsafe on to get you going
m1 = mxRun(m1) # second run, unsafe off
summary(m1)

omxSetParameters is useful for moving start values, and free/fixing parameters. For instance

m1 = omxSetParameters(m1, "a_r2c1", free=T, values = 0); # drop this parameter to zero
m1 = omxSetParameters(m1, "a[2,1]", free=T, values = .3); # bracket notation if cells are not labeled
m1 = mxRun(m1, unsafe=T)

Setting checkpointing can generate a file of free-parameter estimates that might be useful if you want to see what happened before the condition arose.

 mxOption(factorModel, "Checkpoint Directory", getwd())
    mxOption(model, "Always Checkpoint", "Yes")
    mxOption(model, "Checkpoint Count" , 1)
    mxOption(model, "Checkpoint Units" , "evaluations")   

For the future, having OpenMx should give a message at least this helpful, hopefully taking into account whether this problem happened on the first iteration to help shape this error message.

karobro's picture
Offline
Joined: 01/16/2013 - 10:41
see below

see below