It plots the models from either the lavaan model or meta, wls,
osmasem, and sem (mxsem) objects.
# S3 method for meta
plot(x, effect.sizes, add.margin = 0.1, interval = 0.95,
main = "Effect Sizes and their Confidence Ellipses",
axis.labels = paste("Effect size ", effect.sizes,
sep = ""), study.col = "black", study.pch = 19,
study.min.cex = 0.8, study.weight.plot = FALSE,
study.ellipse.plot = TRUE, study.ellipse.col = "black",
study.ellipse.lty = 2, study.ellipse.lwd = 0.5,
estimate.col = "blue", estimate.pch = 18, estimate.cex = 2,
estimate.ellipse.plot = TRUE, estimate.ellipse.col = "red",
estimate.ellipse.lty = 1, estimate.ellipse.lwd = 2,
randeff.ellipse.plot = TRUE, randeff.ellipse.col = "green",
randeff.ellipse.lty = 1, randeff.ellipse.lwd = 2,
univariate.plot = TRUE, univariate.lines.col = "gray",
univariate.lines.lty = 3, univariate.lines.lwd = 1,
univariate.polygon.width = 0.02, univariate.polygon.col = "red",
univariate.arrows.col = "green", univariate.arrows.lwd = 2,
diag.panel = FALSE, xlim = NULL, ylim = NULL, ...)
# S3 method for character
plot(x, fixed.x = FALSE, nCharNodes = 0, nCharEdges = 0,
layout = c("tree", "circle", "spring", "tree2",
"circle2"), sizeMan = 8, sizeLat = 8, edge.label.cex = 1.3,
color = "white", ...)
# S3 method for wls
plot(x, manNames = NULL, latNames = NULL, labels = c("labels",
"RAM"), what = "est", nCharNodes = 0, nCharEdges = 0,
layout = c("tree", "circle", "spring", "tree2",
"circle2"), sizeMan = 8, sizeLat = 8, edge.label.cex = 1.3,
color = "white", weighted = FALSE, ...)
# S3 method for osmasem
plot(x, manNames = NULL, latNames = NULL, labels = c("labels",
"RAM"), what = "est", nCharNodes = 0, nCharEdges = 0,
layout = c("tree", "circle", "spring", "tree2",
"circle2"), sizeMan = 8, sizeLat = 8, edge.label.cex = 1.3,
color = "white", weighted = FALSE, ...)
# S3 method for osmasem2
plot(x, manNames = NULL, latNames = NULL, labels = c("labels",
"RAM"), what = "est", nCharNodes = 0, nCharEdges = 0,
layout = c("tree", "circle", "spring", "tree2",
"circle2"), sizeMan = 8, sizeLat = 8, edge.label.cex = 1.3,
color = "white", weighted = FALSE, ...)
# S3 method for mxsem
plot(x, manNames = NULL, latNames = NULL, labels = c("labels",
"RAM"), what = "est", nCharNodes = 0, nCharEdges = 0,
layout = c("tree", "circle", "spring", "tree2",
"circle2"), sizeMan = 8, sizeLat = 8, edge.label.cex = 1.3,
color = "white", weighted = FALSE, group = NULL,
level = NULL, combine = missing(group) && missing(level),
main.line = 2.5, main.adj = NULL, ...)An object returned from either a lavaan model class
character, osmasem, osmasem3L, wls or
meta
Numeric values indicating which effect sizes to be
plotted. At least two effect sizes are required. To plot the effect sizes of
\(y_1\) and \(y_2\), one may use effect.sizes=c(1,2). If
it is missing, all effect sizes will be plotted in a pairwise way.
Value for additional margins on the left and bottom margins.
Interval for the confidence ellipses.
Main title of each plot. If there are multiple plots, a vector of character titles may be used.
Labels for the effect sizes.
The color for individual studies. See col in
par.
Plotting character of individual studies. See pch in
points.
The minimum value of cex for individual studies. See
cex in par.
Logical. If TRUE, the plotting size of
individual studies (cex) will be proportional to one over the square root of
the determinant of the sampling covariance matrix of the study.
Logical. If TRUE, the confidence ellipses
of individual studies are plotted.
The color of the confidence ellipses of individual
studies. See col in par.
The line type of the confidence ellipse of
individual studies. See lty in par.
The line width of the confidence ellipse of
individual studies. See lwd in par.
The color of the estimated effect size. See col
in par.
Plotting character of the estimated effect sizes. See
pch in points.
The amount of plotting of the estimated effect sizes.
See cex in par.
Logical. If TRUE, the confidence ellipse
of the estimated effect sizes will be plotted.
The color of the confidence ellipse of the
estimated effect sizes. See col in par.
The line type of the confidence ellipse of the
estimated effect sizes. See lty in par.
The line width of the confidence ellipse of the
estimated effect sizes. See lwd in par.
Logical. If TRUE, the confidence ellipses
of the random effects will be plotted.
Color of the confidence ellipses of the random
effects. See col in par.
The line type of the confidence ellipses of the
random effects. See lty in par.
The line width of the confidence ellipses of the
random effects. See lwd in par.
Logical. If TRUE, the estimated univariate
effect sizes will be plotted.
The color of the estimated univariate effect
sizes. See col in par.
The line type of the estimated univariate effect
sizes. See lty in par.
The line width of the estimated univariate
effect sizes. See lwd in par.
The width of the polygon of the estimated univariate effect sizes.
The color of the polygon of the estimated univariate effect sizes.
The color of the arrows of the estimated univariate effect sizes.
The line width of the arrows of the estimated univariate effect sizes.
Logical. If TRUE, diagonal panels will be created.
They can then be used for forrest plots for univariate meta-analysis.
NULL or a numeric vector of length 2; if it is NULL, it provides defaults estimated from the data.
NULL or a numeric vector of length 2; if it is NULL, it provides defaults estimated from the data.
Argument passed to semPlotModel.
Names of the observed nodes, in the row order of the RAM
filter matrix F. If
NULL, names from the fitted model are used.
Names of the latent nodes, in RAM variable order. If
NULL, names from the fitted model are used.
For path diagrams, either labels (the default) to
use parameter labels, or RAM to use RAM matrix notation.
Argument passed to semPaths
Argument passed to semPaths
Argument passed to semPaths
Argument passed to semPaths
Argument passed to semPaths
Argument passed to semPaths
Argument passed to semPaths
Argument passed to semPaths
Argument passed to semPaths
For plot.mxsem on a multiple-group sem fit
(see sem): which group to plot. The original data
value (e.g. "site-2", before any sanitizing into a legal
mxModel name) always takes precedence over the
possibly-sanitized submodel name, via fit$group.map; the
sanitized submodel name itself (names(fit$mx.fit@submodels)) only
resolves to the matching group when it does not also collide with a
different group's original value (e.g. original groups
"a.b" and "a_b" both sanitize/map to a submodel named
"a_b" or derived from it -- passing "a_b" always means the
group whose real data value is "a_b", never the submodel merely
named that). When originals and submodel names coincide (the common
case, e.g. "g1"), either happens to work, but the original value
is the one to reach for. Defaults to the first group. In a combined
group and two-level fit, it selects the group whose level is
plotted. Ignored otherwise.
For plot.mxsem on a two-level or combined group and
two-level sem fit (see sem): either
"within" (default) or "between", selecting which level to
plot. In the between-level diagram, the between components of level-1
variables and the cluster-level observed covariates are drawn as observed
variables. Ignored otherwise
(including when combine=TRUE). semPlot has no notion of
the two levels' relational (joinKey) linkage, so only one level's
diagram is shown at a time even when combined (below) into one figure.
For plot.mxsem on a multiple-group or two-level
sem fit: if TRUE, plot every group (or both the
within and between levels) as side-by-side panels of one
figure, overriding group/level. For a combined group and
two-level fit, each group is a row with its within and between panels. Defaults to TRUE
when neither group nor level is supplied, and to
FALSE (one diagram, as selected by group/level) as
soon as either of them is -- so plot(fit) shows every panel by
default, but plot(fit, group="g2") or plot(fit,
level="between") still shows just the one diagram requested without
needing combine=FALSE as well. Passing combine=TRUE
explicitly still shows every panel regardless of group/level.
Ignored otherwise.
For plot.mxsem on a multiple-group or two-level
sem fit: the line argument passed to
title for each panel's "within"/
"between" or group-name title. Defaults to 2.5 (pushed up
and out of the way of a variance-edge label that semPaths often
draws close to the top margin). Ignored otherwise.
For plot.mxsem on a multiple-group or two-level
sem fit: the adj argument passed to
title for each panel's title, controlling its
horizontal position (0 = left-aligned, 0.5 = centered,
1 = right-aligned). Defaults to NULL, i.e. title's
own default (centered). Since the title is drawn over the diagram rather
than reserving its own space, it can still land on top of an edge label
that happens to sit centered near the top of that particular model's
diagram; nudge it clear with e.g. main.adj=0.8 (or 1 for
fully right-aligned) if so. Ignored otherwise.
Further arguments passed to the methods.
Mike W.-L. Cheung <[email protected]>
For mxsem objects, a path set by a definition variable
(data.*), either directly or through a constraint substituted with
replace.constraints=TRUE, is shown at the mean of the variable in
the level-1 data of the group plotted. It is not shown for summary input,
which has no definition variables. In estimate and standardized diagrams,
exactly zero paths use a tiny nonzero graphical weight so they remain
visible; the fitted model's estimates are unchanged. The filter matrix F
must select distinct observed variables for these plots.
For osmasem and osmasem2 objects, matrices and implied
covariances are evaluated at the means of definition variables in the
fitted data, after any row selection. For older osmasem2 objects
without a saved RAM specification, matrix names are recovered from
Fmatrix.
Cheung, M. W.-L. (2013). Multivariate meta-analysis as structural equation models. Structural Equation Modeling, 20, 429-454.
Berkey98, wvs94a
meta2semPlot semPaths
# \donttest{
## lavaan model
model <- "y ~ m + x
m ~ x"
plot(model)
# }
Run the code above in your browser using DataLab