if (FALSE) {
## 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)
}
}
Run the code above in your browser using DataLab