multivariate ordinal example and question

2 replies [Last post]
tbates's picture
Online
Joined: 07/31/2009

hi,
Trying to get a multivariate ordinal ACE script going with different numbers of thresholds in each variable.

The script is running now, and attached below (self contained: pulls data from a url).

it gives the error

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)

I am not sure what we are supposed to be doing in threshold matrices with cells that are not expected to be used: I have just left them determined to be greater than the preceeding thresholds, and hoping htey don't mind not being used. But are they supposed to be set NA?

tbates's picture
Online
Joined: 07/31/2009
attachment was not attached

attachment was not attached :-)

AttachmentSize
multivariate.ordinal.ACE_.R 5.41 KB
neale's picture
Offline
Joined: 07/31/2009
It doesn't make code Red go

It doesn't make code Red go away (though it might have) but I notice Full matrices where Lower was expected, so seem to be able to use:

mxMatrix("Lower", nVar, nVar, free=T, values=rnorm(nVar*(nVar+1)/2, mean = .6, sd = .1), name="a"),
mxMatrix("Lower", nVar, nVar, free=T, values=rnorm(nVar*(nVar+1)/2, mean = .6, sd = .1), name="c"),
mxMatrix("Lower", nVar, nVar, free=T, values=rnorm(nVar*(nVar+1)/2, mean = .6, sd = .1), name="e"),

Running several times yields almost exactly the same fit and same error. However, dialing down precision helps:

> est1<-ACEOrdFit@output$estimate
> ACEOrdModel <- mxOption(ACEOrdModel, "Function Precision", 1e-8)
> ACEOrdFit = mxRun(ACEOrdModel, intervals=F)

Running ACE
> summary(ACEOrdFit)

And does not seem to change the solution a whole lot:

> ACEOrdFit@output$estimate

-0.3839011110 -0.0926679446 0.1203437405 0.5555043707 0.5160617608 -0.1834054992 0.8827464781 0.8112786187

0.8133510994 -0.0638410734 0.0099016854 0.0020701259 -0.2708858073 -0.0022325128 -0.0431975228 0.1434395464

-0.0059582264 -0.1483921050 0.9737269653 0.5000000000 0.5000000000 0.5000000000 0.0831593193 0.6315923555

0.5000000000 0.5000000000 0.0001055547 0.4444466554 0.3557393401 0.5369744499
> est1<-ACEOrdFit@output$estimate
> ACEOrdModel <- mxOption(ACEOrdModel, "Function Precision", 1e-9)
> ACEOrdFit = mxRun(ACEOrdModel, intervals=F)
Running ACE
Warning message:
In model 'ACE' NPSOL 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)
> ACEOrdFit@output$estimate-est1

1.719295e-02 6.996527e-03 3.251360e-02 -9.884858e-04 5.319398e-03 2.996002e-01 6.320578e-03 -1.730106e-03

3.323140e-03 1.595764e-01 -3.278419e-02 -3.226108e-03 -3.130417e-03 1.486215e-03 -8.030822e-04 2.227999e-04

-1.344185e-04 6.018336e-04 -9.379388e-04 0.000000e+00 0.000000e+00 0.000000e+00 -3.853347e-05 -3.186464e-05

0.000000e+00 0.000000e+00 -5.554708e-06 2.171607e-04 -3.820562e-05 -6.856539e-04

The .16 looks like a problem, but it's a diagonal element which is invariant to sign so .09 and -.06 are not that far apart.

Two things then:
i) Make lower as above
ii) Try bounding the diagonals of a, c and e to be positive

and a note: We should stop printing Std Errs when there are constraints in the model, until we fix the issue. They're rubbish.