# Definition Variables in Constraints and Confidence Intervals

5 posts / 0 new
Offline
Joined: 01/14/2010 - 16:47
Definition Variables in Constraints and Confidence Intervals

I'm trying to build a simple auto-lagged model for some simulated data. The observations are simple ar(1) with 6 observations per subject and where the time points are irregular within and between subjecs. Eid in the Daily Life handbook (pp. 398-402) shows how to do this in MPlus.

The model works fine with equally spaced time points - I can get back the ar(1) value used in the simulation.

To handle unequal spacing, I'm using definition variables. The trick is to constrain the ar loadings. Suppose you have (a simple path diagram):

x1 --> x2 --> x3 --> x4 --> x5 --> x6

The loading for the path from 1 to 2 has parameter p1, from 2 to 3, p2 etc. The lag length for the paths are the differences between the time points (i.e., lag2_1 = t2 - t1, lag3_2 = t3 - t2, where t1 is the first time point, etc.). You constrain as follows:

p1 = beta^(lag2_1)
p2 = beta^(lag3_2)
p3 = beta^(lag4_3)

and so on. I implemented this with mxConstraint's and mxAlgebra's. I get no error messages and no warnings but the results are not right - at least the estimate of beta is not near to the ar(1) used in the simulation. In my simulation with irregular spacing, the average difference between t2 and t1 is about 2 units (about the same fro t3 and t2, etc.). If I take the estimated p1, p2, etc, and square root them (i.e., raise to the power of 1 over the average lag which is approximately equal to 2), then I seem to get values near to the ar(1) used in the simulation.

I can't get OpenMx to compute the average lags across subjects - it seems to just print the difference betweenlast individual value of the definition variables.

How can I correctly implement this model?

GIven the contraints are nonlinear, is it still possible to get likelihood confidence intervals? The intervals I get have lower bounds higher than the estimate.

Offline
Joined: 01/14/2010 - 16:47
Sub-Models

I'm thinking that the only way to get around the problem of the way definition variables seem to work in mxConstraint, is to have each subject have his/her own sub-model and then link the sub-models together through beta. Although I would have thought that using FIML that the constraint would be evaluated separately for each subject (row).

Offline
Joined: 07/31/2009 - 15:26
If I understand the problem

If I understand the problem correctly, then I think you don't need to use mxConstraint(). Something like the following should work.

mxMatrix(values=0.5, labels="betalab", free=TRUE, nrow=1, ncol=1, name="beta")
mxAlgebra(beta^data.lag2_1, name="p1")
mxAlgebra(beta^data.lag3_2, name="p2")
mxAlgebra(beta^data.lag4_3, name="p3")

The "beta" in each mxAlgebra() is automatically the same because things with the same name are automatically identical in OpenMx. It's possible that the free parameter label could/should be used instead of the name of the 1x1 matrix, or that elementwise powering should be used, but the above should do what you described.

If this is not what you asked, then let us know!

Offline
Joined: 01/14/2010 - 16:47
Thanks. This is exactly what

Thanks. This is exactly what we needed. When I wrote the code, I thought that using mxConstraint was the appropriate way to do constraints. But apparently, it's much better to use mxAlgebra and mxMatrix in the way you indicated.

Offline
Joined: 07/31/2009 - 15:26
Great! Glad to help. The use