Skip to contents

Counterfactual marginal effects from fitted distributional parameters

Usage

marginal_effects(
  object,
  newdata,
  variable,
  values = NULL,
  parameter = "mu",
  reference = NULL,
  se.fit = FALSE,
  level = 0.95,
  vcov_method = "analytical",
  ...
)

Arguments

object

A fitted gamlss.longitudinal object.

newdata

Data used as the counterfactual baseline.

variable

Single variable to vary.

values

Values to assign to variable. Defaults to observed factor levels for factors/characters or the 25th, 50th, and 75th percentiles for numeric variables.

parameter

Distributional parameter to summarize, usually "mu".

reference

Optional reference value. Defaults to the first value.

se.fit

Logical; when TRUE and parameter = "mu", attach approximate delta-method standard errors for response-scale averages.

level

Confidence level used when se.fit = TRUE.

vcov_method

Variance-covariance method passed to vcov.gamlss.longitudinal().

...

Additional arguments passed to predict.gamlss.longitudinal().

Value

A data frame with average fitted parameter values and contrasts.