iptw_pipeline: Estimate the DID g-formula using...

View source: R/iptw.R

iptw_pipelineR Documentation

Estimate the DID g-formula using inverse-probability-of-treatment-weights.

Description

Estimate the DID g-formula using inverse-probability-of-treatment-weights.

Usage

iptw_pipeline(
  data,
  Tt,
  den_formula,
  num_formula = NULL,
  tibble = TRUE,
  pt_link_fun = NULL,
  binomial_n = 1,
  models = TRUE
)

Arguments

data

Wide format data frame with one row per individual, and columns Lt, At, Yt for t = 0,1,...,Tt.

Tt

int. Final period in dataset (t=0,1,...,Tt)

den_formula

chr. Right-hand-side glue-style formula to use in fitting treatment models for denominator. Format: '~L{t}+L{t-1}' etc.

num_formula

chr. Right-hand-side glue-style formula to use in fitting treatment models for numerator Format: '~L{t}+L{t-1}' etc.

tibble

logical. Should the results be returned as a tibble with columns (t, estimates) (TRUE) or a vector of just the estimates (FALSE)?

pt_link_fun

function. The scale on which parallel trends is assumed (e.g., qlogis for logit scale). Default NULL for untransformed scale.

binomial_n

int length nrow(data). Group sizes for aggregate binomial data.

models

logical. Return all models as an attribute?

Value

Estimates of E(Yt(a) - Yt-1(a)), in the form of a tibble or vector (dependening on argument tibble), for times t=1,2,...,Tt (in that order).


audreyrenson/didgformula documentation built on Oct. 9, 2022, 11:45 a.m.