Learn R Programming

MSCMT (version 1.4.0)

did: Difference-in-difference estimator based on SCM

Description

did calculates difference-in-difference estimators based on SCM.

Usage

did(
  x,
  what,
  range.pre,
  range.post,
  alternative = c("two.sided", "less", "greater"),
  exclude.ratio = Inf
)

Value

A list with components effect.size, average.pre and average.post. If x contains the results of a placebo study, three components p.value, rank, and excluded (with the names of the excluded units) are included additionally.

Arguments

x

An object of class "mscmt", usually obtained as the result of a call to function mscmt.

what

A character vector. Name of the variable to be considered. If missing, the (first) dependent variable will be used.

range.pre

A vector of length 2 defining the range of the pre-treatment period with start and end time given as

  • annual dates, if the format of start/end time is "dddd", e.g. "2016",

  • quarterly dates, if the format of start/end time is "ddddQd", e.g. "2016Q1",

  • monthly dates, if the format of start/end time is "dddd?dd" with "?" different from "W" (see below), e.g. "2016/03" or "2016-10",

  • weekly dates, if the format of start/end time is "ddddWdd", e.g. "2016W23",

  • daily dates, if the format of start/end time is "dddd-dd-dd", e.g. "2016-08-18",

corresponding to the format of the respective column of the times.dep argument of mscmt. If missing, the corresponding column of times.dep will be used.

range.post

A vector of length 2 defining the range of the post-treatment period with start and end time given as

  • annual dates, if the format of start/end time is "dddd", e.g. "2016",

  • quarterly dates, if the format of start/end time is "ddddQd", e.g. "2016Q1",

  • monthly dates, if the format of start/end time is "dddd?dd" with "?" different from "W" (see below), e.g. "2016/03" or "2016-10",

  • weekly dates, if the format of start/end time is "ddddWdd", e.g. "2016W23",

  • daily dates, if the format of start/end time is "dddd-dd-dd", e.g. "2016-08-18",

corresponding to the format of the respective column of the times.dep argument of mscmt. Will be guessed if missing.

alternative

A character string giving the alternative of the test. Either "two.sided" (default), "less", or "greater".

exclude.ratio

A numerical scalar (default: Inf). When calculating the p-value, control units with an average pre-treatment gap of more then exclude.ratio times the average pre-treatment gap of the treated unit are excluded from the analysis.

Details

did calculates difference-in-difference estimators with corresponding p-values (if results of a placebo study are present) based on the Synthetic Control Method.

Examples

Run this code
if (FALSE) {
## for an example, see the main package vignette:
 vignette("WorkingWithMSCMT",package="MSCMT")
}

Run the code above in your browser using DataLab