Skip to content
/ fciR Public

Functions and data used with Fundamentals of Causal Inference by Babette Brumback

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

FrankLef/fciR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fciR

Lifecycle: experimental Lcense R 4.2.1

fciR is a companion package to the book Fundamentals of Causal Inference With R by Babette A. Brumback, CRC Press 2022. It is important to remember that this package is not for commercial use as the functions have not been designed specifically to be to be efficient, robust or with error checks. This package is a learning tool, not a working tool.

Installation

You can install the development version of fciR from GitHub with:

# install.packages("devtools")
devtools::install_github("FrankLef/fciR")

Aknowledgement

All my thanks to the author, Ms Babette Brumback, for her patience and kindness in answering my queries and for all her work in creating this so useful book.

Overview

The package includes functions replacing the ones appearing in Fundamentals of Causal Inference to provide improved documentations, naming conventions and helper functions for plots, tables etc.

The relevant functions and their correspondence in the book are listed in the following table. It is important to note that all boostrapping code are replaced by fciR::boot_est.

Reference Book fciR Description
Section 2.4, p. 33 lmodboot prob_lmod Estimate the sampling distribution
Section 2.4, p. 33 lmodboot prob_lmod_td Estimate the sampling distribution using tidyverse
Section 2.4, p. 34 lmodboot boot_est The bootstrapping code section is replaced by this one
Section 3.3, p. 46 bootu meas_effect_uncond Estimate unconditional association measures
Section 3.3, p. 50 lmodboot meas_effect_uncond Estimate conditional association measures
Section 4.1, p. 60 bootinside meas_effect_modif Estimate effect measure with modifications
Section 6.1, p. 101 stand backdr_out_npr backdoor method via outcome model using non parametric regression
Section 6.1.1, p. 106 standatt backdr_out_npr same as backdr_out_npr but with att=TRUE
Section 6.1.2, p. 111 standout backdr_out backdoor via outcome model using parametric method
Section 6.1.2, p. 112 standout backdr_out Same as previous one but using different parameters
Section 6.2, p. 114 mk.mordat backdr_exp_bb Standardization via exposure modeling
Section 6.2, p. 115 mordat.out backdr_out Standardization via outcome modeling
Section 6.2.1, p. 116 attsem backdr_out Standardization via outcome modeling with att=TRUE
Section 6.2.2, p. 118 standexp backdr_exp Standardization via parametric exposure model
Section 6.2.2, p. 119 exp backdr_exp_gee Standardization via parametric exposure model with geepack::geeglm
Section 6.2.2, p. 119 standep backdr_exp Same as above for p. 118
Section 6.2.2, p. 120 prop prop_mod Fit the propensity score model
Section 6.3, p. 125 badstanddr backdr_dr_bad Misspecified doubly robust standardization
Section 6.3, p. 127 simdr mc_standdr Monte-Carlo simulation investigating small-sample robustness
Section 7.2, p. 141 didlinear did_linear Difference-in-Differences estimator with linear model
Section 7.2, p. 141 didloglinear did_loglinear Difference-in-Differences estimator with loglinear model
Section 7.2, p. 142 didlogistic did_logistic Difference-in-Differences estimator with logistic model
Section 7.2, p. 142 bootdid boot_est Same bootstrapping function used everywhere else in the package
Section 8.3, p. 153 frontdoor frontdr_np Front-door method non-parametric
Section 9.3, p. 164 iv instr_vars ITT, CACE and ATT from instrument variables
Section 9.3, p. 167 ividentity instr_linear Estimate effect using instrument variables
Section 9.3, p. 167 ivlog instr_loglinear Estimate effect using instrument variables via logarithmic fit
Section 9.3, p. 168 ivlogit instr_logistic Estimate effect using instrument variables via logistic fit
Section 10.2, p. 179 estand backdr_out Outcome-model standardization compared to propensity score
Section 10.3, p. 181 equartiles prop_quant Stratifying on the quantiles of the propensity score
Section 11.2, p. 190 precision precision_eff Compute precision efficiency.
Section 11.2, p. 190 bootprecision precision_stats Compute stats on precision efficiency.
Section 12.3, p. 201 mediation mediation_np Estimate non-parametric mediation effect.
Section 12.3, p. 202 nonparamediation mediation Estimate mediation effect with parametric assumptions.
Section 13.1, p. 211 msm time_msm Estimate using marginal structural models.
Section 13.2, p. 214 snmm time_snmm Estimate using structural mested mean models.
Section 13.3, p. 216 mkcogtab.r time_odtr_prop Optimal dynamic treatment regimes, step 1.
Section 13.3, p. 217 A2opt.r time_odtr_optA2 Optimal dynamic treatment regimes, step 2.
Section 13.3, p. 217 A2opt.r time_odtr_optA2 Optimal dynamic treatment regimes, step 3.
Section 13.3, p. 218 A1opt.r time_odtr_optA1A2 Optimal dynamic treatment regimes, step 4.
Section 13.3, p. 219 optimal.r time_odtr_optimal Optimal dynamic treatment regimes, step 4.

Packages

The packages used by fciR include the usual great ones

Package Description
rlang Core R functions with tidyverse
dplyr Data wrangling
tidyr Create tidy data
tidyselect Select from a set of string
purrr Functional programming toolkit
ggplot2 Nice plots

and several packages used for more specialized tasks

Package Description
boot Boostrapping
rsample Boostrapping and jackknife
broom Extract information from models
MonteCarlo Monte Carlo simulations
formulaic Dynamic creation and quality checks of formula
gee Generalized estimation equation solver
geepack Generalized estimation equation package
AER Applied econometrics with R
Matching Multivariate and propensity score matching

About

Functions and data used with Fundamentals of Causal Inference by Babette Brumback

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages