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 synth from package 'Synth'.

dataprep.out

The input of function synth which led to synth.out.

lb

A numerical scalar (default: 1e-8), corresponding to the lower bound for the outer optimization.

tol

A numerical scalar (default: 1e-5). If the relative *and* absolute improvement of loss.v and loss.w, respectively, exceed tol, this is reported (if verbose is TRUE). Better optima are always looked for (independent of the value of tol).

verbose

A logical scalar. Should the ouput be verbose (defaults to TRUE).

seed

A numerical vector or NULL. See the corresponding documentation for mscmt. Defaults to 1 in order to provide reproducibility of the results.

...

Further arguments to mscmt. Supported arguments are check.global, inner.optim, inner.opar, outer.optim, and outer.opar.

Details

Performing SCM means solving a nested optimization problem. Depending on the validity of the results of the inner optimization, SCM may produce

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)

[Package MSCMT version 1.4.0 Index]