You are here

mxCI working?

6 posts / 0 new
Last post
tbates's picture
Offline
Joined: 07/31/2009 - 14:25
mxCI working?

hi, I have a model to which I add an mxCI as follows

model <- mxModel(fit1a, mxModel(fit1a@submodels$top,mxCI("top.a21")));
fit= mxRun(model, intervals=T); 

This runs fine without error, but summary(fit) does not show a CI

> summary(fit)
snip...
Information Criteria: 
     df Penalty Parameters Penalty Sample-Size Adjusted
AIC    887.2424           7439.242                   NA
BIC -14988.3563           7541.666              7474.97

CFI: Put CFI Forumla Here. 
TLI: Put TLI Forumla Here. 
RMSEA:  NA 
timestamp: 2011-05-26 16:52:47 

If I ask directly, it is there:
> fit@submodels$top@intervals
$a21
MxInterval
@reference: a21
@lowerdelta: 3.841459
@upperdelta: 3.841459

But doesn't seem to have been calculated...

Is this broken in ?
mxVersion()
[1] "999.0.0-1609"

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Will the following

Will the following work?

model <- mxModel(fit1a, mxCI("top.a21"))
mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
OK, go ahead and try the

OK, go ahead and try the original script in the latest revision of the svn repository. I'm fairly certain I've fixed this bug. I also have a test case for CIs in submodels with the function omxParallelCI() that is working.

Charlotte's picture
Offline
Joined: 07/02/2012 - 11:13
CIs of A, C, E in bivariate model

Hi,

I have a very similar problem with calculating the CIs.
I have a bivariate script and I would like to calculate the CIs around the estimates of A, C, and E.
To keep it simple, I wanted to start with the A of phenotype 1 - these are the relevant parts of the skript:

amn <- mxAlgebra(expression=Am[1,1]/Vm[1,1], name="amn")
ConfInt <- mxCI("amn")

Objectives

MZMObjective <- mxFIMLObjective(covariance="expCovMZM", means="expMeanMZM", dimnames=selVars)
DZMObjective <- mxFIMLObjective(covariance="expCovDZM", means="expMeanDZM", dimnames=selVars)
MZFObjective <- mxFIMLObjective(covariance="expCovMZF", means="expMeanMZF", dimnames=selVars)
DZFObjective <- mxFIMLObjective(covariance="expCovDZF", means="expMeanDZF", dimnames=selVars)
DOSObjective <- mxFIMLObjective(covariance="expCovDOS", means="expMeanDOS", dimnames=selVars)

Combine Groups

pars <- list(pathAm,pathCm,pathEm,
pathAf,pathCf,pathEf,
pathRados,
covAm,covCm,covEm,covPhm,
covAf,covCf,covEf,covPhf,
matIm,invSDm,corPhm,
matIf,invSDf,corPhf,
grandMeanm,
grandMeanf,
b,Def,DefR,
expMeanMZM,expMeanDZM,expMeanMZF,expMeanDZF,expMeanDOS,
amn,ConfInt)

Models

MZMmodel <- mxModel("MZMmodel", dataMZM, pars, expCovMZM, MZMObjective)
DZMmodel <- mxModel("DZMmodel", dataDZM, pars, expCovDZM, DZMObjective)
MZFmodel <- mxModel("MZFmodel", dataMZF, pars, expCovMZF, MZFObjective)
DZFmodel <- mxModel("DZFmodel", dataDZF, pars, expCovDZF, DZFObjective)
DOSmodel <- mxModel("DOSmodel", dataDOS, pars, expCovDOS, DOSObjective)

Objective

min2sumll <- mxAlgebra( expression = MZMmodel.objective + DZMmodel.objective + MZFmodel.objective + DZFmodel.objective + DOSmodel.objective, name="min2sumll" )
objective <- mxAlgebraObjective("min2sumll")

Cholesky ACE model

CholACEModel <- mxModel("Chol", MZMmodel, DZMmodel, MZFmodel, DZFmodel, DOSmodel, min2sumll,objective)

Fitting

CholACEFit <- mxRun(CholACEModel, intervals=T)

