Constraining path loading to values of a latent

5 replies [Last post]
CharlesD's picture
Offline
Joined: 04/30/2013

I would like to constrain the loading between two variables to the values of a 3rd, where that 3rd is generated by additional structures. I guess I need a way to reference the estimated latent directly, but as it stands I seem to be only able to reference it's parameters.

I've been mainly generating the model with mxPath rather than mxMatrix, but this can change as needed...

Cheers for any suggestions!

mhunter's picture
Offline
Joined: 07/31/2009
Path equal to the result of an algebra?

I think what you might want is to set a path coefficient to be the result of other parameters your model.

The code snippet below sets the value of the path from "oneVariable" to "anotherVariable" to sqrt(load1*load2).

mxModel(name="Path equal to the result of an algebra",
    # other things in the model
    # ....
    mxPath(
        from="F1",
        to=c("x1", "x2"),
        arrows=1,
        values=.8,
        labels=c("load1", "load2")
    ),
    mxAlgebra(name="algExample", expression=sqrt(load1*load2))
    mxPath(
        from="oneVariable",
        to="anotherVariable",
        free=FALSE,
        labels="algExample[1,1]")
)

Alternatively, you might want to have the value of the latent variable itself involved in some kind of equation. For example, you might have latent variables F, G, and H. You may want equations such that

H = b * G
G = a * F

These equations map onto a path structure like

F -> G -> H

with the path coefficient from F to G being "a", and that from G to H being "b". These are the actual equations that make the name structural equation modeling appropriate.

Were either of these proposals what you were getting at?

Ryne's picture
Offline
Joined: 07/31/2009
This is tougher to answer

This is tougher to answer without a specific model, but I'll give you a general answer.

So it sounds like you have x predicting y, x is latent and y is manifest. You want the value of this loading (regression) to be the value of some variable z. If z is in your dataset, just label the path "data.z" and you're done!

Without knowing what your "additional structures" are, its hard to solve your specific problem. I presume you'll do some sort of algebra on z to generate these structures, in which case you might do something like this:

mxMatrix("Full", 1, 1, labels="data.z", name="Z")
mxAlgebra(2*Z, name="A")
mxPath(from="x", to="y", labels="A[1,1]")

You'll make a matrix and label its sole element "data.z", then you can use this matrix ("Z") in algebras. You can constrain paths or matrix elements to be equal to the result of an algebra using "square bracket substitution". In the code above, the path from x to y is constrained to the result of A, specifically whatever is in the first row and first column of A (even though A reduces to a 1 x 1 matrix, you still have to put the brackets and references in").

Hope this helps, and let us know what else you need!
ryne

CharlesD's picture
Offline
Joined: 04/30/2013
hopefully more clarity!

Sorry for the lack of clarity -

I have 3 latents and 2 path loadings: Alatent---loadingpath--->Blatent---loadingpath--->Clatent
I want loadingpath = loadingpath - this is fine.
I want to (or think I want to) estimate both a mean and variance for loadingpath. The variance is where I am struggling, and where I thought I might be able to constrain loadingpath to a latent estimated from:

ONE---loadingmeanpath--->LOADINGlatent<--loadingvar-->

So instead of data.z being user provided, I want it to be latent. I can't see how to label the latent, only paths to and from it...
Does this make any sense? :) and if so how might I do it?

neale's picture
Offline
Joined: 07/31/2009
Latent variable as definition variable

If I understand you correctly (it is still not very clear to me) then you want to moderate the value of a path with the value of a latent variable. That latent variable value is of course unknown, but we do know things about its distribution.

This kind of model is not explicitly implemented in OpenMx at this time. It is a complicated method which can be implemented using a mixture distribution and (Gaussian) quadrature weights.

CharlesD's picture
Offline
Joined: 04/30/2013
That's it.

That's correct. Sorry for my poor explanation / terminology! Thanks for explaining Neale.