Description Usage Arguments Value

View source: R/ElasticSynthRun.R

An implementation of ElasticSynth that can run on multiple treated units, through multiple pre and post periods. No output object is returned, but graphical results and output weights are stored in output directory.

1 2 3 4 5 | ```
ElasticSynthRun(PredictorMatrix, OutcomeMatrix, TreatedUnitList, PrePeriodList,
PostPeriodList, max_number_units, PenaltyTermsMat = matrix(rep(1,
ncol(OutcomeMatrix) * (ncol(OutcomeMatrix) - 1)), ncol = ncol(OutcomeMatrix),
nrow = ncol(OutcomeMatrix) - 1), time_unit, start_month, end_month,
lower_limit_weights, storage_folder, cv)
``` |

`PredictorMatrix` |
a p x n matrix where each row is a seperate control variable to be included in the analysis for each unit |

`OutcomeMatrix` |
a t x n matrix where each row is the outcome variable of interest at time t for each unit |

`TreatedUnitList` |
a vector/list of column indices of the treated unit |

`PrePeriodList` |
a list of lists of the pre periods for the treated units. Ex. list(list(1:40), list(1:39), list(2:39)) |

`PostPeriodList` |
a list of lists of the post periods for the treated units. Ex list(list(41:50), list(40:50), list(40:50)) |

`max_number_units` |
glmnet param - The maximum number of units glmnet will select. Useful for forcing parsimonious models. Default allows all units to receive weight. |

`PenaltyTermsMat` |
glmnet param - (optional) a n-1 x n matrix of additional penalties placed upon glmnet for selecting certain units. Useful in the case of multiple treated units. Each column of the matrix represents the penalties to be placed on the control units. The treated unit is excluded from the column. See glmnet param penalty.factor for more details. Default is no additional penalties on any unit. |

`time_unit` |
The gap between observations in the case study. No default. A character string, containing one of "day", "week", "month", "quarter" or "year". This can optionally be preceded by an integer and a space, or followed by "s". Ex '3 months' or 'quarter' |

`start_month` |
the start month of the case study (first pre-period). This is used for plotting |

`end_month` |
the end month of the case study (last post-period). This is used for plotting |

`lower_limit_weights` |
glmnet param - The lower limit value of weight that can be placed on any unit. Default is zero (non-negative constraint). Change if desired, but be wary of overfitting. |

`storage_folder` |
The directory where graph and weight outputs should be stored |

`cv` |
The number of periods of pre-data to include in cross validation step. Helpful to include more if you don't have much post-period data |

Doesn't return an object, but will save placebo test results and true vs. fitted graphs for each treated unit into storage_folder param

tdn158/ElasticSynth documentation built on July 18, 2018, 8:49 a.m.

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.