# bootstrap likelihood ratio test (BLRT) for GMM with definition variables

25 posts / 0 new
Offline
Joined: 02/23/2018 - 01:57
bootstrap likelihood ratio test (BLRT) for GMM with definition variables
AttachmentSize
95.67 KB

Hi everyone,

I would like to conduct BLRT test for 2 nested GMM model with definition variables. I referred to a previous post
https://openmx.ssri.psu.edu/node/4329 and it worked well on my computer. However, when I run the comparison of my model, it reported errors. I attached a screenshot of LRT without and with bootstrap in the attachment. And here is the information of my OpenMx Version:

> mxVersion()
OpenMx version: 2.9.6 [GIT v2.9.6]
R version: R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0
MacOS: 10.13.4
Default optimiser: CSOLNP
NPSOL-enabled?: Yes
OpenMP-enabled?: Yes

Offline
Joined: 01/24/2014 - 12:15
Script?

You should post your current script.

Offline
Joined: 02/23/2018 - 01:57
Thanks for kind and prompt

Thanks for kind and prompt reply. I've attached dataset and codes I am using. Thanks in advance!

File attachments:
Offline
Joined: 01/24/2014 - 12:15
I reproduce the error you

I reproduce the error you report. I think this is a bug. A model using an MxExpectationMixture will run if the mixture components contain definition variables but the data are in the container model, and not the mixture-component. But, mxGenerateData() raises an error if it sees definition variables inside an MxModel object that doesn't contain an MxData object.

The bug-fix will seemingly require modifying the behavior of mxGenerateData() when used with models that have MxExpectationMixture.

As a workaround, try putting the MxData object inside the mixture components class1, class2, and class3, and see it that makes a difference. Alternately, you could try defining sloLoads differently, so that its labels are paste0("GMM2Class.data.T", 1:10) when used with the two-component model, and paste0("GMM3Class.data.T", 1:10) when used with the three-component model.

Offline
Joined: 02/23/2018 - 01:57

Thanks for your kind advice. I've tried to put the raw data in each class. However, every time I tried run it, R studio would be terminated since "R encountered a fatal error" and I don't know why. Also, relabeling the definition variables did not work either. I've included the updated version with data in the attachment. Thank you.

File attachments:
Offline
Joined: 02/23/2018 - 01:57
Another error

BTW, it seems that the function mxBootstrap() does not work well if I put mxData outside the class1, class2 and class3. But it works if I put the data in each class. Thanks.

Offline
Joined: 05/24/2012 - 00:35
mxBootstrap

Yes, these are symptoms of the same problem with mxGenerateData.

Offline
Joined: 01/24/2014 - 12:15
Wait, I don't think that's

Wait, I don't think that's the case. mxBootstrap() is for nonparametric bootstrapping, so its behavior doesn't depend upon mxGenerateData().

Offline
Joined: 05/24/2012 - 00:35
Rob is correct

What exactly is going wrong with mxBootstrap?

Offline
Joined: 05/24/2012 - 00:35
investigating

Something is going wrong with data generation.

Offline
Joined: 05/24/2012 - 00:35
a bunch of stuff related to inherited MxData was broken

Yeah, you can probably get your stuff to work with the current version of OpenMx by copying the data into the class components. Anyway, fixed in v2.9.6-48-g17adc932f

Offline
Joined: 02/23/2018 - 01:57
Thank you

Tried it, but R studio would be terminated every time. And glad to know it will be fixed. May I know when v2.9.6-48-g17adc932f will be available (approximated date is good enough)? Thank you very much!

Offline
Joined: 05/24/2012 - 00:35
os/x builds

You could try the builds here

Offline
Joined: 01/24/2014 - 12:15
Specifically, you could try

Offline
Joined: 02/23/2018 - 01:57
Requirement for R version

Thanks for your kind reply. I tried, however, it seems not available for R version 3.4.4. I am wondering if it has specific requirement for r version. Thank you very much!

Offline
Joined: 01/24/2014 - 12:15
R version
I am wondering if it has specific requirement for r version.

Not that I know of. But, I'm not involved in building OpenMx for MacOS. Are you downloading the file and installing the package from that local file?

Offline
Joined: 02/23/2018 - 01:57
Yep, and here is the

Yep, and here is the screenshot

File attachments:
Offline
Joined: 01/24/2014 - 12:15
You might need to

You might need to additionally pass argument repos=NULL to install.packages() to install a local file.

You use RStudio, right? It's also possible to install a local file with RStudio's package-installation interface.

Also, the extension of a MacOS package binary should be .tgz, not .tar.

Offline
Joined: 02/23/2018 - 01:57
Yes, it works now. Thank you

Yes, it works now. Thank you very much!

Offline
Joined: 02/23/2018 - 01:57
One more question

I run mxCompare(model1, model2, boot=TRUE) on my computer using 4 cores overnight, but it did not work... I mean I did not get any result until now... Should it take longer? If so, I may want to run it on cluster. May I know how to upgrade the package on cluster? Thank you very much!

Offline
Joined: 05/24/2012 - 00:35
cluster

Who manages your cluster? You'll probably want to talk to that person for guidance.

Offline
Joined: 02/23/2018 - 01:57

Thanks for your kind advice! I firstly may want to check if the BLRT for definition variables is available for linux system. If so, which version should be used? Thank you very much!

Offline
Joined: 05/24/2012 - 00:35
def vars

What's implemented is data generation assuming that def vars are fixed. If that's what you want then it should work. You can test whether data generation works the way you expect with mxGenerateData

Offline
Joined: 01/24/2014 - 12:15
I agree with Joshua

I agree with Joshua: the best person to ask is your cluster's sysadmin. If I had to guess, I would recommend following the instructions under "Unix installation" here, except with an additional shell command:

git clone git@github.com:OpenMx/OpenMx.git
cd OpenMx/
git checkout stable
make install
Offline
Joined: 02/23/2018 - 01:57
Yes, I think so

Yes, I think so