fit_first_stage_raw: Estimate First Stage

Description Usage Arguments Value

View source: R/fit_first_stage_elasticity.R

Description

Estimate the first stage (y ~ first_mo), where y is a binary variable (e.g. statin fill indiator) in gross terms

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fit_first_stage_raw(
  DT,
  y,
  months = "1_12",
  x_main = "first_mo",
  x_int = NULL,
  keep_vars,
  cont_risk_var = NULL,
  n_quant = 5,
  quiet = FALSE
)

Arguments

DT

a data.table

y

character vector, name of response variable(s) without months suffix

months

character vector (default = "1_12"), months of y variable to estimate. Should be in the form "YEAR_MONTH" where year is between 1 and 2 and month is between 1 and 12.

x_main

character (default = "first_mo"), name of instrument

x_int

character vector, names of variables to interact instrument with

keep_vars

character vector, column names for the binary keep variables

cont_risk_var

character (default = NULL), name of the continuous predicted risk variable

n_quant

integer (default = 5), number of quntiles to break predicted risk in to. High risk is defined as being in the top quantile.

quiet

logical (default = FALSE), if TRUE then does not print progress

Value

a data.table of the first stage estimates (and their standard errors)


evanjflack/polypharmacy documentation built on Oct. 12, 2020, 10:45 a.m.