Hello,
I would like to ask for help with an error code 6:
Required 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 ran a univariate ACE model with three covariates that are 100% shared between the twins (one continuous and two binary), using paths specification and raw data as an input. I did it twice:
1)one time with all the data, including twin pairs in which the data on the phenotypic observed variable of one of the twins is missing.
2)a second time, only with pairs that have full data.
If I under correctly, openMX runs the analysis with FIML by default, so I didn't enter any command regarding what to do with missing values in my script.
In the first run (with missing data) I got an error code 6 after running the ACE model but not after running the AE model.
In the second time, I got the opposite: an error code 6 after running the AE model but not after running the ACE model. This was the exact error text:
" In model 'ACE/AE' Optimizer returned a non-zero status code 6. The model does not satisfy the first-order optimality conditions to the required accuracy, and no improved point for the merit function could be found during the final linesearch (Mx status RED)"
Any idea what might have caused this?
The syntax of the ACE model follows this message (the AE model is very similar).
Thank you a lot, this forum is a life saver
#telling Mx that sex and place are binary variables DF$sex_a <- mxFactor(DF$sex_a, levels= c(1,2), label="sex") DF$LabHome6 <- mxFactor(DF$LabHome6, levels=c(0,1), label="LabHome6") threshold <- mxThreshold(vars=c("sex_a","LabHome6"), nThresh=c(1,1), free=TRUE, values=c(1,0)) #finding reasonable starting values for the ACE model StartMean <-mean(c(mean(DF$Phenotype_1),mean(DF$Phenotype_2))) StartMean.Age <-mean(DF$Age6) FAC <-c(DF$Phenotype_1,DF$Phenotype_2) StartVar.ACE <-sqrt(var(FAC)/3) require("OpenMx") # Select Variables for Analysis selVars <- c('Phenotype_1','Phenotype_2', 'Age6', 'sex_a','LabHome6') aceVars <- c("A1","C1","E1","A2","C2","E2") # Select Data for Analysis mzData <- subset(DF, zygosity==1,selVars) dzData <- subset(DF, zygosity==2, 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('Age6','sex_a','LabHome6'), arrows=2, free=(c(TRUE,FALSE,FALSE)), values=c(1,1,1), label=c('agevar','sexVar','placeVar') ) # 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 obsMeans <- mxPath( from="one", to=selVars, arrows=1, free=c(T,T,T,F,F), values=c(StartMean, StartMean, StartMean.Age,0,0), labels=c("meanFAC","meanFAC","meanAge","meanSex","meanPlace") ) # path coefficients for twin 1. pathAceT1 <- mxPath( from=c("A1","C1","E1", "Age6","sex_a","LabHome6"), to="Phenotype_1", arrows=1, free=TRUE, values=StartVar.ACE, label=c("a","c","e", "age","sex","place") ) # path coefficients for twin 2 pathAceT2 <- mxPath( from=c("A2","C2","E2", "Age6","sex_a","LabHome6"), to="Phenotype_2", arrows=1,free=TRUE, values=StartVar.ACE, label=c("a","c","e", "age","sex","place") ) # 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 dataMZ <- mxData( observed=mzData, type="raw" ) dataDZ <- mxData( observed=dzData, type="raw" ) # Combine Groups #arrange together all the paths that are the same for MZ and DZ paths <- list( latVariances, latMeans, obsMeans, pathAceT1, pathAceT2, covC1C2, varCovar ) #Build a model separately for MZ and DZ modelMZ <- mxModel(model="MZ", type="RAM", manifestVars=selVars, latentVars=aceVars, paths, threshold, covA1A2_MZ, dataMZ ) modelDZ <- mxModel(model="DZ", type="RAM", manifestVars=selVars, latentVars=aceVars, paths, threshold, covA1A2_DZ, dataDZ ) minus2ll <- mxAlgebra( expression=MZ.fitfunction + DZ.fitfunction, name="minus2loglikelihood" ) obj <- mxFitFunctionAlgebra( "minus2loglikelihood" ) modelACE <- mxModel(model="ACE", modelMZ, modelDZ, minus2ll, obj ) #Run ACE model fitACE <- mxRun(modelACE, intervals=TRUE) sumACE <- summary(fitACE)