Bootstrap Likelihood Ratio Test

Posted on
Picture of user. matthewcgraham Joined: 02/20/2018
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

Replied on Thu, 02/22/2018 - 09:14
Picture of user. jpritikin Joined: 05/23/2012

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.
Replied on Thu, 02/22/2018 - 10:59
Picture of user. matthewcgraham Joined: 02/20/2018

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

Replied on Thu, 02/22/2018 - 11:14
Picture of user. jpritikin Joined: 05/23/2012

In reply to by AdminRobK

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.
Replied on Thu, 02/22/2018 - 11:19
Picture of user. AdminRobK Joined: 01/24/2014

In reply to by jpritikin

The bootstrap LRT uses parametric bootstrapping, remember. OpenMx has to generate data under the null model from a parametric distribution (multivariate normal).
Replied on Sun, 02/25/2018 - 09:48
Picture of user. jpritikin Joined: 05/23/2012

In reply to by AdminRobK

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.
Replied on Sun, 02/25/2018 - 02:26
Picture of user. matthewcgraham Joined: 02/20/2018

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
Replied on Sun, 02/25/2018 - 09:40
Picture of user. jpritikin Joined: 05/23/2012

In reply to by matthewcgraham

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.

Replied on Sun, 02/25/2018 - 13:38
Picture of user. AdminRobK Joined: 01/24/2014

In reply to by jpritikin

mxGenerateData is not implemented for mxExpectationMixture.

That's a rather serious oversight...!

Edit: And I'm pretty sure you're still confused about what Matthew is trying to accomplish here.

Replied on Mon, 02/26/2018 - 09:45
Picture of user. AdminRobK Joined: 01/24/2014

In reply to by jpritikin

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 via mxCompare().
Replied on Mon, 02/26/2018 - 14:41
Picture of user. matthewcgraham Joined: 02/20/2018

AdminRobK describes what I'm trying to do (well, reviewers want me to do).
Thank you all for your support,
MCG
Replied on Tue, 02/27/2018 - 11:06
Picture of user. jpritikin Joined: 05/23/2012

In reply to by jpritikin

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).
Replied on Sun, 03/04/2018 - 12:42
Picture of user. matthewcgraham Joined: 02/20/2018

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