lace
computes the localised average causal effect
for each quantile.
Arguments
- y
vector of outcome values
- x
vector of exposure values
- g
the instrumental variable
- covar
data.frame
of covariates- q
the number of quantiles the exposure distribution is to be split into within which a causal effect will be fitted, known as localised average causal effects (LACE) (default:
10
)- x0q
quantiles of x0 (the IV-free exposure)
- xc_sub
compute the association between the exposure and the insturment in each quantile of x0
- family
a description of the error distribution and link function to be used in the model and is a
character
string naming either the gaussian (i.e."gaussian"
for continuous data) or binomial (i.e."binomial"
for binary data) family function (default:"gaussian"
)- xpos
the position used to relate
x
to the localised average causal effect, this can either be the mean of the x-values within each quantile or a percentile (e.g. 0.5 corresponds to the median value) (default:"mean"
)
Value
lace
returns a data.frame
of the LACE for quantile:
- coef
the LACE in each quantile
- coef_se
the standard error of the LACE in each quantile
- xmean
the mean of the exposure in each quantile
- xcoef_sub
the association between the exposure and the instrument in each quantile
- xcoef_sub_se
the standard error of the association between the exposure and the instrument in each quantile
Author
James Staley jrstaley95@gmail.com