Bootstrap Likelihood Ratio Test
Posted on

Attachment | Size |
---|---|
GrahamM_BLRT.R | 6.34 KB |
Forums
I'm interested in using the new bootstrap function in mxCompare to evaluate nested growth mixture models (GMM) using the Bootstrap Likelihood Ratio Test (BLRT), but am a uncertain how to do so. For example, in the attached code building on the GMM example provided in the OpenMx documentation, say I wanted to compare a three-class model to a two-class model. How would I conduct the BLRT?
OpenMx version: 2.8.3 [GIT v2.8.3]
R version: R version 3.4.1 Patched (2017-08-09 r73082)
Platform: x86_64-w64-mingw32
Default optimiser: CSOLNP
NPSOL-enabled?: Yes
OpenMP-enabled?: No
read the man page?
Did you try
mxCompare(gmm3Fit, gmm2Fit, boot=TRUE)
? You should find detailed documentation in the mxCompare man page. Let us know if we might improve the documentation.Log in or register to post comments
Bootstrap Function Does Not Seem to Function when Comparing GMMs
mxCompare (gmm3Fit, gmm2Fit, boot = TRUE) returns the error message:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘genericGenerateData’ for signature ‘"NULL"’
Error: Cannot bootstrap null model 'GMM2Class'
OpenMx version: 2.8.3 [GIT v2.8.3]
R version: R version 3.4.1 Patched (2017-08-09 r73082)
Platform: x86_64-w64-mingw32
Default optimiser: CSOLNP
NPSOL-enabled?: Yes
OpenMP-enabled?: No
Log in or register to post comments
In reply to Bootstrap Function Does Not Seem to Function when Comparing GMMs by matthewcgraham
expectation
I'm pretty sure an MxModel needs to contain an "expectation" object in order for OpenMx to know how to generate data based on it. Look into using
mxExpectationMixture()
andmxFitFunctionML()
.Edit: that's probably something the documentation needs to say...
Log in or register to post comments
In reply to expectation by AdminRobK
oh! mixture
Wait, how is this suppose to work? Will you resample each mixture component independently or do you want to resample the data once and have the same resampled data used by each mixture component? I may need to write some code to make this work.
Log in or register to post comments
In reply to oh! mixture by jpritikin
parametric
The bootstrap LRT uses parametric bootstrapping, remember. OpenMx has to generate data under the null model from a parametric distribution (multivariate normal).
Log in or register to post comments
In reply to parametric by AdminRobK
null distribution
Yeah but it sounds like Matthew is trying to determine the best number of mixture components for a non-parametric (case resampling) bootstrap of the data.
Log in or register to post comments
Struggling to Adapt GMM Code
I've been attempting to adapt the GMM code to incorporate mxExpectationMixture() and mxFitFunctionML(), but am having little success. Any insight would be greatly appreciated.
MCG
Log in or register to post comments
In reply to Struggling to Adapt GMM Code by matthewcgraham
false start
mxGenerateData is not implemented for mxExpectationMixture. So that wouldn't help anyway. You probably want to treat the mixture proportions as parameters to be estimated and not included as part of the bootstrap distribution. So you don't want the mixture proportions to affect the bootstrap data generation.
You'll have to do this by hand. Write a loop around the whole script. Generate a random weight vector. Pass it to mxData(.., weight=weight). Execute the whole script (inner part of the loop). Aggregate and summarize output from mxCompare.
Log in or register to post comments
In reply to false start by jpritikin
mxGenerateData
That's a rather serious oversight...!
Edit: And I'm pretty sure you're still confused about what Matthew is trying to accomplish here.
Log in or register to post comments
In reply to mxGenerateData by AdminRobK
goal?
Yeah, that's the question. What Matthew is trying to accomplish?
Log in or register to post comments
In reply to goal? by jpritikin
I am pretty sure he's simply
I am pretty sure he's simply trying to do the bootstrap LRT via
mxCompare()
, to test a null model with (say) 2 mixture components against an alternative model with (say) 3 mixture components. To do so, he needs to be able to generate data under the null model, fit the null model to the generated data, fit the alternative model to the generated data, store the difference in -2logL, and repeat the process for B replications. Unfortunately, the generic for data-generation currently has no method defined for MxExpectationMixture, so OpenMx cannot do what he wants in an automated fashion viamxCompare()
.Log in or register to post comments
In reply to I am pretty sure he's simply by AdminRobK
High priority
I would say that implementing the data generation under mxExpectationMixture is now a high priority. Apologies to the OP for our oversight!
Log in or register to post comments
Yes, Exactly
AdminRobK describes what I'm trying to do (well, reviewers want me to do).
Thank you all for your support,
MCG
Log in or register to post comments
In reply to Yes, Exactly by matthewcgraham
gotcha
Alright, you need version v2.9.2-11-g49758bdfa or better of OpenMx. The script to perform the desired analysis is attached.
Log in or register to post comments
In reply to gotcha by jpritikin
windows?
You use windows, correct? I built a windows binary package for you, [OpenMx_2.9.2-17.zip](https://vipbg.vcu.edu/vipbg/OpenMx2/software/bin/windows/contrib/3.4/OpenMx_2.9.2-17.zip).
Log in or register to post comments
Yes, I use Windows
Yes, and the script seems to work correctly in both the example and my current research project.
Thank you all so much for your attention and support!
Regards,
MCG
Log in or register to post comments