You are here

way to refer to parent?

4 posts / 0 new
Last post
tbates's picture
Offline
Joined: 07/31/2009 - 14:25
way to refer to parent?

If you update and change the name of a supermodel, references in submodels now point to the wrong object.

It would be nice if there was a keyword for "parent" or "container", so that instead of this, which needs manual maintenance when the parent name changes.

mxModel("twinACE", 
   mxModel("MZ", mxData(mzfData, type="raw"), 
                    mxFIMLObjective("twinACE.expCovMZ", "twinACE.expMeanMZ")),

This would work:

mxModel("twinAE", 
   mxModel("MZ", mxData(mzfData, type="raw"), 
                   mxFIMLObjective("parent.expCovMZ", "parent.expMeanMZ")),

I guess an alternative coding system would be to say

superName = "twinAE";
mxModel(superName,
   mxModel("MZ", mxData(mzfData, type="raw"), 
   mxFIMLObjective(paste (superName, ".expCovMZ"), paste (superName, ".expMeanMZ")),

Makes code longer and harder to read though

Any pointers on how to handle this?

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Hi Tim, Take a look at the

Hi Tim,

Take a look at the UnivariateTwinAnalysis_PathRaw demo. While it uses the path-style, which I think is not the approach you're looking for, the demo does a good job of pushing most of the matrices into the submodels, and the super-model contains only an algebra objective that joins the two models. I think this is the preferred style, and it will solve the particular issue you are having. When I get a chance, I will rewrite UnivariateTwinAnalysis_MatrixRaw so that more entities go in the submodels. As to your larger question, there was a consensus at a developer's meeting that relative addressing was not desired. The danger of relative addressing is that it no longer becomes applicable once the structure of the sub-model tree is modified.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
hi mike, Thanks for the

hi mike,
Thanks for the work-around.

Team: I think that the potential of a relative address becoming out of date has to be weighed against the certainty of absolute addresses becoming out of date.

Powerful language is certainly a bit dangerous, but nouns for "self", "parent" and "child" are common in computer languages.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
hi mike, I've been trying to

hi mike,
I've been trying to rewrite the script to push matrices into the groups/submodels.

Here is a shortish script pasted online:

http://pastie.textmate.org/private/eybxstrqz1exweaywbva

It simulates three correlated variables for MZ and DZ twins, then just does trivariate ACE Cholesky...

The top version pushes matrices and algebra into MZ and DZ submodels.

The bottom code does it the original way with algebra in the supermodel (which gave correct results, I believe)

The two sets of results are not the same, even df differs... Any pointers as to where I am mucking up in some assumption or other?