improveSynth {MSCMT} | R Documentation |
Check (and Improve) Results of Package Synth
Description
improveSynth
checks the results of synth
for feasibility and optimality and tries to find a better solution.
Usage
improveSynth(
synth.out,
dataprep.out,
lb = 1e-08,
tol = 1e-05,
verbose = TRUE,
seed = 1,
...
)
Arguments
synth.out |
A result of |
dataprep.out |
The input of function |
lb |
A numerical scalar (default: |
tol |
A numerical scalar (default: |
verbose |
A logical scalar. Should the ouput be verbose (defaults to
|
seed |
A numerical vector or |
... |
Further arguments to |
Details
Performing SCM means solving a nested optimization problem. Depending on the validity of the results of the inner optimization, SCM may produce
invalid or infeasible results, if the vector
w
of donor weights reported as the result of the inner optimization is in fact not optimal, ie. produces too largeloss.w
,suboptimal results, if the vector
v
of predictor weights reported as the result of the outer optimization is in fact not optimal (which may be caused by shortcomings of the inner optimization).
improveSynth
first checks synth.out
for feasibility and
then tries to find a feasible and optimal solution by applying the
optimization methods of package MSCMT
to dataprep.out
(with default settings, more flexibility will probably be added in a
future release).
Value
An updated version of synth.out
, where solution.v
,
solution.w
, loss.v
, and loss.w
are replaced by the
optimum obtained by package 'MSCMT'
and all other components
of synth.out
are removed.
Examples
## Not run:
## check whether package 'Synth' is available
if (require("Synth")) {
## process first example of function "synth" in package 'Synth'
## (comments are removed):
data(synth.data)
dataprep.out<-
dataprep(
foo = synth.data,
predictors = c("X1", "X2", "X3"),
predictors.op = "mean",
dependent = "Y",
unit.variable = "unit.num",
time.variable = "year",
special.predictors = list(
list("Y", 1991, "mean"),
list("Y", 1985, "mean"),
list("Y", 1980, "mean")
),
treatment.identifier = 7,
controls.identifier = c(29, 2, 13, 17, 32, 38),
time.predictors.prior = c(1984:1989),
time.optimize.ssr = c(1984:1990),
unit.names.variable = "name",
time.plot = 1984:1996
)
synth.out <- synth(dataprep.out)
## check and (try to) improve these results:
synth2.out <- improveSynth(synth.out,dataprep.out)
}
## End(Not run)