dfee: Marginal First-Exposure Effects

View source: R/dfee.r

dfeeR Documentation

Marginal First-Exposure Effects

Description

Computes marginal first-exposure effects from a fitted oneinfl model. Dummy variables are automatically detected as those with exactly two unique values in the data, and corresponding marginal effects are instead calculated by differencing the FEE between both values of the dummy.

Usage

dfee(model, data, at = "AE")

Arguments

model

A fitted model object of class "oneinfl".

data

A data frame containing the variables used to fit the model.

at

A character string or list. Specifies where the marginal FEE should be evaluated. Options are "AE" (average), "EM" (means), or a named list of covariate values.

Details

The marginal effects can be evaluated in three ways, determined by the at argument:

  • "AE": Average over all data points (default).

  • "EM": Evaluate at the sample means of the covariates.

  • list: Evaluate at a user-specified set of covariate values.

Value

A list with components:

dfee

A named numeric vector of estimated marginal first-exposure effects for each variable.

sefee

A numeric vector of standard errors corresponding to the marginal effects.

where

A character string describing the evaluation point.

See Also

fee, dfee_pois, dfee_nb

Examples

df <- data.frame(x = runif(10,0,10), d = sample(c(0,1), 10, replace=TRUE), y = rpois(10, 3) + 1)
model <- oneinfl::oneinfl(formula = y ~ x + d | x + d, df = df, dist = "Poisson")
dfee(model, data = df)


fee documentation built on Aug. 8, 2025, 7:45 p.m.

Related to dfee in fee...