elrEffects: Average and conditional effects based on generalized linear...

View source: R/elrEffects.R

elrEffectsR Documentation

Average and conditional effects based on generalized linear models

Description

This function can be used to estimate average and conditional effects of a treatment variable on an outcome variable, taking into account any number of continuous and categorical covariates. It takes a user defined generalized linear model (or another statistical model with a suitable predict method) as input and computes the corresponding effects.

Usage

elrEffects(object, x, from = 0, to = 1, type = "difference", subset. = NULL)

Arguments

object

User defined generalized linear model (or another statistical model with a suitable predict method)

x

Treatment variable (character string)

from

from and to (values of treatment variable) specify the considered change in the treatment variable for the effect computation

to

from and to (values of treatment variable) specify the considered change in the treatment variable for the effect computation

type

character. Indicates the type of effect considered. Can be one of "ATE" (with aliases "difference" and "Average Treatment Effect" and "Average of Differences"), "SRA" (with alias "Simple Ratio of Averages"), or "ORA" (with alias "Odds Ratio of Averages"), "ASR" (with aliases "ratio" and "Average of Simple Ratios"), "AOR" (with aliases "oddsratio" and "Average of Odds Ratios").

subset.

Logical vector for computing effects in a subset of the data (conditional effects).

Value

Object of class elreffects

Examples

## Example with a logistic regression
m1logreg <- glm(y ~ x+z1+z2+k1+k2, data=elrdata_logreg,  family=binomial)
elrEffects(m1logreg, "x", from="0", to="1", type="difference", subset.=NULL)

EffectLiteR documentation built on Sept. 11, 2024, 5:16 p.m.