R/CreatePlaceboDistribution.R
CreatePlaceboDistribution.Rd
Runs the scul procedure on the whole placebo pool (using itself as the donor pool; this could be altered to have a custom donor pool) to create null distribution that can be used for inference in later steps.
CreatePlaceboDistribution(
x.PlaceboPool = SCUL.input$x.PlaceboPool,
TreatmentBeginsAt = SCUL.input$TreatmentBeginsAt,
PostPeriodLength = nrow(SCUL.input$y) - SCUL.input$TreatmentBeginsAt + 1,
PrePeriodLength = SCUL.input$TreatmentBeginsAt - 1,
NumberInitialTimePeriods = SCUL.input$NumberInitialTimePeriods,
OutputFilePath = SCUL.input$OutputFilePath,
CohensDThreshold = SCUL.input$CohensDThreshold,
TrainingPostPeriodLength = SCUL.input$TrainingPostPeriodLength,
DonorPoolRestrictionForEachPlacebo = "",
cvOption = "lambda.1se"
)
x.PlaceboPool | A (T by J) data frame containing all products that you wish to include in the placebo distribution Must be sorted by time. Default is SCUL.input$x.PlaceboPool. |
---|---|
TreatmentBeginsAt | An integer indicating which row begins treatment. Default is SCUL.output$TreatmentBeginsAt. |
PostPeriodLength | An integer that indicates the length of the post-treatment period. Defailt is calculated using SCUL.input data. |
PrePeriodLength | An integer that indicates the length of the pre-treatment period. Defailt is calculated using SCUL.input data. |
NumberInitialTimePeriods | An integer that indicates the number of time periods desired in the training data for the first cross-validation run. Default is the stated amount in SCUL.input data. |
OutputFilePath | Output file path. Default is SCUL.input$OutputFilePath. |
CohensDThreshold | A real number greater than 0, indicating the Cohen's D threshold at which fit is determined to be "poor". The difference is in standard deviation units. Default is SCUL.input$CohensDThreshold. |
TrainingPostPeriodLength | The number of timer periods post-treatment for training data. Defaults to all time since treatment begins. |
DonorPoolRestrictionForEachPlacebo | This is a customizeable restriction on the placebo pool. In Hollingsworth and Wing (2020) we use it to ensure that no analysis on a placebo series uses donors from the same state. Where state is identified by a pattern in each variable name. Default is no restriction. The placebo pool is indexed by `h`: For a restriction based on the first two characters: "select(-starts_with(substring(names(x.PlaceboPool)[h],1, 2)))" For a restriction based on the last two characters: "select(-ends_with(substring(names(x.PlaceboPool)[h],nchar(names(x.PlaceboPool)[h]) - 2 + 1, nchar(names(x.PlaceboPool)[h]))))" |
cvOption | Do you want to use the median CV lambda (cvOption = lambda.median), one that produces the minimum MSE (cvOption = lambda.min), or the largest lambda that produces a MSE within one standard error of the minimum MSE (cvOption = lambda.1se). Default is lambda.1se |
list A list of standardized placbo effect sizes