R version 3.4.0 (2017-04-21) -- "You Stupid Darkness" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(OpenMx) To take full advantage of multiple cores, use: mxOption(NULL, 'Number of Threads', parallel::detectCores()) > mxVersion() OpenMx version: 2.7.11.44 [GIT v2.7.11-44-gfc767f4-dirty] R version: R version 3.4.0 (2017-04-21) Platform: x86_64-pc-linux-gnu Default optimiser: CSOLNP > > flatData <- read.table("ch4mv.dat") > colnames(flatData) <- c("orgid",'female','white', + 'satpay','morale','org1','org2','benefit','cond', + 'resour','zproduct','lev1wt','lev2wt') > > level1 <- flatData[,c('benefit','cond','female','white','orgid')] > level2 <- flatData[!duplicated(flatData$orgid),c('orgid', 'org1','org2','zproduct')] > > orgModel <- mxModel( + "org", type="RAM", + mxData(level2, 'raw', primaryKey = "orgid"), + manifestVars = c('zproduct'), + latentVars = c('Benefits','Conditions', 'org1','org2'), + mxPath(c('zproduct','Benefits','Conditions'), arrows=2, values=1), + mxPath('Benefits','Conditions', arrows=2), + mxPath('one', 'org1', labels='data.org1', free=FALSE), + mxPath('one', 'org2', labels='data.org2', free=FALSE), + mxPath('org1', c('Benefits', 'Conditions')), + mxPath('org2', 'zproduct', labels="a"), + mxPath('one', 'zproduct'), + mxPath('zproduct', c('Benefits','Conditions'), labels=paste0('b',1:2)), + mxMatrix(nrow=2, ncol=1, free=TRUE, labels=paste0('b',1:2), name='B'), + mxAlgebra(B * a, name="indirect") + ) > > empModel <- mxModel( + "emp", type="RAM", orgModel, + mxData(level1, 'raw'), + manifestVars = c('benefit','cond'), + latentVars = c('female','white'), + mxPath('one','female', labels='data.female', free=FALSE), + mxPath('one','white', labels='data.white', free=FALSE), + mxPath(c('female','white'), c('benefit','cond'), connect = "all.bivariate"), + mxPath(c('benefit','cond'), arrows=2, connect = "unique.pairs", values=c(1,0,1)), + mxPath('org.Benefits', 'benefit', values=1, free=FALSE, joinKey = "orgid"), + mxPath('org.Conditions', 'cond', values=1, free=FALSE, joinKey = "orgid"), + mxPath('one', c('benefit','cond')), + mxCI("org.indirect") + ) > > omxGetParameters(empModel) emp.A[1,3] emp.A[2,3] emp.A[1,4] emp.A[2,4] emp.S[1,1] emp.S[1,2] emp.S[2,2] 0 0 0 0 1 0 1 emp.M[1,1] emp.M[1,2] b1 b2 org.A[2,4] org.A[3,4] a 0 0 0 0 0 0 0 org.S[1,1] org.S[2,2] org.S[2,3] org.S[3,3] org.M[1,1] 1 1 0 1 0 > empModel <- omxSetParameters(empModel,labels=names(omxGetParameters(empModel)), + values=c(0.697, + 0.706, + 0.224, + 0.247, + 2.029, + 1.344, + 1.948, + 4.422, + 4.684, + 0.309, + 0.289, + 0.278, + 0.309, + -0.451, + 1.071, + 0.133, + 0.095, + 0.093, + 0.087)) > omxGetParameters(empModel) emp.A[1,3] emp.A[2,3] emp.A[1,4] emp.A[2,4] emp.S[1,1] emp.S[1,2] emp.S[2,2] 0.697 0.706 0.224 0.247 2.029 1.344 1.948 emp.M[1,1] emp.M[1,2] b1 b2 org.A[2,4] org.A[3,4] a 4.422 4.684 0.309 0.289 0.278 0.309 -0.451 org.S[1,1] org.S[2,2] org.S[2,3] org.S[3,3] org.M[1,1] 1.071 0.133 0.095 0.093 0.087 > > mxOption(NULL,"Default optimizer","CSOLNP") > ch4M3c <- mxRun(empModel,useOptimizer=F) Running emp with 19 parameters > ch4M3c$output$fit [1] 82879.52 > ch4M3c <- mxRun(ch4M3c, intervals=TRUE) Running emp with 19 parameters > summary(ch4M3c,verbose=T) Summary of emp data: $emp.data benefit cond female white Min. :1.900 Min. :1.800 Min. :0.0000 Min. :0.0000 1st Qu.:3.800 1st Qu.:3.600 1st Qu.:0.0000 1st Qu.:0.0000 Median :5.700 Median :5.400 Median :0.0000 Median :0.0000 Mean :4.922 Mean :5.213 Mean :0.4889 Mean :0.4473 3rd Qu.:5.700 3rd Qu.:5.400 3rd Qu.:1.0000 3rd Qu.:1.0000 Max. :9.500 Max. :9.000 Max. :1.0000 Max. :1.0000 orgid Min. : 1.00 1st Qu.: 46.00 Median : 83.00 Mean : 82.83 3rd Qu.:123.00 Max. :160.00 $org.data orgid org1 org2 zproduct Min. : 1.00 Min. :0.0000 Min. :0.0000 Min. :-2.680000 1st Qu.: 40.75 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:-0.587500 Median : 80.50 Median :0.0000 Median :0.0000 Median :-0.070000 Mean : 80.50 Mean :0.2313 Mean :0.1875 Mean : 0.002312 3rd Qu.:120.25 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.: 0.795000 Max. :160.00 Max. :1.0000 Max. :1.0000 Max. : 2.550000 free parameters: name matrix row col Estimate Std.Error A lbound 1 emp.A[1,3] A benefit female 0.055999595 0.02679455 2 emp.A[2,3] A cond female 0.064917267 0.02630574 3 emp.A[1,4] A benefit white -0.012236469 0.02635711 4 emp.A[2,4] A cond white -0.005352859 0.02582194 5 emp.S[1,1] S benefit benefit 2.161111608 0.02758684 6 emp.S[1,2] S benefit cond 1.478585050 0.02335033 7 emp.S[2,2] S cond cond 2.085667992 0.02661469 8 emp.M[1,1] M 1 benefit 4.836766587 0.04045267 9 emp.M[1,2] M 1 cond 5.106917208 0.03590320 10 b1 org.A Benefits zproduct 0.326460729 0.03084294 11 b2 org.A Conditions zproduct 0.307387693 0.02673404 12 org.A[2,4] org.A Benefits org1 0.273162419 0.07638925 13 org.A[3,4] org.A Conditions org1 0.302590624 0.06619074 14 a org.A zproduct org2 -0.451259163 0.20878066 ! 15 org.S[1,1] org.S zproduct zproduct 1.070589109 0.11902197 ! 16 org.S[2,2] org.S Benefits Benefits 0.130088123 0.01891452 17 org.S[2,3] org.S Benefits Conditions 0.092814715 0.01488461 18 org.S[3,3] org.S Conditions Conditions 0.090627982 0.01395353 19 org.M[1,1] org.M 1 zproduct 0.086922041 0.09043965 ubound 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 confidence intervals: lbound estimate ubound note org.indirect[1,1] -0.2915860 -0.1473184 -0.01223548 org.indirect[2,1] -0.2733024 -0.1387115 -0.01153194 CI details: parameter value side fit emp.A[1,3] emp.A[2,3] emp.A[1,4] 1 org.indirect[1,1] -0.29158595 lower 82005.4 0.05588957 0.06484114 -0.01295424 2 org.indirect[1,1] -0.01223548 upper 82005.4 0.05600523 0.06492112 -0.01220113 3 org.indirect[2,1] -0.27330240 lower 82005.4 0.05591836 0.06481253 -0.01278372 4 org.indirect[2,1] -0.01153194 upper 82005.4 0.05600372 0.06492254 -0.01221049 emp.A[2,4] emp.S[1,1] emp.S[1,2] emp.S[2,2] emp.M[1,1] emp.M[1,2] b1 1 -0.005844931 2.161093 1.478580 2.085669 4.837041 5.107104 0.3466142 2 -0.005328455 2.161112 1.478585 2.085668 4.836753 5.106908 0.3254486 3 -0.006097581 2.161101 1.478578 2.085669 4.836964 5.107212 0.3418809 4 -0.005317576 2.161112 1.478585 2.085667 4.836756 5.106902 0.3257003 b2 org.A[2,4] org.A[3,4] a org.S[1,1] org.S[2,2] org.S[2,3] 1 0.3216431 0.2728640 0.3023819 -0.84124075 1.093760 0.1306250 0.09317202 2 0.3066717 0.2731784 0.3026017 -0.03759573 1.096662 0.1300859 0.09281436 3 0.3237559 0.2729233 0.3022917 -0.84416186 1.094112 0.1304102 0.09314447 4 0.3065806 0.2731763 0.3026075 -0.03761470 1.096659 0.1300860 0.09281299 org.S[3,3] org.M[1,1] method diagnostic statusCode 1 0.09086559 0.160043162 neale-miller-1997 success OK 2 0.09062841 0.009362373 neale-miller-1997 success OK 3 0.09094941 0.160589153 neale-miller-1997 success OK 4 0.09062740 0.009364856 neale-miller-1997 success OK Model Statistics: | Parameters | Degrees of Freedom | Fit (-2lnL units) Model: 19 25031 82001.55 Saturated: NA NA NA Independence: NA NA NA Number of observations/statistics: 12605/25050 condition number of the information matrix: 185.7198 maximum absolute gradient: 0.01082699 ( org.S[2,3] ) chi-square: χ² ( df=NA ) = NA, p = NA Information Criteria: | df Penalty | Parameters Penalty | Sample-Size Adjusted AIC: 31939.55 82039.55 NA BIC: -154337.37 82180.95 82120.57 CFI: NA TLI: 1 (also known as NNFI) RMSEA: 0 [95% CI (NA, NA)] Prob(RMSEA <= 0.05): NA To get additional fit indices, see help(mxRefModels) timestamp: 2017-05-22 13:13:56 frontend time: 1.125414 secs backend time: 2.610823 mins independent submodels time: 4.196167e-05 secs cpu time: 157.7748 secs Wall clock time (HH:MM:SS.hh): 00:02:37.77 OpenMx version number: 2.7.11.44 Need help? See help(mxSummary) > > > proc.time() user system elapsed 181.256 0.264 166.011