generate_fake_data: Make fake data for testing purposes.

Description Usage Arguments Value Examples

View source: R/simulation_code.R

Description

Defaults have heavy seasonality, and an extra bump in impact kicks in at 12 months post-policy.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
generate_fake_data(
  t_min = -40,
  t_max = 9,
  t0 = 0,
  rho = 0.5,
  sd.omega = 1,
  coef_line = c(20, 0.05),
  coef_q = c(1, 0, -1, 0),
  coef_temp = 0.1,
  coef_sin = c(0, 0),
  coef_tx = c(0, 0.25, 5)
)

Arguments

t_min

Index of first month

t_max

Index of last month

t0

Last pre-policy time point

rho

Autocorrelation

sd.omega

Standard deviation of the true residual

coef_line

Intercept and slope of the main trendline (list of 2).

coef_q

Coefficients for the four quarters (list of 4).

coef_temp

Coefficient for temperature.

coef_sin

Coefficents for sin and cos features (list of 2)

coef_tx

Coefficient for treatment post-policy (list of 3, initial offset, initial slope, additional slope past 12 months). Treatment is a piecewise linear function.

Value

A data.frame having month , temperature , sin.m , cos.m , Q1, Q2 , Q3, Q4, post , Ystr0 , Ystr , Y

Examples

1
2
3
4
fdat = generate_fake_data(-100,100, rho = 0.95, coef_q=c(0,0,0,0), coef_temp = 0)
plot( fdat$month, fdat$Y, type="l" )
fdat2 = generate_fake_data(-100, 100, rho = 0.0, coef_q=c(0,0,0,0), coef_temp = 0)
plot( fdat$month, fdat2$Y, type="l" )

simITS documentation built on July 2, 2020, 4:10 a.m.