fetwfeWithSimulatedData | R Documentation |
This function runs the fused extended two-way fixed effects estimator (fetwfe()
) on
simulated data. It is simply a wrapper for fetwfe()
: it accepts an object of class
"FETWFE_simulated"
(produced by simulateData()
) and unpacks the necessary
components to pass to fetwfe()
. So the outputs match fetwfe()
, and the needed inputs
match their counterparts in fetwfe()
.
fetwfeWithSimulatedData(
simulated_obj,
lambda.max = NA,
lambda.min = NA,
nlambda = 100,
q = 0.5,
verbose = FALSE,
alpha = 0.05,
add_ridge = FALSE
)
simulated_obj |
An object of class |
lambda.max |
(Optional.) Numeric. A penalty parameter |
lambda.min |
(Optional.) Numeric. The smallest |
nlambda |
(Optional.) Integer. The total number of |
q |
(Optional.) Numeric; determines what |
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. |
An object of class fetwfe
containing 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 |
lambda.max |
Either the provided |
lambda.max_model_size |
The size of the selected model corresponding to |
lambda.min |
Either the provided |
lambda.min_model_size |
The size of the selected model corresponding to |
lambda_star |
The value of |
lambda_star_model_size |
The size of the model that was selected. If this value is close to |
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. |
alpha |
The alpha level used for confidence intervals. |
internal |
A list containing internal outputs that are typically not needed for interpretation:
|
The object has methods for print()
, summary()
, and coef()
. By default, print()
and summary()
only show the essential outputs. To see internal details, use print(x, show_internal = TRUE)
or summary(x, show_internal = TRUE)
. The coef()
method returns the vector of estimated coefficients (beta_hat
).
## 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 <- fetwfeWithSimulatedData(sim_data)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.