R version 3.1.0 (2014-04-10) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-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. > # Sample data > # yi <- c(-0.264,-0.230,0.166,0.173,0.225,0.291,0.309,0.435,0.476,0.617,0.651,0.718,0.740,0.745,0.758,0.922,0.938,0.962,1.522,1.844) > # vi <- c(0.086,0.106,0.055,0.084,0.071,0.078,0.051,0.093,0.149,0.095,0.110,0.054,0.081,0.084,0.087,0.103,0.113,0.083,0.100,0.141) > > ## library(metaSEM) > ## metaSEM.model <- meta(y=yi, v=vi)$mx.model > > ###### mx model generated from metaSEM > # metaSEM.fit <- mxRun(metaSEM.model) > # summary(metaSEM.fit) > > > ###### mx model specified in OpenMx > # OpenMx.model <- mxModel("test", type="default", > # mxMatrix("Full", ncol=1, nrow=1, free=F, values=0, labels="data.vi", name="V"), > # mxMatrix("Full", ncol=1, nrow=1, free=T, values=0.1, lbound=0.0000001, name="Tau"), > # mxMatrix("Full", ncol=1, nrow=1, free=T, values=0, name="M"), > # mxAlgebra(V+Tau, name="S"), > # mxFitFunctionML(),mxExpectationNormal(covariance="S", means="M", dimnames=c("yi")), > # mxData(observed=cbind(yi,vi), type="raw") > #) > # OpenMx.fit <- mxRun(OpenMx.model) > # summary(OpenMx.fit) > > > ####### The above objects are stored in the test2.0.Rdata work space > library(OpenMx) Loading required package: digest Loading required package: MASS > > ## Load the work space to get the objects > load("test2.0.txt") > > ## Run the analysis based on metaSEM > metaSEM.fit <- mxRun(metaSEM.model) Running Meta analysis with ML > summary(metaSEM.fit) compute plan: MxComputeSequence 'compute' $freeSet : '.' steps[[ 1 ]] : MxComputeGradientDescent 'compute' $freeSet : '.' $engine : 'CSOLNP' $fitfunction : 'Meta analysis with ML.fitfunction' $verbose : 0 steps[[ 2 ]] : MxComputeNumericDeriv 'compute' $freeSet : '.' $fitfunction : 'Meta analysis with ML.fitfunction' $parallel : TRUE $stepSize : 1e-04 $iterations : 4 $verbose : 0 steps[[ 3 ]] : MxComputeStandardError 'compute' $freeSet : '.' steps[[ 4 ]] : MxComputeReportDeriv 'compute' $freeSet : '.' data: $`Meta analysis with ML.data` y1 v1_1 Min. :-0.2640 Min. :0.05100 1st Qu.: 0.2745 1st Qu.:0.08025 Median : 0.6340 Median :0.08650 Mean : 0.5999 Mean :0.09120 3rd Qu.: 0.7990 3rd Qu.:0.10375 Max. : 1.8440 Max. :0.14900 free parameters: name matrix row col Estimate Std.Error lbound ubound 1 Intercept1 Inter 1 1 0.5790347 NA 2 Tau2_1_1 Tau 1 1 0.1315197 NA 1e-10 observed statistics: 20 estimated parameters: 2 degrees of freedom: 18 -2 log likelihood: 27.79916 saturated -2 log likelihood: NA number of observations: 20 chi-square: NA p: NA Information Criteria: df Penalty Parameters Penalty Sample-Size Adjusted AIC: -8.200837 31.79916 NA BIC: -26.124018 33.79063 27.62514 CFI: NA TLI: NA RMSEA: NA timestamp: 2014-06-13 17:28:58 frontend time: 0.1531801 secs backend time: 0.007140875 secs independent submodels time: 6.604195e-05 secs wall clock time: 0.160387 secs cpu time: 0.160387 secs OpenMx version number: 2.0.0-3529 > > ## Run the analysis based on OpenMx > OpenMx.fit <- mxRun(OpenMx.model) Running test > summary(OpenMx.fit) compute plan: MxComputeSequence 'compute' $freeSet : '.' steps[[ 1 ]] : MxComputeGradientDescent 'compute' $freeSet : '.' $engine : 'CSOLNP' $fitfunction : 'test.fitfunction' $verbose : 0 steps[[ 2 ]] : MxComputeNumericDeriv 'compute' $freeSet : '.' $fitfunction : 'test.fitfunction' $parallel : TRUE $stepSize : 1e-04 $iterations : 4 $verbose : 0 steps[[ 3 ]] : MxComputeStandardError 'compute' $freeSet : '.' steps[[ 4 ]] : MxComputeReportDeriv 'compute' $freeSet : '.' data: $test.data yi vi Min. :-0.2640 Min. :0.05100 1st Qu.: 0.2745 1st Qu.:0.08025 Median : 0.6340 Median :0.08650 Mean : 0.5999 Mean :0.09120 3rd Qu.: 0.7990 3rd Qu.:0.10375 Max. : 1.8440 Max. :0.14900 free parameters: name matrix row col Estimate Std.Error lbound ubound 1 test.Tau[1,1] Tau 1 1 0.1315197 0.07353603 1e-07 2 test.M[1,1] M 1 yi 0.5790347 0.10510038 observed statistics: 20 estimated parameters: 2 degrees of freedom: 18 -2 log likelihood: 27.79916 saturated -2 log likelihood: NA number of observations: 20 chi-square: NA p: NA Information Criteria: df Penalty Parameters Penalty Sample-Size Adjusted AIC: -8.200837 31.79916 NA BIC: -26.124018 33.79063 27.62514 CFI: NA TLI: NA RMSEA: NA timestamp: 2014-06-13 17:28:58 frontend time: 0.05410981 secs backend time: 0.002701998 secs independent submodels time: 2.193451e-05 secs wall clock time: 0.05683374 secs cpu time: 0.05683374 secs OpenMx version number: 2.0.0-3529 > > ## Check their detailed outputs > metaSEM.fit$output $matrices $matrices$`Meta analysis with ML.Inter` [,1] [1,] 0.5790347 $matrices$`Meta analysis with ML.Beta` [,1] [1,] 0 $matrices$`Meta analysis with ML.X` [,1] [1,] 1 $matrices$`Meta analysis with ML.Tau` [,1] [1,] 0.1315197 $matrices$`Meta analysis with ML.V` [,1] [1,] 0.149 $matrices$`Meta analysis with ML.One` [,1] [1,] 1 $matrices$`Meta analysis with ML.V_het` [,1] [1,] 0.08486598 $algebras $algebras$`Meta analysis with ML.Beta1` [,1] [1,] 0.5790347 $algebras$`Meta analysis with ML.expMean` [,1] [1,] 0.5790347 $algebras$`Meta analysis with ML.expCov` [,1] [1,] 0.2805197 $algebras$`Meta analysis with ML.Tau_het` [,1] [1,] 0.1315197 $algebras$`Meta analysis with ML.I2_values` [,1] [1,] 0.6078022 $algebras$`Meta analysis with ML.fitfunction` [,1] [1,] 58.27221 attr(,"expCov") [,1] [1,] 0.2805197 attr(,"expMean") [,1] [1,] 0.5790347 $expectations $expectations[[1]] [1] TRUE attr(,"ExpCov") [,1] [1,] 0.2805197 attr(,"ExpMean") [,1] [1,] 0.5790347 attr(,"numStats") [1] NA $data $data[[1]] [1] 20 $calculatedHessian Intercept1 Tau2_1_1 Intercept1 -207769350869 144970978723 Tau2_1_1 144970978723 -404613761388 $gradient Intercept1 Tau2_1_1 3.872458e-06 -6.181722e-06 $hessian Intercept1 Tau2_1_1 Intercept1 -207769350869 144970978723 Tau2_1_1 144970978723 -404613761388 $computes $computes[[1]] [1] 2 $computes[[2]] $computes[[2]]$output $computes[[2]]$output$probeCount [1] 24 $fit [1] 27.79916 $Minus2LogLikelihood [1] 27.79916 $minimum [1] 27.79916 $estimate Intercept1 Tau2_1_1 0.5790347 0.1315197 $standardErrors [,1] Intercept1 NA Tau2_1_1 NA $infoDefinite [1] NA $conditionNumber [1] NA $status $status$code [1] 0 $status$status [1] 0 $iterations [1] 60 $evaluations [1] 60 $mxVersion [1] "2.0.0-3529" $frontendTime Time difference of 0.1531801 secs $backendTime Time difference of 0.007140875 secs $independentTime Time difference of 6.604195e-05 secs $wallTime Time difference of 0.160387 secs $timestamp [1] "2014-06-13 17:28:58 SGT" $cpuTime Time difference of 0.160387 secs > > OpenMx.fit$output $matrices $matrices$test.V [,1] [1,] 0.149 $matrices$test.Tau [,1] [1,] 0.1315197 $matrices$test.M [,1] [1,] 0.5790347 $algebras $algebras$test.S [,1] [1,] 0.2805197 $algebras$test.fitfunction [,1] [1,] 27.79916 attr(,"expCov") [,1] [1,] 0.2805197 attr(,"expMean") [,1] [1,] 0.5790347 $expectations $expectations[[1]] [1] TRUE attr(,"ExpCov") [,1] [1,] 0.2805197 attr(,"ExpMean") [,1] [1,] 0.5790347 attr(,"numStats") [1] NA $data $data[[1]] [1] 20 $calculatedHessian test.Tau[1,1] test.M[1,1] test.Tau[1,1] 371.31703 -16.31094 test.M[1,1] -16.31094 181.77602 $gradient test.Tau[1,1] test.M[1,1] -6.217249e-06 3.836931e-06 $hessian test.Tau[1,1] test.M[1,1] test.Tau[1,1] 371.31703 -16.31094 test.M[1,1] -16.31094 181.77602 $computes $computes[[1]] [1] 2 $computes[[2]] $computes[[2]]$output $computes[[2]]$output$probeCount [1] 24 $fit [1] 27.79916 $Minus2LogLikelihood [1] 27.79916 $minimum [1] 27.79916 $estimate test.Tau[1,1] test.M[1,1] 0.1315197 0.5790347 $standardErrors [,1] test.Tau[1,1] 0.07353603 test.M[1,1] 0.10510038 $infoDefinite [1] NA $conditionNumber [1] NA $status $status$code [1] 0 $status$status [1] 0 $iterations [1] 60 $evaluations [1] 60 $mxVersion [1] "2.0.0-3529" $frontendTime Time difference of 0.05410981 secs $backendTime Time difference of 0.002701998 secs $independentTime Time difference of 2.193451e-05 secs $wallTime Time difference of 0.05683374 secs $timestamp [1] "2014-06-13 17:28:58 SGT" $cpuTime Time difference of 0.05683374 secs > > > > proc.time() user system elapsed 0.852 0.044 0.851