View source: R/FEdecompo_simple.R
FE_decompo | R Documentation |
Decomposition of fixed-effects weights
FE_decompo(
data,
y_var = "y",
time.index = "Time",
treat = "tr",
unit.index = "unit",
covar = NULL,
fixed_effects = c("time", "unit", "both"),
by = unit.index
)
data |
A data frame containing the variables of itnerest, should have names |
y_var |
The name of the y variable |
time.index |
The name of the variable describing the time index (date, year, etc) |
treat |
The name of the treatment variable. |
unit.index |
The name of the units (individual, county, household, etc). |
covar |
covariate to include
This will use the values indicated in |
fixed_effects |
The fixed effects to include, either time, unit ot both. |
by |
over which dimension to do it? |
library(lfe)
dat_sim_1 <- sim_dat(N=100, Time = 5)
coef_FE_time <- coef(felm(y~tr|Time, data = dat_sim_1))
coef_FE_unit <- coef(felm(y~tr|unit, data = dat_sim_1))
coefs_by_Y <- FE_decompo(data=dat_sim_1,
treat = "tr",
by = "Time",
fixed_effects = "time")
coefs_by_U <- FE_decompo(data=dat_sim_1,
treat = "tr",
by = "unit",
fixed_effects = "unit")
with(coefs_by_Y, weighted.mean(treat_coef, treat_weight))
coef_FE_time
with(coefs_by_U, weighted.mean(treat_coef, treat_weight))
coef_FE_unit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.