robustness_bound()
computes the value of the sensitivity parameter M at which the robustness bounds change from excluding to including an ATT of 0.
Arguments
- object
an
apm_est
object; the output of a call toapm_est()
.M
must have been set to a nonzero value to userobustness_bound()
.- level
the desired confidence level. Set to 0 to ignore sampling variation in computing the interval bounds. Default is .95.
Value
A single number corresponding to the changepoint value of M. If there is no positive value of M for which the interval bounds cross 0, NA
will be returned.
See also
summary.apm_est()
for examining the ATT and bounds for a given value of M
; uniroot()
for the function that finds the changepoint value of M
.
Examples
data("ptpdata")
# Combination of 4 models: 2 time trends, 2 lags
models <- apm_mod(list(crude_rate ~ 1),
lag = 0:1,
time_trend = 0:1)
models
#> - Model 1: baseline mean
#> crude_rate ~ 1
#> family: gaussian(link = "identity")
#> outcome lag: none
#> outcome diff: none
#> log outcome: no
#> time trend: none
#> unit fixed effects: no
#>
#> - Model 2: AR(1)
#> crude_rate ~ 1
#> family: gaussian(link = "identity")
#> outcome lag: 1
#> outcome diff: none
#> log outcome: no
#> time trend: none
#> unit fixed effects: no
#>
#> - Model 3: linear trend
#> crude_rate ~ 1
#> family: gaussian(link = "identity")
#> outcome lag: none
#> outcome diff: none
#> log outcome: no
#> time trend: linear
#> unit fixed effects: no
#>
#> - Model 4: linear trend + AR(1)
#> crude_rate ~ 1
#> family: gaussian(link = "identity")
#> outcome lag: 1
#> outcome diff: none
#> log outcome: no
#> time trend: linear
#> unit fixed effects: no
# Fit the models to data; unit_var must be supplied for
# fixed effects
fits <- apm_pre(models,
data = ptpdata,
group_var = "group",
time_var = "year",
val_times = 2004:2007,
unit_var = "state",
nsim = 100,
verbose = FALSE)
est <- apm_est(fits,
post_time = 2008,
M = 1,
R = 20,
verbose = FALSE)
est
#> An `apm_est` object
#>
#> - grouping variable: group
#> - unit variable: state
#> - time variable: year
#> - validation times:
#> - post-treatment time: 2008
#> - sensitivity parameter (M): 1
#> - bootstrap replications: 20
#>
#> Use `summary()` or `plot()` to examine estimates and uncertainty bounds.
# ATT estimate and bounds for M = 1
summary(est)
#> Estimate Std. Error CI low CI high z_value Pr(>|z|)
#> ATT 1.0217 0.1495 0.7286 1.3148 6.832 8.35e-12 ***
#> M = 1 . . -0.1756 2.4973 . .
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#Changepoint value of M ignoring estimation uncertainty
(M <- robustness_bound(est, level = 0))
#> [1] 1.463209
summary(est, level = 0, M = M)
#> Estimate Std. Error CI low CI high z_value Pr(>|z|)
#> ATT 1.0217 0.1495 1.0217 1.0217 6.832 8.35e-12 ***
#> M = 1.46 . . 0.0000 2.0435 . .
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#Changepoint value of M accounting for estimation uncertainty
(M <- robustness_bound(est, level = .95))
#> [1] 0.8521963
summary(est, level = .95, M = M)
#> Estimate Std. Error CI low CI high z_value Pr(>|z|)
#> ATT 1.0217 0.1495 0.7286 1.3148 6.832 8.35e-12 ***
#> M = 0.85 . . 0.0000 2.3130 . .
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1