Hi,
I would like to ask for help with an error:
Details about my openMX run:
OpenMx version: 2.7.12 [GIT v2.7.12-dirty]
R version: R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32
Default optimiser: CSOLNP
I am trying to run a univariate model with three covariates-one categorical and two continuous. Unfortunately, when I get to the phase of model running (mxRun), no matter what I do, I receive the following error:
"Running ACE_Hetero with 18 parameters
Error: The job for model 'ACE_Hetero' exited abnormally with the error message: fit is not finite (Ordinal covariance is not positive definite in data 'DZF.data' row 112 (loc2))
In addition: Warning message:
In model 'ACE_Hetero' Optimizer returned a non-zero status code 10. Starting values are not feasible. Consider mxTryHard()".
In attempts to resolve the first error, I tried removing observations with missing values, removing one of the covariates from the model, replacing the starting values, playing with the "connect" command when specifying the covariates covariance matrix... and nothing helped. It is always the same error.
I an attaching the syntax. I would really appreciate your input regarding what is wrong.
Thank you!!
#define start values meanFAC1 <-mean(na.omit(WDtotal$POSFAC_1_Res)) meanFAC2 <-mean(na.omit(WDtotal$POSFAC_2_Res)) StartMean <-mean(c(meanFAC1,meanFAC2)) StartMean.Age <-mean(WDtotal$Age6Y) StartMean.Relig <-mean(WDtotal$MomReligion, na.rm=T) StartMean.Sib <- mean(WDtotal$sibNum,na.rm=T) require("OpenMx") # Select Variables for Analysis selVars <- c('POSFAC_1_Res','POSFAC_2_Res','LabHome6', 'MomReligion','sibNum') aceVars <- c("A1","C1","E1","A2","C2","E2") # Select Data for Analysis mzM <- subset(WDtotal, zygosity==1 & sex_a=='sex1',selVars) mzF <- subset(WDtotal, zygosity==1 & sex_a=='sex2',selVars) dzM <- subset(WDtotal, zygosity==2 & sex_a=='sex1',selVars) dzF <- subset(WDtotal, zygosity==2 & sex_a=='sex2',selVars) # Path objects for Multiple Groups manifestVars=selVars latentVars=aceVars # specify paths for the variances and means of the latent variables latVariances <- mxPath( from=aceVars, arrows=2,free=FALSE, values=1 ) varCovar <- mxPath( from= c('LabHome6','MomReligion','sibNum'), arrows=2, free=(c(F,T,T)), values=c(1,1,1), label=c('placeVar','religion','siblings'), connect='unique.bivariate' ) # means of latent variables latMeans <- mxPath( from="one", to=aceVars, arrows=1,free=FALSE, values=0 ) #specify paths for the means of the observed variables. Because the scores are residual scores from sex and age, I constrain the means to be the same for boys and girls. obsMeansM <- mxPath( from="one", to=selVars, arrows=1, free=c(T,T,F,T,T), values=c(StartMean, StartMean,0,StartMean.Relig,StartMean.Sib), labels=c("meanFAC","meanFAC","meanPlace","meanReligion","meanSiblings") ) obsMeansF <- mxPath( from="one", to=selVars, arrows=1, free=c(T,T,F,T,T), values=c(StartMean, StartMean,0,StartMean.Relig,StartMean.Sib), labels=c("meanFAC","meanFAC","meanPlace","meanReligion","meanSiblings") ) # path coefficients for twin 1. pathAceTM1 <- mxPath( from=c("A1","C1","E1", "LabHome6","MomReligion","sibNum"), to="POSFAC_1_Res", arrows=1, free=c(T,T,T,T,T,T), values=c(StartVar.ACE,StartVar.ACE,StartVar.ACE,1,StartMean.Relig,StartMean.Sib), label=c("aM","cM","eM","place","Religion","Siblings") ) pathAceTF1 <- mxPath( from=c("A1","C1","E1", "LabHome6","MomReligion","sibNum"), to="POSFAC_1_Res", arrows=1, free=c(T,T,T,T,T,T), values=c(StartVar.ACE,StartVar.ACE,StartVar.ACE,1,StartMean.Relig,StartMean.Sib), label=c("aF","cF","eF","place","Religion","Siblings") ) # path coefficients for twin 2 pathAceTM2 <- mxPath( from=c("A2","C2","E2", "LabHome6","MomReligion","sibNum"), to="POSFAC_2_Res", arrows=1, free=c(T,T,T,T,T,T), values=c(StartVar.ACE,StartVar.ACE,StartVar.ACE,1,StartMean.Relig,StartMean.Sib), label=c("aM","cM","eM","place","Religion","Siblings") ) pathAceTF2 <- mxPath( from=c("A2","C2","E2", "LabHome6","MomReligion","sibNum"), to="POSFAC_2_Res", arrows=1, free=c(T,T,T,T,T,T), values=c(StartVar.ACE,StartVar.ACE,StartVar.ACE,1,StartMean.Relig,StartMean.Sib), label=c("aF","cF","eF","place","Religion","Siblings") ) # covariance between C1 & C2 covC1C2 <- mxPath( from="C1", to="C2", arrows=2,free=FALSE, values=1 ) # covariance between A1 & A2 in MZ's covA1A2_MZ <- mxPath( from="A1", to="A2", arrows=2,free=FALSE, values=1 ) # covariance between A1 & A2 in DZ's covA1A2_DZ <- mxPath( from="A1", to="A2", arrows=2,free=FALSE, values=.5 ) #call the data.frame with the MZ raw data, mzData, and the DZ raw data dataMZM <- mxData( observed=mzM, type="raw" ) dataMZF <- mxData( observed=mzF, type="raw" ) dataDZM <- mxData( observed=dzM, type="raw" ) dataDZF <- mxData( observed=dzF, type="raw" ) # Combine Groups #arrange together all the paths that are the same for MZ and DZ pathsM <- list(latVariances, latMeans, obsMeansM, pathAceTM1, pathAceTM2, covC1C2, varCovar ) pathsF <- list( latVariances, latMeans, obsMeansF, pathAceTF1, pathAceTF2, covC1C2, varCovar ) #Build a model seperately for MZ and DZ and for each sex modelMZM <- mxModel(model="MZM", type="RAM", manifestVars=selVars, latentVars=aceVars, pathsM, threshold, covA1A2_MZ, dataMZM ) modelDZM <- mxModel(model="DZM", type="RAM", manifestVars=selVars, latentVars=aceVars, pathsM, threshold, covA1A2_DZ, dataDZM ) modelMZF <- mxModel(model="MZF", type="RAM", manifestVars=selVars, latentVars=aceVars, pathsF, threshold, covA1A2_MZ, dataMZF ) modelDZF <- mxModel(model="DZF", type="RAM", manifestVars=selVars, latentVars=aceVars, pathsF, threshold, covA1A2_DZ, dataDZF ) obj <- mxFitFunctionMultigroup(c("MZM","DZM","MZF","DZF")) modelACE.Hetero <- mxModel(model="ACE_Hetero", modelMZM, modelDZM,modelMZF, modelDZF, obj, CI ) fitACE.Hetero <- mxRun(modelACE.Hetero) sumACE.Hetero <- summary(fitACE.Hetero)