mod_pa <-
'x1 ~~ x2
x3 ~ x1 + x2
x4 ~ x1 + x3
'
fit_pa <- lavaan::sem(mod_pa, pa_example)
lavaan::parameterEstimates(fit_pa)[, c("lhs", "op", "rhs", "est", "pvalue")]
m <- matrix(c("x1", NA, NA,
NA, "x3", "x4",
"x2", NA, NA), byrow = TRUE, 3, 3)
p_pa <- semPlot::semPaths(fit_pa, whatLabels="est",
style = "ram",
nCharNodes = 0, nCharEdges = 0,
layout = m)
my_rotate_resid_vector <- c(x3 = 45, x4 = -45)
p_pa2v <- rotate_resid(p_pa, my_rotate_resid_vector)
plot(p_pa2v)
my_rotate_resid_list <- list(list(node = "x3", rotate = 45),
list(node = "x4", rotate = -45))
p_pa2l <- rotate_resid(p_pa, my_rotate_resid_list)
plot(p_pa2l)
Run the code above in your browser using DataLab