Description Usage Arguments Value References See Also

View source: R/crossvalidation.R

Implements the matching and synthetic control (masc) estimator of Kellogg, Mogstad,
Pouliot, and Torgovitsky (2019), *conditional on a given matching estimator* characterized by m.
masc loops over evaluations of this function for each candidate matching estimator,
and selects the one which minimizes cross-validation error.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
cv_masc(
treated,
donors,
treated.covariates = NULL,
donors.covariates = NULL,
treatment = NULL,
sc_est = sc_estimator,
match_est = NearestNeighbors,
tune_pars = list(min_preperiods = NULL, set_f = NULL, m = NULL, weights_f = NULL,
matchVfun = NULL),
cv_pars = list(forecast.minlength = 1, forecast.maxlength = 1),
phival = NULL,
...
)
``` |

`tune_pars` |
A - m:
an integer representing the nearest neighbor estimator used. - min_preperiods:
an integer. The smallest number of estimation periods allowed in a fold used for cross-validation. We use all folds from fold `min_preperiods` up to the latest possible fold`treatment-2` .- set_f:
a `list` containing a single element, a vector of integers. Identifies the set of folds used for cross-validation. As above, each integer identifies a fold by the last time period it uses in estimation. E.g., set_f=c(7,8,9) would implement cross-validation using fold 7, fold 8, and fold 9.- weights_f:
a `vector` of length`length(set_f)` or`length(min_preperiods:(treatment-2))` , containing weakly positive relative weight values for each of the cross-validation folds. The elements of`weights_f` are normalized to sum to 1- matchVfun:
a `function` that governs how unit characteristics are weighted together for matching. If the estimator is purely outcome-based, then the default behavior is raw matching on the outcome paths. If the estimator uses covariates, then the default behavior is to weigh outcomes by their standard deviations across units.
#' If neither |

`cv_pars` |
A |

`phival` |
A real value between 0 and 1. If specified, hard-codes the masc estimator to take the specified weighted
average of matching and synthetic controls, where |

returns a list containing five objects:

- phi_hat:
selected value for the model averaging parameter (1 is pure matching, 0 pure synthetic control).

- m_hat:
selected matching estimator (number of nearest neighbor).

- weights:
The vector length N containing weights placed on each control unit.

- pred.error:
The vector of treatment effects implied by the masc counterfactual, for periods T' to T.

- cv.error:
The average (weighted by

`weights_f`

) of the cross-validation errors generated by each fold.- cv.error.byfold:
The cross-validation error generated by each fold.

Kellogg, M., M. Mogstad, G. Pouliot, and A. Torgovitsky. Combining Matching and Synthetic Control to Trade off Biases from Extrapolation and Interpolation. Working Paper, 2019.

Other masc functions:
`masc_by_phi()`

,
`masc()`

,
`sc_estimator()`

,
`solve_masc()`

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.