umx
umx copied to clipboard
plot: detect paths that are definition variables and show label instead of value
Problem: plot shows the values on paths. But for label = "data.def", this is misleading (value is whatever the path was fixed at, and the path takes a subject-specific value...
Desired: plot.MxRamModel checks the label for each path, and, if it matches ^data\., shows this label on the path, even if pathLabels = values for the overall model.
note: relevant for #74, moderatedBy
It would be nice to have a defvar.row= argument so that any value in the dataset could be displayed. Another option would be to put the minimum & maximum values. Later on we can put a violin plot on it :).
This would be a test model
# Easier to add xy to data...
x = "disp"
y = "mpg"
def = "am"
dummy = paste0(x, "_by_", def)
m1 = umxRAM("def_test", data = mtcars,
umxPath(v.m. = c(x, y, def)),
umxPath(c(x, def), to = "mpg"),
umxPath(v0m0 = dummy), # latent called `x_by_def` with 0 variance and mean
umxPath(x, to = dummy, fixedAt= 0, label = paste0("data.", def)),
umxPath(dummy, to = y)
)