ppratio: Post-pre-(r)mspe-ratios for placebo studies

View source: R/ppratio.r

ppratioR Documentation

Post-pre-(r)mspe-ratios for placebo studies

Description

ppratio calculates post-to-pre-(r)mspe-ratios for placebo studies.

Usage

ppratio(
  x,
  what,
  range.pre,
  range.post,
  type = c("rmspe", "mspe"),
  return.all = FALSE
)

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.

type

A character string. Either rmspe (default) or mspe. Selects whether root mean squared errors or mean squared errors are calculated.

return.all

A logical scalar. If FALSE (default), only the (named) vector of post-pre-(r)mspe-ratios is returned, if TRUE, a three-column matrix with pre- and post-treatment (r)mspe's as well as the post-pre-ratios will be returned.

Details

ppratio calculates post-to-pre-(r)mspe-ratios for placebo studies based on Synthetic Control Methods.

Value

If return.all is FALSE, a (named) vector of post-pre-(r)mspe-ratios. If return.all is TRUE, a matrix with three columns containing the pre-treatment (r)mspe, the post-treatment (r)mspe, and the post-pre-ratio.


MSCMT documentation built on Nov. 13, 2023, 5:07 p.m.