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.35 [GIT v2.7.11-35-gf5f993a-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") + ) > > mxOption(NULL,"Default optimizer","CSOLNP") > ch4M3c <- mxRun(empModel, 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.055999495 0.02681013 2 emp.A[2,3] A cond female 0.064916789 0.02632151 3 emp.A[1,4] A benefit white -0.012236938 0.02637536 4 emp.A[2,4] A cond white -0.005353457 0.02583811 5 emp.S[1,1] S benefit benefit 2.161110996 0.02758667 6 emp.S[1,2] S benefit cond 1.478584558 0.02334917 7 emp.S[2,2] S cond cond 2.085667642 0.02661377 8 emp.M[1,1] M 1 benefit 4.836766358 0.04046636 9 emp.M[1,2] M 1 cond 5.106917175 0.03591687 10 b1 org.A Benefits zproduct 0.326459822 0.03087022 11 b2 org.A Conditions zproduct 0.307386841 0.02675401 12 org.A[2,4] org.A Benefits org1 0.273160969 0.07646874 13 org.A[3,4] org.A Conditions org1 0.302589736 0.06627584 14 a org.A zproduct org2 -0.451252409 0.20926232 15 org.S[1,1] org.S zproduct zproduct 1.070587105 0.12031190 ! 16 org.S[2,2] org.S Benefits Benefits 0.130087725 0.01891559 17 org.S[2,3] org.S Benefits Conditions 0.092814278 0.01488520 18 org.S[3,3] org.S Conditions Conditions 0.090627555 0.01395423 19 org.M[1,1] org.M 1 zproduct 0.086920130 0.09073668 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.2915861 -0.1473158 -0.01223550 org.indirect[2,1] -0.2733024 -0.1387091 -0.01153195 CI details: parameter value side fit emp.A[1,3] emp.A[2,3] emp.A[1,4] 1 org.indirect[1,1] -0.29158607 lower 82005.4 0.05588901 0.06484018 -0.01295492 2 org.indirect[1,1] -0.01223550 upper 82005.4 0.05600532 0.06492123 -0.01220089 3 org.indirect[2,1] -0.27330238 lower 82005.4 0.05591792 0.06481222 -0.01278296 4 org.indirect[2,1] -0.01153195 upper 82005.4 0.05600376 0.06492280 -0.01221037 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.005845630 2.161094 1.478580 2.085669 4.837043 5.107105 0.3466140 2 -0.005328596 2.161112 1.478585 2.085667 4.836752 5.106907 0.3254489 3 -0.006097408 2.161099 1.478577 2.085668 4.836964 5.107211 0.3418785 4 -0.005317164 2.161112 1.478585 2.085668 4.836756 5.106902 0.3256993 b2 org.A[2,4] org.A[3,4] a org.S[1,1] org.S[2,2] org.S[2,3] 1 0.3216430 0.2728608 0.3023800 -0.84124153 1.093758 0.1306253 0.09317213 2 0.3066718 0.2731799 0.3026029 -0.03759575 1.096662 0.1300853 0.09281383 3 0.3237534 0.2729257 0.3022929 -0.84416845 1.094113 0.1304102 0.09314412 4 0.3065797 0.2731772 0.3026078 -0.03761486 1.096659 0.1300856 0.09281254 org.S[3,3] org.M[1,1] method diagnostic statusCode 1 0.09086533 0.160045603 neale-miller-1997 success OK 2 0.09062809 0.009361075 neale-miller-1997 success OK 3 0.09094914 0.160594918 neale-miller-1997 success OK 4 0.09062698 0.009366430 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: 186.4223 maximum absolute gradient: 0.01644586 ( 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-18 13:12:03 frontend time: 2.331046 secs backend time: 2.701581 mins independent submodels time: 0.0002477169 secs cpu time: 164.4261 secs Wall clock time (HH:MM:SS.hh): 00:02:44.42 OpenMx version number: 2.7.11.35 Need help? See help(mxSummary) > > mxOption(NULL,"Default optimizer","SLSQP") > ch4M3s <- mxRun(empModel, intervals=TRUE) Running emp with 19 parameters > summary(ch4M3s,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.056000082 0.02679867 2 emp.A[2,3] A cond female 0.064917823 0.02630736 3 emp.A[1,4] A benefit white -0.012236936 0.02635986 4 emp.A[2,4] A cond white -0.005353141 0.02582576 5 emp.S[1,1] S benefit benefit 2.161111778 0.02758489 6 emp.S[1,2] S benefit cond 1.478585448 0.02334783 7 emp.S[2,2] S cond cond 2.085668972 0.02661272 8 emp.M[1,1] M 1 benefit 4.836765968 0.04045592 9 emp.M[1,2] M 1 cond 5.106916351 0.03590637 10 b1 org.A Benefits zproduct 0.326461705 0.03085410 11 b2 org.A Conditions zproduct 0.307387809 0.02674019 12 org.A[2,4] org.A Benefits org1 0.273165559 0.07647357 13 org.A[3,4] org.A Conditions org1 0.302591558 0.06626844 14 a org.A zproduct org2 -0.451250404 0.20879031 ! 15 org.S[1,1] org.S zproduct zproduct 1.070593703 0.11909921 16 org.S[2,2] org.S Benefits Benefits 0.130090020 0.01891509 17 org.S[2,3] org.S Benefits Conditions 0.092816335 0.01488473 18 org.S[3,3] org.S Conditions Conditions 0.090629311 0.01395369 19 org.M[1,1] org.M 1 zproduct 0.086923981 0.09041711 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.2913871 -0.1473160 -0.01239216 org.indirect[2,1] -0.2731313 -0.1387089 -0.01167088 CI details: parameter value side fit emp.A[1,3] emp.A[2,3] 1 org.indirect[1,1] -0.29138707 lower 82005.39 0.05588877 0.06484002 2 org.indirect[1,1] -0.01239216 upper 82005.39 0.05600639 0.06492312 3 org.indirect[2,1] -0.27313131 lower 82005.39 0.05591800 0.06481558 4 org.indirect[2,1] -0.01167088 upper 82005.39 0.05601330 0.06492011 emp.A[1,4] emp.A[2,4] emp.S[1,1] emp.S[1,2] emp.S[2,2] emp.M[1,1] 1 -0.01295367 -0.005844068 2.161095 1.478581 2.085670 4.837041 2 -0.01219885 -0.005326126 2.161111 1.478585 2.085666 4.836744 3 -0.01278934 -0.006099430 2.161099 1.478577 2.085669 4.836971 4 -0.01220814 -0.005317321 2.161115 1.478589 2.085670 4.836756 emp.M[1,2] b1 b2 org.A[2,4] org.A[3,4] a org.S[1,1] 1 5.107104 0.3465840 0.3216222 0.2728653 0.3023834 -0.84074003 1.093707 2 5.106900 0.3254352 0.3066624 0.2731862 0.3026089 -0.03807875 1.096580 3 5.107214 0.3418557 0.3237337 0.2729249 0.3022978 -0.84369125 1.094032 4 5.106902 0.3256998 0.3065743 0.2731196 0.3025912 -0.03806868 1.096612 org.S[2,2] org.S[2,3] org.S[3,3] org.M[1,1] method diagnostic 1 0.1306253 0.09317269 0.09086625 0.159950031 neale-miller-1997 success 2 0.1300854 0.09281488 0.09062949 0.009452588 neale-miller-1997 success 3 0.1304108 0.09314462 0.09095010 0.160504728 neale-miller-1997 success 4 0.1300847 0.09281311 0.09062747 0.009447501 neale-miller-1997 success statusCode 1 OK 2 OK 3 OK 4 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: 186.28 maximum absolute gradient: 0.006679667 ( org.S[3,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-18 13:17:53 frontend time: 1.27888 secs backend time: 5.805976 mins independent submodels time: 4.1008e-05 secs cpu time: 349.6375 secs Wall clock time (HH:MM:SS.hh): 00:05:49.63 OpenMx version number: 2.7.11.35 Need help? See help(mxSummary) > > mxOption(NULL,"Default optimizer","NPSOL") > ch4M3n <- mxRun(empModel, intervals=TRUE) Running emp with 19 parameters > summary(ch4M3n,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.056015178 0.02680579 ! 2 emp.A[2,3] A cond female 0.064933091 0.02631898 ! 3 emp.A[1,4] A benefit white -0.012217535 0.02636453 ! 4 emp.A[2,4] A cond white -0.005333976 0.02583072 ! 5 emp.S[1,1] S benefit benefit 2.161110419 0.02758572 6 emp.S[1,2] S benefit cond 1.478581559 0.02334799 7 emp.S[2,2] S cond cond 2.085661983 0.02661223 8 emp.M[1,1] M 1 benefit 4.836684742 0.04045418 ! 9 emp.M[1,2] M 1 cond 5.106862620 0.03590733 10 b1 org.A Benefits zproduct 0.326449350 0.03085593 11 b2 org.A Conditions zproduct 0.307376232 0.02674145 ! 12 org.A[2,4] org.A Benefits org1 0.273202941 0.07638811 ! 13 org.A[3,4] org.A Conditions org1 0.302622560 0.06620461 ! 14 a org.A zproduct org2 -0.451260817 0.20872245 ! 15 org.S[1,1] org.S zproduct zproduct 1.070579898 0.11956483 ! 16 org.S[2,2] org.S Benefits Benefits 0.130074228 0.01891344 17 org.S[2,3] org.S Benefits Conditions 0.092804912 0.01488379 18 org.S[3,3] org.S Conditions Conditions 0.090620722 0.01395286 19 org.M[1,1] org.M 1 zproduct 0.086920350 0.09044496 ! 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.2875396 -0.1473138 -0.01533348 org.indirect[2,1] -0.2701850 -0.1387068 -0.12876117 CI details: parameter value side fit emp.A[1,3] emp.A[2,3] 1 org.indirect[1,1] -0.28753959 lower 82005.40 0.05248402 0.06029938 2 org.indirect[1,1] -0.01533348 upper 82005.40 0.05752470 0.06871983 3 org.indirect[2,1] -0.27018496 lower 82005.40 0.05651484 0.06646104 4 org.indirect[2,1] -0.12876117 upper 82005.47 0.06884311 0.06506154 emp.A[1,4] emp.A[2,4] emp.S[1,1] emp.S[1,2] emp.S[2,2] emp.M[1,1] 1 -0.01313708 -0.005964219 2.160106 1.477222 2.083757 4.838009 2 -0.01352160 -0.006094103 2.162015 1.480005 2.087804 4.845832 3 -0.01418739 -0.007035469 2.162277 1.479468 2.086724 4.843361 4 -0.01675356 -0.005261963 2.160666 1.477852 2.085652 4.837546 emp.M[1,2] b1 b2 org.A[2,4] org.A[3,4] a org.S[1,1] 1 5.108927 0.3348786 0.3133856 0.2742076 0.3030644 -0.85863818 1.095194 2 5.111875 0.3247604 0.3060912 0.2642315 0.2962695 -0.04721473 1.094949 3 5.110839 0.3330585 0.3178044 0.2670689 0.2978279 -0.85016118 1.096466 4 5.106520 0.3253572 0.3128489 0.2736714 0.3027676 -0.41157617 1.070688 org.S[2,2] org.S[2,3] org.S[3,3] org.M[1,1] method diagnostic 1 0.1297370 0.09285591 0.09075885 0.16636153 neale-miller-1997 success 2 0.1353966 0.09635267 0.09302136 0.01265844 neale-miller-1997 success 3 0.1263802 0.09001617 0.08834204 0.15907094 neale-miller-1997 success 4 0.1337550 0.09849067 0.09030218 0.08701236 neale-miller-1997 success statusCode 1 nonzero gradient 2 nonzero gradient 3 nonzero gradient 4 nonzero gradient 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.874 maximum absolute gradient: 0.1602255 ( emp.M[1,1] ) 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-18 13:24:05 frontend time: 0.07350421 secs backend time: 6.181051 mins independent submodels time: 4.315376e-05 secs cpu time: 370.9366 secs Wall clock time (HH:MM:SS.hh): 00:06:10.93 OpenMx version number: 2.7.11.35 Need help? See help(mxSummary) > > #imxRobustSE(ch4M3) > > proc.time() user system elapsed 1004.152 0.660 892.332