Hello,
I am very new with open Mx and I need a little bit of help.
I am doing a bivariate model with the generic scripts of Boulder. I need to know how could I get the confidence intervals for the rg,rc,re.
Thank you everyone in advance.
Hello,
I am very new with open Mx and I need a little bit of help.
I am doing a bivariate model with the generic scripts of Boulder. I need to know how could I get the confidence intervals for the rg,rc,re.
Thank you everyone in advance.
Welcome to OpenMx!! See the examples in the help page for
mxCI
by running?mxCI
. The general idea is to create a CI object for the things on which you want confidence intervals. Then place that CI object in the model you're running. Finally, run the model withmxRun(..., intervals=TRUE)
.Something to keep in mind when doing this: be aware of where the named-entity on which you want a confidence interval lives. In many BG applications you have several models and submodels. So if the MZ model does not have a thing called "rg" then you cannot place the CI for "rg" in the MZ model. Instead you should place the CI where "rg" lives.
Thank you so much for your prompt response.
I think I have the confidence intervals but I don't know how to show it.
this is the model with intervals
Run AE model
modelAE <- mxModel( fitACE, name="twoAEja" )
modelAE <- omxSetParameters( modelAE, labels=labLower("c",nv), free=FALSE, values=0 )
fitAE <- mxRun( modelAE, intervals=T )
mxCompare( fitACE, fitAE )
fitGofs(fitAE)
fitEsts(fitAE)
But using summary or fitAE I can not find the rg re intervals only the value.
Am I doing something wrong?
Ahh. Use
summary(fitAE)
to view the confidence intervals infitAE
.And if you don't see the CIs in
summary()
output, please post your whole script, since something would have gone wrong earlier in it than the few lines you posted.Of course!
Thank you so much!
Simply run summary() on the fitted models that contain CI's, this should show the CI's nicely, e.g.,
The reason you are seeing estimates for rg but not a CI for rg is because this is not being requested.
These are the lines creating the rg, rc, and re estimates.
You need to add mxCi(c("rA", "rC", "rE")) to your model.
As (Dr Kirkpatrick notes below), this model contains a constraint, however, so this next tip won't work, but in general, a very handy tool for estimates is the
mxSE
function. To use this, one would simply call the following in R:This function is new for OpenMx 2.7 and lets you get SE-based confidence intervals on computed parameters, like the algebra computing rg.
edited to say "rA" not "corA" (not used to the 1-line at a time method of assembling models), and to refer people to Dr Kirkpatrick's reply on MxConstraints
Thank you,
I have used the function "mxSE("corA", model)" but it is the message:
Treating first argument as character named entity in the model
Error in if (model@output$infoDefinite) { :
missing value where TRUE/FALSE needed
What should I do?
mxSE()
requires that the post-mxRun()
model have a valid Hessian matrix. Professor Bates must have overlooked the MxConstraint in your model, because by default, OpenMx does not calculate an explicit Hessian matrix at the solution when MxConstraints are present, because in general, the standard errors calculated from the Hessian of the -2logL function will not be valid when there are constraints.Still, that's not a very helpful error message, and
mxSE()
should fail with a better error message in a case like this...Bug fixes that gives better and more informative error messages have already been committed. They will be available in the next release of OpenMx. They are currently available for Mac users from our travis build.
Improve error handling for mxSE
Extend mxGetExpected to 'sideways' model references
Safely handle mxConstraints in mxSE()
In looking at this again...if you want confidence intervals, you'd need to include, say,
in your model, instead of
because you need to provide the name as it is in the OpenMx namespace, and not its R symbol (which OpenMx doesn't know).
Thank you for your answer but I cannot make it work so where exactly should I add this line? I have tried to add as follow this line
but this show only a value not an interval
Another couple of questions that I would like to ask if it is possible would be:
1-I don't know how to interpret this result
I mean SA is more than one am I doing something wrong?
moreover, this is V matrix
So I have no idea how to know the Phenotypic correlation because is more than one again
2-I would like to know how I should fix the starting values
Thank you again and sorry for the inconveniences but I am really new :(
I'm not entirely sure what you mean here. Try changing line 137 of your script from
to
Your script already places
ciACE
in the MxModel named "twoACEja", which is fine, but it necessitates the "MZ." prefixes in the argument tomxCI()
, because the algebras with names "rA", "rC", and "rE" are inside the MxModels named "MZ" and "DZ". You have to then usemxRun()
, with argumentintervals=T
, on the MxModel with R symbolmodelACE
. The confidence intervals should appear as part ofsummary()
output from the post-mxRun()
model, which has symbolfitACE
.The elements of 'SA' are the elements of the additive-genetic covariance matrix elementwise divided by the total covariance matrix. The interpretation of its off-diagonal elements as proportions comes unraveled if the off-diagonals of any of the other biometric covariance matrices are negative, which is the case here (E).
"V" is the total phenotypic covariance matrix, not correlation matrix. To get the correlation matrix, try something like
at the R prompt. You could also add an MxAlgebra to your model that does the same thing.
Do you mean "fix" them as in repair them? Or "fix" them in the sense of holding them constant?
Thank you for your response.
1- If I use ciACE <- mxCI(c("VC[1,1]", "MZ.rA", "MZ.rC", "MZ.rE")) this is only for Monozygotic twins? or it is the interval for rA, rC and rE?
2- So how can I know the real value of SA? I mean the proportion of genetic variance shared between the 2 traits? Is my analysis well done?
But with V matrix can I know the phenotipic correlation not only for MZ or DZ twins?
3- Sorry my English is not really good I meant what should be the starting values, the criterion to stablish the starting values.
Thank you so much!!!
It's the interval for rA, rC, and rE. Because the MxAlgebra objects for those 3 quantities are contained in both the MZ and DZ submodels, it would also have sufficed to instead do
I refer you to discussion in previous relevant threads #4134, #4141, and #4223.
Not sure what you mean here? By construction, in the ACE model, the (within-twin) phenotypic covariance matrix is the same for MZ and DZ twins: V = A + C + E. You could just as easily do
instead of what I have in my post above.
See relevant discussion in this other thread.
Thank you so much that information is really helpful for me!!! Now, It makes more sense :)
I only have one doubt more, How can I know the correlation for MZ and DZ separately and for each trait? is it possible?
Thank you so much again!
You could do something like
or perhaps
which will give you the 4x4 twin-pair correlation matrices. You could also make algebras that do the same thing, e.g.
and put each in the appropriate submodel ("MZ" or "DZ", as the case may be).
Thank you so much!! Really helpful ! I am learning a lot^^.
I am going to open a new thread because I think I need to do a trivariate model instead of two bivariate models.
Thank you so much again.