the same as cfa method except it computes two results at the same time which allows one to conduct inference on their difference

cfa2(
  formla,
  tvals,
  yvals,
  data,
  xformla1 = NULL,
  method1 = "dr",
  link1 = "logit",
  tau1 = seq(0.01, 0.99, 0.01),
  condDistobj1 = NULL,
  xformla2 = NULL,
  method2 = "dr",
  link2 = "logit",
  tau2 = seq(0.01, 0.99, 0.01),
  condDistobj2 = NULL,
  se = TRUE,
  iters = 100,
  cl = 1
)

Arguments

formla

a formula y ~ treatment

tvals

the values of the "treatment" to compute parameters of interest for

yvals

the values to compute the counterfactual distribution for

data

the data.frame where y, t, and x are

xformla1

an optional formula for the first set of x variables

method1

the first method for estimating the conditional distribution it can be "dr" for distribution regression or "qr" for quantile regression

link1

if using distribution regression, set the link variable. It can be any link function accepted by glm, e.g. logit, probit, cloglog

tau1

if using quantile regression, the values of tau to use, the default is seq(.01,.99,.01)

condDistobj1

if have already calculated a conditional distribution object outside of the model, can set it here

xformla2

an optional formula for the second set of x variables

method2

the second method for estimating the conditional distribution it can be "dr" for distribution regression or "qr" for quantile regression

link2

if using distribution regression, set the link variable. It can be any link function accepted by glm, e.g. logit, probit, cloglog

tau2

if using quantile regression, the values of tau to use, the default is seq(.01,.99,.01)

condDistobj2

if have already calculated a conditional distribution object outside of the model, can set it here

se

whether or not to compute standard errors using the bootstrap

iters

how many bootstrap iterations to use

cl

how many clusters to use for parallel computation of standard errors

Value

list of two CFA objects

Examples

#' data(igm) tvals <- seq(10,12,length.out=5) yvals <- seq(quantile(igm$lcfincome, .05), quantile(igm$lcfincome, .95), length.out=50) ## obtain counterfactual results using quantile regression with ## no covariates and adjusting for education cfa2(lcfincome ~ lfincome, tvals, yvals, igm, method1="qr", xformla2=~HEDUC, method2="qr", se=FALSE, tau1=seq(.1,.9,.1), tau2=seq(.1,.9,.1))
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique