condPlot {modnets}R Documentation

Conditional effects plot

Description

Creates a plot of the relationships between two variables at different levels of the moderator. Only works for relationships that include an interaction.

Usage

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
)

Arguments

out

Output from fitNetwork or resample. Can also provide the fixedNets or betweenNet element of the mlGVAR output.

to

Outcome variable, specified with character string or numeric value.

from

Predictor variable, specified with character string or numeric value.

swap

Logical. Serves to switch the arguments for to and from.

avg

Logical. If TRUE then the average relationship between the two variables is displayed. Only works for GGMs.

compare

Two values can be supplied to indicate levels of the moderator to be compared.

hist

Logical. Determines whether to show a histogram of the data distribution at the bottom of the plot.

xlab

Character string for labeling the x-axis.

mods

This argument will be removed. Model output is automatically detected based on fit argument.

nsims

Number of iterations to simulate the posterior distribution.

xn

Numeric value to indicate how many values of the moderator should be evaluated.

getCIs

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.

discrete

Logical. Determines whether to treat the moderator as a discrete or continuous variable.

ylab

Character string for labeling the y-axis.

main

Character string for labeling the title of the plot.

midline

Logical. Only applies when discrete = TRUE. Shows a line at the average level of the outcome.

Value

A plot of the conditional effects of one variable on another given different levels of the moderator.

See Also

fitNetwork, resample

Examples


fit <- fitNetwork(ggmDat, 'M')
condPlot(fit, to = 'V5', from = 'V4')
condPlot(fit, to = 2, from = 3, avg = TRUE)


[Package modnets version 0.9.0 Index]