Learn R Programming

EffectLiteR (version 0.5-1)

elrEffects: 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)

Value

Object of class elreffects

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).

Examples

Run this code
## 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)

Run the code above in your browser using DataLab