| fect_mspe | R Documentation |
Evaluates the prediction accuracy of one or more fect model fits by hiding a subset of control observations and comparing counterfactual predictions against actual values.
fect_mspe(
out.fect,
seed = NULL,
cv.method = "rolling",
cv.nobs = 3,
cv.donut = 1,
cv.buffer = 1,
cv.prop = 0.1,
min.T0 = 5,
k = 20,
criterion = "mspe",
W = NULL,
norm.para = NULL,
proportion = 0
)
out.fect |
A fitted |
seed |
Optional integer; random seed for reproducibility. |
cv.method |
Character; cross-validation masking strategy. One of |
cv.nobs |
Integer; number of observations to mask per unit per fold. Default is 3. |
cv.donut |
Integer; number of periods around treatment onset to exclude from masking. Used by block CV. Default is 1. |
cv.buffer |
Integer; number of past-side cells masked from training (but not scored) before each rolling-window holdout. Used only by |
cv.prop |
Numeric; for block CV, proportion of observations to mask per round; for rolling CV, fraction of eligible units sampled per fold. Default is 0.2. |
min.T0 |
Integer; minimum number of pre-treatment periods required. Default is 5. |
k |
Integer; number of cross-validation folds. Default is 5. |
criterion |
Character; scoring criterion. One of |
W |
Optional TT x N observation weight matrix. Default is |
norm.para |
Optional normalization vector. Default is |
proportion |
Numeric; proportion cutoff for count.T.cv (same as fect_cv). Default is 0. |
A list containing:
summary |
A data frame with mean scores across replications for each model, including MSPE, WMSPE, GMSPE, WGMSPE, MAD, Moment, GMoment, RMSE, and Bias. |
records |
A data frame with per-replication results including Rep, Model, Hidden_N, and all score columns. |
fits |
The refitted |
criterion |
The scoring criterion used. |
scores |
The scores from the last replication. |
## Not run:
out <- fect(Y ~ D, data = df, index = c("unit", "time"), method = "ife", r = 2)
mspe <- fect_mspe(out.fect = out, hide_n = 10, seed = 42, n_rep = 5)
mspe$summary
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.