Creates a plot of the relationships between two variables at different levels of the moderator. Only works for relationships that include an interaction.
condPlot(
out,
to,
from,
swap = FALSE,
avg = FALSE,
compare = NULL,
hist = FALSE,
xlab = NULL,
mods = NULL,
nsims = 500,
xn = NULL,
getCIs = FALSE,
discrete = FALSE,
ylab = NULL,
main = NULL,
midline = TRUE
)
Output from fitNetwork
or resample
.
Can also provide the fixedNets
or betweenNet
element of the
mlGVAR
output.
Outcome variable, specified with character string or numeric value.
Predictor variable, specified with character string or numeric value.
Logical. Serves to switch the arguments for to
and
from
.
Logical. If TRUE
then the average relationship between the
two variables is displayed. Only works for GGMs.
Two values can be supplied to indicate levels of the moderator to be compared.
Logical. Determines whether to show a histogram of the data distribution at the bottom of the plot.
Character string for labeling the x-axis.
This argument will be removed. Model output is automatically
detected based on fit
argument.
Number of iterations to simulate the posterior distribution.
Numeric value to indicate how many values of the moderator should be evaluated.
Logical. Only applies when avg = TRUE
. If getCIs =
TRUE
, then the confidence intervals for the average difference between the
maximum and minimum of the moderator will be returned.
Logical. Determines whether to treat the moderator as a discrete or continuous variable.
Character string for labeling the y-axis.
Character string for labeling the title of the plot.
Logical. Only applies when discrete = TRUE
. Shows a
line at the average level of the outcome.
A plot of the conditional effects of one variable on another given different levels of the moderator.
# NOT RUN {
fit <- fitNetwork(ggmDat, 'M')
condPlot(fit, to = 'V5', from = 'V4')
condPlot(fit, to = 2, from = 3, avg = TRUE)
# }
Run the code above in your browser using DataLab