After using omxGraphviz() to output a .Dot plot from my OpenMx model, I get a diagram of the model, but no parameter estimates are overlaid on the diagram. Is there a way to do this? Thanks in advance.
The OpenMx website will be down for maintenance from 9 AM EDT on Tuesday, September 17th, and is expected to return by the end of the day on Wednesday, September 18th. During this period, the backend will be updated and the website will get a refreshed look.
After using omxGraphviz() to output a .Dot plot from my OpenMx model, I get a diagram of the model, but no parameter estimates are overlaid on the diagram. Is there a way to do this? Thanks in advance.
This seems like a really reasonable and basic request.
In terms of SEM competition under R, both lavaan[sp] and sem 2.0 have nice reporting of graphical output with parameters, as well as comprehensive fit indices (inc. for example saturated fit for RAM models)
We have most of this now, and worth going extra metre or two to complete it.
getting omxGraphviz to include values on the path diagram is pretty straight forward.
An initial requirement given the current implementation is to modify
OpenMx:::matrixToPaths() and meansToPaths to include values
something like this would work
matrixToPaths <- function (mxMatrix, arrows = c(1, 2)) {
values <- mxMatrix@values
free <- mxMatrix@free
labels <- mxMatrix@labels
if (arrows == 2) {
values[upper.tri(values)] <- 0
free[upper.tri(free)] <- FALSE
labels[upper.tri(labels)] <- as.character(NA)
}
select <- (values != 0) | (free) | (!is.na(labels))
if (length(select) > 0) {
rowFactors <- row(values, as.factor = TRUE)
colFactors <- col(values, as.factor = TRUE)
fromNames <- as.character(colFactors[select])
toNames <- as.character(rowFactors[select])
pathValues <- values[select]
}
meansToPaths <- function (mxMatrix) {
if (is.null(mxMatrix))
return(list())
values <- mxMatrix@values
free <- mxMatrix@free
labels <- mxMatrix@labels
select <- (values != 0) | (free) | (!is.na(labels))
if (length(select) > 0) {
colFactors <- col(values, as.factor = TRUE)
toNames <- as.character(colFactors[select])
pathValues <- values[select]
}
Then modifying writeDotFile() to include "label = $value" in the paths as it creates them
happy to help code this
t
We could also expose some customization options, ala sem::pathDiagram
S3 method for class 'sem'
pathDiagram(model, file, min.rank=NULL, max.rank=NULL,
same.rank=NULL, variables=model$var.names, parameters=rownames(model$ram),
ignore.double=TRUE, edge.labels=c("names", "values", "both"),
size=c(8, 8), node.font=c("Helvetica", 14),
edge.font=c("Helvetica", 10), rank.direction=c("LR", "TB"),
digits=2, standardize=FALSE, output.type=c("graphics", "dot"),
graphics.fmt="pdf", dot.options=NULL, ...)
This would really enhance the facility to produce graphs. Hand editing the dot file is a pain and of course you have to redo it every time you change the model.
This would be a fantastic addition that would aid in visualizing one's model and would save considerable time. Please consider incorporating this, as it seems it's almost ready. Thanks guys for your willingness to listen to the user community!