You are here

submodel testing in bivariate ACE model using ordinal data with different thresholds

6 posts / 0 new
Last post
mccutchv's picture
Offline
Joined: 05/19/2011 - 14:03
submodel testing in bivariate ACE model using ordinal data with different thresholds
AttachmentSize
Binary Data test8.R20.6 KB

I've used OpenMX to duplicate an MX model using bivariate Cholesky of alcohol use disorder symptoms (ordinal variable with 4 thresholds) and remission (bivariate). Results are similar but I cannot figure out how to test a submodel that equates male and female parameters on the threshold variables (first has 4 thresholds, second has just one). Any ideas? From what I've read OpenMX may still be a little dicey with ordinal variables? Script attached.

tbrick's picture
Offline
Joined: 07/31/2009 - 15:10
Equate labels

To equate the thresholds across gender, just find the free parameters that correspond to the thresholds or threshold offsets and constrain those parameters to be equal by giving them the same label.

I'll use multACEModel in the attached test, since it seems the easiest example. In this, you're generating two matrices, V1TF, and V1TM that each have one lowest threshold and 3 threshold offsets, and then multiplying those by a lower triangular matrix of ones to get the actual thresholds. You also have two matrices, V2TF and V2TM, which have the single thresholds for the second variable directly as free parameters.

If that's an accurate assessment, you could constrain the thresholds for males and females to be equal by adding labels to the free parameters in those matrices. Something like this:

# Matrix for expected thresholds vectors in FEMALES 
    mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=TRUE,
         values=c(-1.0, .01, .10, .20), labels = c("V1T1", "V1T2", "V1T3", "V1T4"),  lbound=c(-2.0, .00001, .01, .10), name="V1TF"),
    mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=c(TRUE,FALSE,FALSE,FALSE), values=c(-.10,NA,NA,NA), labels = c("V2T1", NA, NA, NA),  name="V2TF"),
   # Matrix for expected thresholds vectors in MALES 
    mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=TRUE,
         values=c(-1.0, .01, .10, .20), labels = c("V1T1", "V1T2", "V1T3", "V1T4"), lbound=c(-2.0, .00001, .01, .10), name="V1TM"),
    mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=c(TRUE,FALSE,FALSE,FALSE), values=c(.10,NA,NA,NA), labels = c("V2T1", NA, NA, NA), name="V2TM"),

Notice: I've added labels to every element. By using the same labels for both males and females, I've constrained them to be the same free parameter; they must be equal. Notice that I also had to change the values and the lbounds--if you put the same free parameter in two places, it must have the same starting values and bounds in each place.

You could do something similar with the various groups in your multTwinSatModel.

As far as I know, OpenMx doesn't have any problems with ordinal variables. What you may have been hearing is that OpenMx 1.0.* doesn't support analyses with both ordinal and continuous outcome variables at the same time. That's true, but joint ordinal/continuous analysis is already in testing, and should be ready to go for the upcoming 1.1 release.

mccutchv's picture
Offline
Joined: 05/19/2011 - 14:03
error message

Thanks for the prompt response! I've tried your suggestion and get the following error "Error: unexpected string constant in..."(will cut and paste from console). I suspect it has to do with syntax? Or the fact that I'm assigning labels to a free matrix?

  • # Matrix for expected thresholds vectors in FEMALES
  • # make labels for every element the same for males and females and also they must have same starting values and bounds
  • mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=TRUE,
  • values=c(-1.0, .01, .10, .20), labels=c("V1T1", "V1T2", V1T3", "V1T4"), lbound=c(-2.0, .00001, .01, .10), name="V1TF"),
    Error: unexpected string constant in:
    "mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=TRUE,
    values=c(-1.0, .01, .10, .20), labels=c("V1T1", "V1T2", V1T3", ""
    >
    > mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=c(TRUE,FALSE,FALSE,FALSE), values=c(-.10,NA,NA,NA),
  • labels=("V2T1", NA, NA, NA), name="V2TF"),
    Error: unexpected ',' in:
    " mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=c(TRUE,FALSE,FALSE,FALSE), values=c(-.10,NA,NA,NA),
    labels=("V2T1","
    >
    > # Matrix for expected thresholds vectors in MALES
    >
    > mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=TRUE,
  • values=c(-1.0, .01, .10, .20), labels=c("V1T1", "V1T2", V1T3", "V1T4"), lbound=c(-2.0, .00001, .01, .10), name="V1TM"),
    Error: unexpected string constant in:
    "mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=TRUE,
    values=c(-1.0, .01, .10, .20), labels=c("V1T1", "V1T2", V1T3", ""
    >
    > mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=c(TRUE,FALSE,FALSE,FALSE), values=c(-.10,NA,NA,NA),
  • labels=("V2T1", NA, NA, NA), name="V2TM"))
    Error: unexpected ',' in:
    " mxMatrix(type="Full", nrow=maxthresh, ncol=1, free=c(TRUE,FALSE,FALSE,FALSE), values=c(-.10,NA,NA,NA),
    labels=("V2T1","
    > )
    Error: unexpected ')' in ")"
    > multNoSxACEFit <-mxRun(multNoSxACEModel)
    Running multNoSxACE
    > multNoSxACESumm <- summary(multNoSxACEFit)
    >
mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
There seems to be a missing

There seems to be a missing quotation mark before the string V1T3" in several places.

mccutchv's picture
Offline
Joined: 05/19/2011 - 14:03
Thanks for the new eyes- it

Thanks for the new eyes- it works fine now with results very similar to pre-OpenMX MX.

neale's picture
Offline
Joined: 07/31/2009 - 15:14
Some differences between

Some differences between OpenMx and Classic Mx are to be expected, because classic Mx uses an algorithm to determine independent blocks of a covariance matrix, for which the likelihoods are computed separately and then multiplied together to get the total likelihood. Different numerical precision of this procedure from the "gestalt" one can lead to minor differences in -2lnL and hence results may end up "very similar" but not identical across the two modeling packages. Furthermore, if there are bugs in classic Mx, their detection and eradication is the responsibility of the single programmer (me) who developed it, and since classic Mx is no longer being developed and essentially "scheduled for destruction" http://tinyurl.com/6d2ed3b, so classic Mx revisions are unlikely to happen. OpenMx developments are!