Learn R Programming

modelbased (version 0.7.0)

estimate_slopes: Estimate Marginal Effects

Description

Estimate the slopes (i.e., the coefficient) of a predictor over different factor levels. See also other related functions such as estimate_contrasts and estimate_means.

Usage

estimate_slopes(model, trend = NULL, levels = NULL, ci = 0.95, ...)

Arguments

model

A statistical model.

trend

A character vector indicating the name of the numeric variable for which to compute the slopes.

levels

A character vector indicating the variables over which the slope will be computed. If NULL (default), it will select all the remaining predictors.

ci

Uncertainty Interval (CI) level. Default to 95% (0.95).

...

Other arguments passed for instance to visualisation_matrix.

Value

A data.frame.

Examples

Run this code
# NOT RUN {
model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
slopes <- estimate_slopes(model, trend = "Petal.Length")
slopes
effectsize::standardize(slopes)
# }
# NOT RUN {
if (require("rstanarm")) {
  model <- stan_glm(Sepal.Width ~ Species * Petal.Length, data = iris, refresh = 0)
  estimate_slopes(model)
}
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab