SachaEpskamp / semPlot

Path diagrams and visual analysis of various SEM packages' output
GNU General Public License v2.0
61 stars 20 forks source link

Latent variable sitting on top of path #17

Closed VectorPosse closed 5 years ago

VectorPosse commented 6 years ago

I am trying to "trick" semPaths into showing me a latent variable for the error term. Unfortunately, the function is placing the latent error circle right on top of another path. Here's a minimal reprex:

library(lavaan)
library(semPlot)
model <- "
  mpg ~ hp
  error =~ mpg
"
fit <- sem(model, data = mtcars)
semPaths(fit)

I've played around with a bunch of different parameter settings, but I can't get it to move. I'd rather not have to manually set up a custom layout.

SachaEpskamp commented 5 years ago

This is a way to get what you want:

mod <- semPlotModel(fit)
mod@Vars$exogenous <- FALSE
semPaths(mod)