`probe_interaction.Rd`

`probe_interaction`

is a convenience function that allows users to call
both `sim_slopes`

and `interact_plot`

with a single
call.

probe_interaction(model, pred, modx, mod2 = NULL, ...)

model | A regression model of type |
---|---|

pred | The predictor variable involved in the interaction. |

modx | The moderator variable involved in the interaction. |

mod2 | Optional. The name of the second moderator variable involved in the interaction. |

... | Other arguments accepted by |

The `sim_slopes`

object created.

The `ggplot`

object created by
`interact_plot`

.

This function simply merges the nearly-equivalent arguments needed to call
both `sim_slopes`

and `interact_plot`

without the
need for re-typing their common arguments. Note that each function is called
separately and they re-fit a separate model for each level of each
moderator; therefore, the runtime may be considerably longer than the
original model fit. For larger models, this is worth keeping in mind.

Sometimes, you may want different parameters when doing simple slopes analysis compared to when plotting interaction effects. For instance, it is often easier to interpret the regression output when variables are standardized; but plots are often easier to understand when the variables are in their original units of measure.

`probe_interaction`

does not
support providing different arguments to each function. If that is needed,
use `sim_slopes`

and `interact_plot`

directly.

Other interaction tools: `johnson_neyman`

,
`sim_slopes`

# Using a fitted model as formula input fiti <- lm(Income ~ Frost + Murder * Illiteracy, data=as.data.frame(state.x77)) probe_interaction(model = fiti, pred = Murder, modx = Illiteracy, modx.values = "plus-minus")#> Error in "svyglm" %in% class(model): object 'fiti' not found# 3-way interaction fiti3 <- lm(Income ~ Frost * Murder * Illiteracy, data=as.data.frame(state.x77)) probe_interaction(model = fiti3, pred = Murder, modx = Illiteracy, mod2 = Frost, mod2.values = "plus-minus")#> Error in "svyglm" %in% class(model): object 'fiti3' not found# With svyglm if (requireNamespace("survey")) { library(survey) data(api) dstrat <- svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat, fpc = ~fpc) regmodel <- svyglm(api00 ~ ell * meals + sch.wide, design = dstrat) probe_interaction(model = regmodel, pred = ell, modx = meals, modx.values = "plus-minus", cond.int = TRUE) # 3-way with survey and factor input regmodel3 <- svyglm(api00 ~ ell * meals * sch.wide, design = dstrat) probe_interaction(model = regmodel3, pred = ell, modx = meals, mod2 = sch.wide) # Can try different configurations of 1st vs 2nd mod probe_interaction(model = regmodel3, pred = ell, modx = sch.wide, mod2 = meals) }#> Error in "svyglm" %in% class(model): object 'regmodel' not found