openMx then provides the correct point estimate of A, but it doesn't give the confidence interval:
> CholACEFit@submodels$MZM@algebras$amn
mxAlgebra 'amn'
@formula: Am[1, 1]/Vm[1, 1]
@result:
[,1]
[1,] 0.5028693
dimnames: NULL
> CholACEFit@submodels$MZM@intervals$amn
MxInterval
@reference: amn
@lowerdelta: 3.841459
@upperdelta: 3.841459

(Same problem when I use the summary function.)

I don't know if this is of any importance, but when I add ConfInt to the CholACEModel
CholACEModel <- mxModel("Chol", MZMmodel, DZMmodel, MZFmodel, DZFmodel, DOSmodel, min2sumll,ConfInt,objective)
I get this error:
Running Chol
Error: Unknown reference to 'amn' detected in a confidence interval specification in model 'Chol' in runHelper(model, frontendStart, intervals, silent, suppressWarnings, unsafe, checkpoint, useSocket, onlyFrontend)

Does any of you recognize the problem?
Any help is very much appreciated!!

Regards
Charlotte

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
I believe there are two

I believe there are two issues that are happening with this script:

  1. UPDATE: I've tested OpenMx 1.2.4, and we do evaluate the confidence intervals that are specified in the submodels (see script). The CIs will appear in summary(modelFit), or alternatively can be accessed by inspecting the parent model (not the child model) with modelFit@output$confidenceIntervals.

I can't remember whether we evaluate the confidence intervals that are specified in submodels. We probably should be evaluating confidence intervals that are specified in submodels.In case we are not, try specifying the confidence intervals in the parent model with the following notation :

CholACEModel <- mxModel(CholACEModel, mxCI("MZMmodel.amn"), 
    mxCI("DZMmodel.amn"), mxCI("MZFmodel.amn"), mxCI("DZFmodel.amn"), 
    mxCI("DOSmodel.amn"))
  1. The error message is occurring because there is no "amn" algebra specified in the parent model. Eliminating the 'ConfInt' from the following statement should remove the error:
CholACEModel <- mxModel("Chol", MZMmodel, DZMmodel, MZFmodel, DZFmodel, 
    DOSmodel, min2sumll,ConfInt,objective)
Charlotte's picture
Offline
Joined: 07/02/2012 - 11:13
Hi Michael, Thank you so much

Hi Michael,

Thank you so much for your fast reply and sorry that I didn't respond immediately.
I ran the skript and I think that it's working fine now.

I've changed the code as follows:

CholACEModel <- mxModel("Chol", MZMmodel, DZMmodel, MZFmodel, DZFmodel, DOSmodel, min2sumll, objective)
CholACEModel <- mxModel(CholACEModel,
mxCI("MZMmodel.amnatt"), mxCI("DZMmodel.amnatt"), mxCI("MZFmodel.amnatt"), mxCI("DZFmodel.amnatt"), mxCI("DOSmodel.amnatt"),
mxCI("MZMmodel.cmnatt"), mxCI("DZMmodel.cmnatt"), mxCI("MZFmodel.cmnatt"), mxCI("DZFmodel.cmnatt"), mxCI("DOSmodel.cmnatt"),
mxCI("MZMmodel.emnatt"), mxCI("DZMmodel.emnatt"), mxCI("MZFmodel.emnatt"), mxCI("DZFmodel.emnatt"), mxCI("DOSmodel.emnatt"),
mxCI("MZMmodel.afnatt"), mxCI("DZMmodel.afnatt"), mxCI("MZFmodel.afnatt"), mxCI("DZFmodel.afnatt"), mxCI("DOSmodel.afnatt"),
mxCI("MZMmodel.cfnatt"), mxCI("DZMmodel.cfnatt"), mxCI("MZFmodel.cfnatt"), mxCI("DZFmodel.cfnatt"), mxCI("DOSmodel.cfnatt"),
mxCI("MZMmodel.efnatt"), mxCI("DZMmodel.efnatt"), mxCI("MZFmodel.efnatt"), mxCI("DZFmodel.efnatt"), mxCI("DOSmodel.efnatt"))

Cheers
Charlotte