Calculate a synthetic time series using a penalized regression and a donor pool.

SCUL(
  PostPeriodLength = nrow(SCUL.input$y) - SCUL.input$TreatmentBeginsAt + 1,
  PrePeriodLength = SCUL.input$TreatmentBeginsAt - 1,
  NumberInitialTimePeriods = SCUL.input$NumberInitialTimePeriods,
  OutputFilePath = SCUL.input$OutputFilePath,
  x.DonorPool.PreTreatment = SCUL.input$x.DonorPool.PreTreatment,
  y.PreTreatment = SCUL.input$y.PreTreatment,
  x.DonorPool = SCUL.input$x.DonorPool,
  time = SCUL.input$time,
  y.actual = SCUL.input$y,
  TreatmentBeginsAt = SCUL.input$TreatmentBeginsAt,
  TrainingPostPeriodLength = SCUL.input$TrainingPostPeriodLength,
  cvOption = "lambda.1se",
  plotCV = FALSE
)

Arguments

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

A file path to store output. Default is taken from SCUL.input$OutputFilePath

x.DonorPool.PreTreatment

A data frame with the pre-treament values of the donor pool. Default is to extract this from SCUL.input$x.DonorPool.PreTreatment

y.PreTreatment

A data frame with the pre-treament values of the target variable Default is to extract this from SCUL.input$y.PreTreatment

x.DonorPool

A data frame with the all values of the donor pool. Default is to extract this from SCUL.input$x.DonorPool

time

A data frame that is a column vector (Tx1) sorted by time. Default is taken from SCUL.input$time

y.actual

A data frame that is a column vector (Tx1) sorted by time Default is taken from SCUL.input$y

TreatmentBeginsAt

An integer indicating which row begins treatment. Default is to begin this at SCUL.input$TreatmentBeginsAt.

TrainingPostPeriodLength

The number of timer periods post-treatment for training data. Defaults to all time since treatment begins.

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

plotCV

Create a plot of the cross-validated mean squared error against -log(lambda) of the penalty parameter. Default is to not plot CV curve (plotCV == FALSE).

Value

OutputDataSCUL A list with the synthetic series, weights used to construct the series, and measures of fit.