You are here

Univariate Binary Model with multiple covariates that are binary, categorical, and continuous.

9 posts / 0 new
Last post
Rolandgem's picture
Offline
Joined: 10/24/2015 - 10:02
Univariate Binary Model with multiple covariates that are binary, categorical, and continuous.
AttachmentSize
Binary Data univariateThreshold.R4.8 KB
File data.csv705 bytes

This is my first attempt at binary univariate models with multiple covariates. When i fit the saturated model I get the following error which I am not sure what it actually means:

Error in runHelper(model, frontendStart, intervals, silent, suppressWarnings, :
MxComputeConfidenceInterval: reference fit is not finite

My guess is that it has something to do with the values or bounds?
What are some guidelines for choosing values when you have binary variables (as well as a mix of binary and continuous covariates)?

I have attached the code and a sample of my data. Since this is my first attempt at modelling twins I would greatly appreciate any comments regarding the format of my data and feedback regarding my code.

Thanks :)

jpritikin's picture
Offline
Joined: 05/24/2012 - 00:35
MxComputeConfidenceInterval: reference fit is not finite

That error probably means that the optimizer did not succeed in optimizing your model. Try mxRun(..., intervals=FALSE) and inspect the model with summary to make sure that optimization really succeeded.

Rolandgem's picture
Offline
Joined: 10/24/2015 - 10:02
I did as you suggested. So

I did as you suggested (please see below). So does this mean my starting values are wrong? What is the rule of thumb when choosing these values for binary data?

> # 1) RUN Saturated Model
>
> SatFit <- mxRun(SatModel, intervals=FALSE)
Running Sat with 10 parameters
Warning message:
In model 'Sat' Optimizer returned a non-zero status code 10. Starting values are not feasible. Consider mxTryHard()
> (SatSumm <- summary(SatFit))
Summary of Sat

Starting values are not feasible. Consider mxTryHard()

free parameters:
name matrix row col Estimate lbound ubound
1 BaTH MZ.BageTH 1 1 0.1
2 BsTH MZ.BsexTH 1 1 0.1
3 BpTH MZ.BphuTH 1 1 0.1
4 BparTH MZ.BpartTH 1 1 0.1
5 Tmz11 MZ.ThMZ 1 1 0.8 -2 2
6 imz11 MZ.ThMZ 1 2 1.0 0.001 2
7 MZ.expCorMZ[1,2] MZ.expCorMZ ebent1 ebent2 0.6 -0.99 0.99
8 Tdz11 DZ.ThDZ 1 1 0.8 -2 2
9 idz11 DZ.ThDZ 1 2 1.0 0.001 2
10 DZ.expCorDZ[1,2] DZ.expCorDZ ebent1 ebent2 0.3 -0.99 0.99

observed statistics: 16568
estimated parameters: 10
degrees of freedom: 16558
fit value ( -2lnL units ): Inf
number of observations: 8284
Information Criteria:
| df Penalty | Parameters Penalty | Sample-Size Adjusted
AIC: Inf Inf NA
BIC: Inf Inf Inf
CFI: NA
TLI: 1 (also known as NNFI)
RMSEA: 0 [95% CI (NA, NA)]
Prob(RMSEA <= 0.05): NA
OpenMx does not recommend using GFI, AGFI, NFI (aka Bentler-Bonett), or SRMR:
See help(mxSummary) for why.
Some of your fit indices are missing.
To get them, fit saturated and independence models, and include them with
summary(yourModel, refModels=...)
See help(mxRefModels) for an easy way of doing this in many cases.
timestamp: 2015-10-28 17:36:25
Wall clock time (HH:MM:SS.hh): 00:00:00.64
optimizer: SLSQP
OpenMx version number: 2.3.1
Need help? See help(mxSummary)

jpritikin's picture
Offline
Joined: 05/24/2012 - 00:35
starting values

Yes, it is likely that your starting values are causing the covariance to be non-positive definite. You'll need to figure out why. Take a look at mxGetExpected(model, "covariance")

AdminNeale's picture
Offline
Joined: 03/01/2013 - 14:09
Starting values ok I think

Looking at it, I think the starting values are ok. What looks wrong to me is that the definition variables sex and age have been converted to factors. Only the dependent ordinal variables should be mxFactor()'d. Does that help? Sorry for slow response...

Rolandgem's picture
Offline
Joined: 10/24/2015 - 10:02
I tried to use the sex and

I tried to use the sex and partner as integers, but when I run the script, R crashes. I think it expects these variables to be factors.

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
I think the crash is because of something else

I don't think I've ever tried to use a factor as a definition variable, and I'm pretty sure I've never seen it done, either. Sex and "partner" are just binary, right? You should be fine simply coding each as a numeric vector of 0s and 1s.

Could you say more about the crash you encountered? It's always possible it's due to a bug, and even if it isn't, we can help you troubleshoot.

bhuibregtse's picture
Offline
Joined: 03/06/2014 - 22:15
Factor as a definition variable

Hey there,

I have two projects where I would like to use ordinal or categorical variables as covariates.

In the simple case, the there is one covariate (5 non-ordered categories). Another model includes age (continuous), sex (I understand 0-1 coding is fine here), and two non-ordered categorical variables.

My search keep leading me to this thread.. any updates?

Thanks!
Brooke

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
dummy coding, etc.

Non-ordered categorical covariates are easy. Use dummy coding, effects coding, or something like that. If you have five categories, you'd need to create four new variables in your dataset.