mitun: Numerical moderation graph and summary

View source: R/mitun.R

mitunR Documentation

Numerical moderation graph and summary

Description

This function really does it all. It will generate both a ggplot graph, slopes&intercepts and a summary!

Usage

mitun(DV, x.pred, x.mod, sdH = 1, sdM = 0, sdL = -1)

Arguments

DV

The dependent variable.

x.pred

The predictor variable.

x.mod

The moderator variable.

sdH

Leave untouched, unless you wish to generate a different SD moderation. Positive sd mod.

sdM

Leave untouched, unless you wish to generate a different SD moderation. Mean of moderator.

sdL

Leave untouched, unless you wish to generate a different SD moderation.Negative sd mod.

sdH/M/L

refer to SD level of the moderator. feel free to explore, but default is best for analsys.

Value

ggplot graph.

lm model summary.

intercepts and slopes for each level of moderator.

Note

The moderator MUST be numeric. This function works for a simple moderation model.

See Also

jtools or interactions for more options.

https://cran.r-project.org/web/packages/jtools/jtools.pdf

https://cran.r-project.org/web/packages/interactions/interactions.pdf

Examples


mitun(depression,suicide_tendencies,optimism)

# Depression is predicted by suicide tendencies, while optimism levels moderate the relationship between them.
## Not run: mitun(..., sdH=2,sdL=-2)
# In this example, the graph will generate moderation of SD=+2, mean(sdM=0), and SD=-2 in the moderator variable.


bgupsych/bgupsych documentation built on Nov. 1, 2023, 9:41 a.m.