get.cohort | R Documentation |
Gets the cohort index given a panel data.
get.cohort(data, D, index, varname = NULL, entry.time = NULL)
data |
a data frame, can be a balanced or unbalanced panel data. |
D |
the treatment indicator. The treatment should be binary (0 and 1). |
index |
a two-element string vector specifying the unit and time indicators. Must be of length 2. Every observation should be uniquely defined by the pair of the unit and time indicator. |
varname |
a string specifying the name for the generated cohort index. |
entry.time |
a list of intervals for first get-treated time. |
get.cohort
pre-processes the data and generates the index for different cohorts..
data |
a new data frame containing the cohort index. |
Licheng Liu; Ye Wang; Yiqing Xu, Ziyi Liu
Jushan Bai. 2009. "Panel Data Models with Interactive Fixed Effects." Econometrica.
Yiqing Xu. 2017. "Generalized Synthetic Control Method: Causal Inference with Interactive Fixed Effects Models." Political Analysis.
Athey, Susan, et al. 2021 "Matrix completion methods for causal panel data models." Journal of the American Statistical Association.
Licheng Liu, et al. 2022. "A Practical Guide to Counterfactual Estimators for Causal Inference with Time-Series Cross-Sectional Data." American Journal of Political Science.
For more details about the matrix completion method, see https://github.com/susanathey/MCPanel.
fect
and print.fect
library(fect) data(fect) simdata.cohort <- get.cohort(data = simdata,D = 'D',index = c("id","time"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.