You are here

Constraining Thresholds

5 posts / 0 new
Last post
rabil's picture
Offline
Joined: 01/14/2010 - 16:47
Constraining Thresholds

I wrote a simple OpenMx script to do LCA on ordinal variables. It works fine on simulated data. When I run it on real data, the estimated thresholds are not in order. I then included constraints on the thresholds (simple enough to do) so that they are monotonically increasing. This seems to work as the threshold estimates monotonically increase. From reading the manual, I was sure constraints weren't necessary.

Ryne's picture
Offline
Joined: 07/31/2009 - 15:12
This is a bug that we're

This is a bug that we're working on. There is a check in the backend that is supposed to make sure the thresholds are in order. I wrote a test script recently that put the thresholds out of order in the course of optimization, which did not fail the check and returned the incorrectly ordered thresholds. In a future version, we'll enforce the constraint more explicitly. For now, constraints or the classic Mx "thresholds deviations" trick will work. Sorry about the bug.

Can you tell me more about the script? I could only get the thresholds out of order if I had a vastly underused category and ran unsafe=TRUE, and even that only got them to cross by 10e-4.

rabil's picture
Offline
Joined: 01/14/2010 - 16:47
I'm not sure how much the

I'm not sure how much the code will help, but I've attached it. Unfortunately, I can't upload the ordinal data. Without the constraints, I was getting wildly out of order thresholds. Adding the constraints prevents this and also seems to make the code run faster, but maybe it's just my imagination. (I've run this code with more real ordinal variables and without the contraints I have the same problem with the thresholds.)

I'm not sure when the bug was introduced. When I run my simulated data, I don't see any problems with the threshold order. I've been pulling my hair out for a week trying to get this code to work on real data.

Ryne's picture
Offline
Joined: 07/31/2009 - 15:12
I'll take a look at this. Can

I'll take a look at this. Can you tell me:
-which thresholds lead to the offense (run the code with unsafe=TRUE)
-if you have any categories (especially in the offending variables) that are underused? I know you can't share the data, but can you give us at least part of the summary() results for whatever variables have the lowest frequency counts for a single category?
-what error message are you getting when the thresholds get out of order?

rabil's picture
Offline
Joined: 01/14/2010 - 16:47
Sorry, I've been tied up with

Sorry, I've been tied up with other projects. If memory serves, the unordered thresholds tended to happen for the the variables with more thresholds. In the last full run, I had 9 variables (7 ordinal) and one had 7 categories, and one had 6. These were where the unordered thresholds would appear.

This is no longer a problem for me. Adding the constraints did the trick.