DSC_CI: Confidence Interval in the DSC Method

Description Usage Arguments Value Examples

View source: R/DSC_CI.R

Description

Function for computing the confidence interval (at a specific period) in the DSC method

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
DSC_CI(
  df_control,
  df_target,
  M = 100,
  solver = "SCS",
  w_t = 0,
  cl = 0.99,
  num.redraws = 500,
  evgrid = seq(from = 0, to = 1, length.out = 1001),
  graph = TRUE,
  y_name = "y",
  x_name = "x"
)

Arguments

df_control

a list or matrix: in list form, each list element contains a vector of observations for the given control unit; in matrix form, each column corresponds to one unit and each row is one observation.

df_target

a vector of observations.

M

an integer specifying the number of draws from the uniform distribution for approximating the integral.

solver

a solver for the optimization problem; see installed_solvers in CVXR for more options.

w_t

0 or a vector. By default, i.e. 0, DSC_CI calculates the confidence interval of a pre-treatment period, weights of control units are not needed to be specified. To calculate the confidence interval of a post-treatment period, a vector of optimal weights (pre-calculated using pre-treatment observations) is needed.

cl

a float specifying the confidence level.

num.redraws

an integer specifying the number of redraws used in the bootstrap approach.

evgrid

a vector of gridpoints used to evaluate quantile functions.

graph

TRUE/FALSE, indicating whether to output a plot of the confidence interval.

y_name

a string for the title of the y-axis.

x_name

a string for the title of the x-axis.

Value

DSC_CI returns a list containing the following components:

CI.u

a vector of the upper bound.

CI.l

a vector of the lower bound.

Examples

1
2
3
4
#simulated data from Gaussian mixture
#ex_gmm() calls the simulated data
#detail can be found by ??ex_gmm
DSC_CI(df_control=ex_gmm()$control, df_target=ex_gmm()$target, M=100, solver="SCS", w_t=0, cl=0.99, num.redraws=500, evgrid = seq(from=0, to=1, length.out=1001),graph=TRUE, y_name='y', x_name='x')

hesyserena/DSC documentation built on Dec. 20, 2021, 3:49 p.m.