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

View source: R/iptw_long.R

iptw_pipeline_longR Documentation

Estimate the DID g-formula using inverse-probability-of-treatment-weights with exposure models pooled over time periods.

Description

Estimate the DID g-formula using inverse-probability-of-treatment-weights with exposure models pooled over time periods.

Usage

iptw_pipeline_long(
  df_obs,
  df_interv,
  den_formula,
  num_formula,
  family,
  yvar = "Y",
  ylagvar = "Y_lag",
  idvar = "uid",
  timevar = "t",
  tibble = TRUE,
  pt_link_fun = NULL,
  binomial_n = NULL,
  models = TRUE
)

Arguments

df_obs

long format data frame, ordered by person id, then time

df_interv

same data set as df_obs with exposure variable set to the intervened status

den_formula

chr or formula. glm formula for (pooled) denominator model

num_formula

chr or formula. glm formula for (pooled) numerator model

family

stats::families object for numerator and denominator glm call

yvar

chr. Name of column in df_obs corresponding to the outcome at time t

ylagvar

chr. Name of column in df_obs corresponding to the outcome at time t-1

idvar

chr. Name of column in df_obs corresponding to the person id

timevar

chr. Name of column in df_obs corresponding to times (typically starting from 1, so that t-1=0)

tibble

lgl. Return results as a tibble (TRUE) or vector (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.