knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
R package for implementing trajectory balancing, a kernel-based reweighting method for causal inference with panel data.
Repo: GitHub
Examples: R code used in the tutorial can be downloaded from here.
Reference: Hazlett, Chad and Yiqing Xu, 2018. "Trajectory Balancing: A General Reweighting Approach to Causal Inference with Time-Series Cross-Sectional Data." Working Paper, UCLA and Stanford. Available at SSRN: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3214231.
You can install the development version of the package from Github by typing the following commands:
install.packages('devtools', repos = 'http://cran.us.r-project.org') # if not already installed # devtools::install_github('chadhazlett/kbal') devtools::install_github("csterbenz1/KBAL", ref = "cat_kernel") devtools::install_github('xuyiqing/tjbal')
Note that installing kbal (from Github) is required. tjbal also depends on the following packages, which will be installed automatically when tjbal is installed. You can also install them manually:
## for plotting require(ggplot2) ## for parallel computing require(foreach) require(doParallel) require(parallel) ## for data manipulation require(plyr)
panelView for panel data visualization is also highly recommended:
devtools::install_github('xuyiqing/panelView')
Please report bugs to yiqingxu [at] stanford.edu with your sample code and data file. Much appreciated!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.