This function loads a matrix or a data-fram a file as a matrix. It ensures that for all relevant subsets that could be used as a training dataset for the later SCUL procedure have variation. It drops any columns that violate these conditions.

PreprocessSubset(
  z,
  TreatmentBeginsAt,
  NumberInitialTimePeriods = nrow(z) - TreatmentBeginsAt + 1,
  PostPeriodLength = nrow(z) - TreatmentBeginsAt + 1,
  PrePeriodLength = TreatmentBeginsAt - 1,
  TrainingPostPeriodLength = nrow(z) - TreatmentBeginsAt + 1
)

Arguments

z

A matrix or a data frame.

TreatmentBeginsAt

Indicator of when (which row) treatment begins.

NumberInitialTimePeriods

The number of initial time periods in analysis. Defaults to length of post-treatment period.

PostPeriodLength

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

PrePeriodLength

The number of time periods before treatment (i.e. the length of the entire training dataset). Defaults to time before treatment begins.

TrainingPostPeriodLength

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

Value

A cleaned matrix or data frame with violating columns dropped.