synth_weights | R Documentation |
Auxiliary Function for generating individual weights for each unit-specific data entry. The method allows of opimtizing weights for all placebo and treated data configurations (assuming there are placebo configurations to generate)
synth_weights(
data,
time_window = NULL,
custom_variable_weights = NULL,
include_fit = FALSE,
optimization_method = c("Nelder-Mead", "BFGS"),
genoud = FALSE,
quadopt = "ipop",
Margin.ipop = 5e-04,
Sigf.ipop = 5,
Bound.ipop = 10,
verbose = verbose,
...
)
data |
nested data of type |
time_window |
the temporal window of the pre-intervention outcome time series to be used in the optimization task. Default behavior uses the entire pre-intervention time period. |
custom_variable_weights |
a vector of provided weights that define a variable's importance in the optimization task. The weights are intended to reflect the users prior regarding the relative significance of each variable. Vector must sum to one. Note that the method is significantly faster when a custom variable weights are provided. Default behavior assumes no wieghts are provided and thus must be learned from the data. |
include_fit |
Boolean flag, if TRUE, then the optimization output is
included in the outputted |
optimization_method |
string vector that specifies the optimization algorithms to be used. Permissable values are all optimization algorithms that are currently implemented in the optimx function (see this function for details). This list currently includes c("Nelder-Mead', 'BFGS', 'CG', 'L-BFGS-B', 'nlm', 'nlminb', 'spg', and 'ucminf"). If multiple algorithms are specified, synth will run the optimization with all chosen algorithms and then return the result for the best performing method. Default is "BFGS". As an additional possibility, the user can also specify 'All' which means that synth will run the results over all algorithms in optimx. |
genoud |
Logical flag. If true, synth embarks on a two step optimization. In the first step, genoud, an optimization function that combines evolutionary algorithm methods with a derivative-based (quasi-Newton) method to solve difficult optimization problems, is used to obtain a solution. See genoud for details. In the second step, the genoud results are passed to the optimization algorithm(s) chosen in optimxmethod for a local optimization within the neighborhood of the genoud solution. This two step optimization procedure will require much more computing time, but may yield lower loss in cases where the search space is highly irregular. |
quadopt |
string vector that specifies the routine for quadratic optimization over w weights. possible values are "ipop" and "LowRankQP" (see ipop and LowRankQP for details). default is 'ipop' |
Margin.ipop |
setting for ipop optimization routine: how close we get to the constraints (see ipop for details) |
Sigf.ipop |
setting for ipop optimization routine: Precision (default: 7 significant figures (see ipop for details) |
Bound.ipop |
setting for ipop optimization routine: Clipping bound for the variables (see ipop for details) |
verbose |
Logical flag. If TRUE then intermediate results will be shown. |
... |
Additional arguments to be passed to optimx and or genoud to adjust optimization. |
tibble data frame with optimized weights attached.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.