conditionalEffectsPlot: Plot conditional effects

View source: R/elr_plot_condeffects.R

conditionalEffectsPlotR Documentation

Plot conditional effects

Description

Can be used to make a conditional effects plot with an effect function on the y axis and a covariate on the x axis. ggplot2 is used to create the plot.

Usage

conditionalEffectsPlot(
  obj,
  zsel = "id",
  gxsel = "g1",
  colour = "",
  show.ci = FALSE,
  regression = "default",
  regression.ci = FALSE
)

Arguments

obj

Object of class effectlite obtained from fitting an effect model using effectLite

zsel

Name of a covariate (character string) plotted on the x-axis. If "id" (the default) the subject index is shown on the x-axis, where subjects in the data are enumerated as 1:nrow(data).

gxsel

Name of an effect function (character string) plotted on the y-axis.

colour

Name of a covariate (character string) used as colour variable in the plot.

show.ci

Logical. Should 95 percent confidence intervals around conditional effects be shown in the plot.

regression

Specifies if a regression line should be drawn. Can be one of c("default","smooth","linear","none")

regression.ci

Logical. Will be passed on to geom_smooth and specifies its se argument. Notice that the confidence interval shown by geom_smooth does not take uncertainty into account that comes from estimating the values of the conditional effects on the y axis.

Value

Object of class c("gg", "ggplot").

Examples

m1 <- effectLite(y="dv", x="x", k="k1", z="z1", control="control", data=example01)
conditionalEffectsPlot(m1, zsel="z1", gxsel="g1", colour="k1")


EffectLiteR documentation built on July 9, 2023, 7:02 p.m.