semPlot Does Not Work with OpenMx 2.0
Posted on
rabil
Joined: 01/14/2010
Forums
Has any one else noticed that semPlot no longer works with OpenMx for version 2? I've used it to make path diagrams with versions of OpenMx before 2.0.
Is there a better tool for making path diagrams?
Me too!
The umx package will create a very nice .dot file for RAM models that can be turned into a .pdf with the free graphviz program: http://www.graphviz.org/ . The non-free Mac-only program OmniGraffle can also read in these .dot files and display them nicely.
My best hope is to fix semPlot in the next few months.
Log in or register to post comments
In reply to Me too! by mhunter
Update
I tried installing on R 3.2.2:
> devtools::install_github("sachaepskamp/semPlot")
but the install failed.
.
.
.
* installing *source* package ‘semPlot’ ...
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘car’
ERROR: lazy loading failed for package ‘semPlot’
* removing ‘/home/rick/R/x86_64-pc-linux-gnu-library/3.2/semPlot’
* restoring previous ‘/home/rick/R/x86_64-pc-linux-gnu-library/3.2/semPlot’
Error: Command failed (1)
In addition: Warning messages:
1: In utils::install.packages(pkgs, repos = repos, type = type, ..., :
installation of package ‘MatrixModels’ had non-zero exit status
2: In utils::install.packages(pkgs, repos = repos, type = type, ..., :
installation of package ‘quantreg’ had non-zero exit status
3: In utils::install.packages(pkgs, repos = repos, type = type, ..., :
installation of package ‘car’ had non-zero exit status
Log in or register to post comments
In reply to Update by rabil
Cool
install.packages(c('MatrixModels', 'quantreg', 'car'))
# then
devtools::install_github("sachaepskamp/semPlot")
That allowed this to work on my machine.
require(semPlot)
require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
factorModel <- mxModel("One Factor",
type="RAM",
manifestVars=manifests,
latentVars=latents,
mxPath(from=latents, to=manifests),
mxPath(from=manifests, arrows=2),
mxPath(from=latents, arrows=2, free=FALSE, values=1.0),
mxData(observed=cov(demoOneFactor), type="cov", numObs=500))
summary(factorRun <- mxRun(factorModel))
semPaths(factorRun, color = list(lat = rgb(245, 253, 118, maxColorValue = 255),
man = rgb(155, 253, 175, maxColorValue = 255)), mar = c(10, 5, 10, 5))
Log in or register to post comments
In reply to Cool by mhunter
Three other libraries needed (at least)
install.packages(c('MatrixModels', 'quantreg', 'car', 'RCurl', 'jsonlite', 'semTools'))
# then
devtools::install_github("sachaepskamp/semPlot")
It was also a bit R version dependent. Ok with R 3.2.2 but R 3.1 was messy. semPlot also installed many other things:
Installing 49 packages: acepack, arm, car, coda, corpcor, d3Network, DiagrammeR, doParallel, ellipse, fdrtool, foreach, Formula, ggm, glasso, gridBase, gridExtra, gtools, Hmisc, htmlwidgets, huge, igraph, irlba, iterators, jpeg, latticeExtra, lavaan, lisrelToR, lme4, MatrixModels, NMF, pkgmaker, plyr, png, psych, qgraph, quantreg, Rcpp, registry, rjson, rngtools, rockchalk, scales, sna, SparseM, stringi, tables, visNetwork, XML, xtable
But installation finally succeeded (though semTools was also needed). Problems remained however with running Hunter's script under R 3.2.2 on OS X Yosemite:
> semPaths(factorRun, color = list(lat = rgb(245, 253, 118, maxColorValue = 255),
+ man = rgb(155, 253, 175, maxColorValue = 255)), mar = c(10, 5, 10, 5))
Error in !object@matrices$M$free : invalid argument type
and now I am stuck too :(.
Log in or register to post comments
In reply to Three other libraries needed (at least) by neale
No model with means
Rabil noted semPlot has problems with intercepts, i.e. means. The only place I could find code that would generate your error message was inside an if() statement that required the means to be non-null. https://github.com/SachaEpskamp/semPlot/blob/5cb2b0303ceb454a270b8c61bfb360e4ca9ae8d1/R/OpenMx.R#L39
Log in or register to post comments
In reply to No model with means by mhunter
Fragile
https://github.com/SachaEpskamp/semPlot/commits/master
The July and early October versions work, but the ones since October 20th break things.
Do this.
devtools::install_github("sachaepskamp/semPlot", ref='aedbb4d61832882393a0eef77d4454626a79608b')
It installs the early October version.
Log in or register to post comments