twfeCovsWithSimulatedData | R Documentation |
This function runs the bridge-penalized extended two-way fixed effects estimator (twfeCovs()
) on
simulated data. It is simply a wrapper for twfeCovs()
: it accepts an object of class
"FETWFE_simulated"
(produced by simulateData()
) and unpacks the necessary
components to pass to twfeCovs()
. So the outputs match twfeCovs()
, and the needed inputs
match their counterparts in twfeCovs()
.
twfeCovsWithSimulatedData(
simulated_obj,
verbose = FALSE,
alpha = 0.05,
add_ridge = FALSE
)
simulated_obj |
An object of class |
verbose |
Logical; if TRUE, more details on the progress of the function will be printed as the function executes. Default is FALSE. |
alpha |
Numeric; function will calculate (1 - |
add_ridge |
(Optional.) Logical; if TRUE, adds a small amount of ridge regularization to the (untransformed) coefficients to stabilize estimation. Default is FALSE. |
A named list with the following elements:
att_hat |
The estimated overall average treatment effect for a randomly selected treated unit. |
att_se |
If |
catt_hats |
A named vector containing the estimated average treatment effects for each cohort. |
catt_ses |
If |
cohort_probs |
A vector of the estimated probabilities of being in each
cohort conditional on being treated, which was used in calculating |
catt_df |
A dataframe displaying the cohort names,
average treatment effects, standard errors, and |
beta_hat |
The full vector of estimated coefficients. |
treat_inds |
The indices of |
treat_int_inds |
The indices of |
sig_eps_sq |
Either the provided |
sig_eps_c_sq |
Either
the provided |
X_ints |
The design matrix created containing all interactions, time and cohort dummies, etc. |
y |
The vector of
responses, containing |
X_final |
The design matrix after applying the change in coordinates to fit the model and also multiplying on the left by the square root inverse of the estimated covariance matrix for each unit. |
y_final |
The final response after multiplying on the left by the square root inverse of the estimated covariance matrix for each unit. |
N |
The final number of units that were in the data set used for estimation (after any units may have been removed because they were treated in the first time period). |
T |
The number of time periods in the final data set. |
R |
The final number of treated cohorts that appear in the final data set. |
d |
The final number of covariates that appear in the final data set (after any covariates may have been removed because they contained missing values or all contained the same value for every unit). |
p |
The final number of columns in the full set of covariates used to estimate the model. |
## Not run:
# Generate coefficients
coefs <- genCoefs(R = 5, T = 30, d = 12, density = 0.1, eff_size = 2, seed = 123)
# Simulate data using the coefficients
sim_data <- simulateData(coefs, N = 120, sig_eps_sq = 5, sig_eps_c_sq = 5)
result <- twfeCovsWithSimulatedData(sim_data)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.