Nonparametric estimation of marginal effects using an ocf object.

marginal_effects(
  object,
  data = NULL,
  which_covariates = c(),
  eval = "atmean",
  bandwitdh = 0.1,
  inference = FALSE
)

Arguments

object

An ocf object.

data

Data set of class data.frame to estimate marginal effects. It must contain at least the same covariates used to train the forests. If NULL, marginal effects are estimated on object$full_data.

which_covariates

Character vector storing the names of the covariates for which marginal effect estimation is desired. If empty (the default), marginal effects are estimated for all covariates.

eval

Evaluation point for marginal effects. Either "mean", "atmean" or "atmedian".

bandwitdh

How many standard deviations x_up and x_down differ from x.

inference

Whether to extract weights and compute standard errors. The weights extraction considerably slows down the program.

Value

Object of class ocf.marginal.

Details

marginal_effects can estimate mean marginal effects, marginal effects at the mean, or marginal effects at the median, according to the eval argument.

The routine assumes that covariates with more than ten unique values are continuous. Otherwise, covariates are assumed to be discrete.

References

  • Di Francesco, R. (2023). Ordered Correlation Forest. arXiv preprint arXiv:2309.08755.

See also

Author

Riccardo Di Francesco

Examples