Description Usage Arguments Details Value Examples
Plot the moderation effect in a path model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | plotmod(
fit,
y,
x,
w,
xw,
x_label,
w_label,
y_label,
title,
a_shift = 0,
expansion = 0.1,
standardized = FALSE,
digits = 3,
x_from_mean_in_sd = 1,
w_from_mean_in_sd = 1,
w_method = "sd",
w_percentiles = c(0.16, 0.84),
x_method = "sd",
x_percentiles = c(0.16, 0.84),
w_sd_to_percentiles,
x_sd_to_percentiles,
plot_x_vlines,
x_vlines_unit = "sd"
)
|
fit |
The output from lavaan::lavaan or its wrapper, such as lavaan::sem. |
y |
The name of the outcome variable as in the data set in |
x |
The name of the focal variable as in the data set in
It
can be the name of the variable, with or without quotes. |
w |
The name of the moderator as in the data set in |
xw |
The name of the product term, |
x_label |
The label for the X-axis. Default is the vlaues of |
w_label |
The label for the legend for the lines. Default is the value of |
y_label |
The label for the Y-axis. Default is the value of |
title |
The title of the graph. If not supplied, will be generated from the variable names. |
a_shift |
Default is 0. Can be ignored for now. |
expansion |
How much tha lower and upper limits of the axis will be adjusted. |
standardized |
Logical. Plot the moderation effect in standardized metric. All three
variables, |
digits |
Number of decimal digits to print. Default is 3. |
x_from_mean_in_sd |
How many SD from mean is used to define "low" and "high" for the focal variable. Default is 1. |
w_from_mean_in_sd |
How many SD from mean is used to define "low" and "high" for the moderator. Default is 1. |
w_method |
How to define "high" and "low" for the moderator levels. Default is in terms of the standard deviation of the moderator, "sd". If equal to "percentile", then percentiles of the moderator in the dataset is used. |
w_percentiles |
If |
x_method |
How to define "high" and "low" for the focal variable levels. Default is in terms of the standard deviation of the focal variable, "sd". If equal to "percentile", then percentiles of the focal variable in the dataset is used. |
x_percentiles |
If |
w_sd_to_percentiles |
If |
x_sd_to_percentiles |
If |
plot_x_vlines |
If supplied, vertical lines to indicate the levels of
the focal variable will be plotted. This should be a
vector of numbers, indicating the levels to be plotted.
How these numbers are interpreted depends on
|
x_vlines_unit |
If equal to "sd", then the values of |
This function extracts the information stored
in the lavaan
fit object to plot a two-line
graph, one for the relation between the focal variale (x
) and
the outcome variable (y
) when the moderator (w
) is one stanard
deviation below mean, and one when the moderator is one standard
deviation above mean.
A ggplot2 graph.
1 2 3 4 | ## Not run:
# To be prepared
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.