The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
This vignette introduces the standardized proximal effect size
estimator for continuous proximal outcomes implemented
in calculate_mrt_effect_size(). The method generalizes the
standardized effect size in Luers and
others (2019) by
allowing adjustment for baseline and time-varying covariates to improve
efficiency. The goal is to estimate the time-varying proximal causal
excursion effect on a standardized scale, and optionally smooth the
estimate over decision points.
The input data are in long format, with one row per participant-by-decision point. The data set must include:
Optional time-varying covariates can be included and specified
through the covariates argument.
We use the built-in example data
data_example_for_standardized_effect to illustrate
usage.
data("data_example_for_standardized_effect")
dat <- data_example_for_standardized_effect
head(dat)
#> id decision_point availability prob_treatment treatment covariate1
#> 1 1001 1 0 0.0000 0 0.62076
#> 2 1001 2 1 0.4997 0 -0.07169
#> 3 1001 3 0 0.0000 0 0.47687
#> 4 1001 4 0 0.0000 0 -0.49603
#> 5 1001 5 1 0.3578 0 -0.71909
#> 6 1001 6 0 0.0000 0 -1.03928
#> covariate2 treatment_effect sigma outcome
#> 1 0.03564 0.00000 1 1.09423
#> 2 0.11610 0.04082 1 1.79715
#> 3 -0.07892 0.08163 1 0.30206
#> 4 -0.27361 0.12245 1 0.33421
#> 5 -0.75106 0.16327 1 -0.09467
#> 6 0.05537 0.20408 1 0.97451We estimate the effect with a modest number of bootstrap replications
(100) for speed. For stable confidence intervals, use at least 1000
replications. By default, the function applies LOESS smoothing over
decision points; you can disable this by setting
smooth = FALSE, or tune the smoother via
loess_span and loess_degree.
ans_ci <- calculate_mrt_effect_size(
data = dat,
id = "id",
outcome = "outcome",
treatment = "treatment",
time = "decision_point",
rand_prob = "prob_treatment",
availability = "availability",
covariates = "covariate1",
do_bootstrap = TRUE,
boot_replications = 100
)
head(ans_ci)
#> time beta_hat s_hat beta_sm s_sm estimate lower upper
#> 1 1 -0.12483 1.1385 0.05883 1.090 0.05396 -0.218023 0.3026
#> 2 2 0.19453 1.0019 0.10218 1.108 0.09226 -0.107800 0.2949
#> 3 3 0.35603 1.1896 0.14478 1.123 0.12890 -0.046402 0.2888
#> 4 4 0.08961 0.9933 0.18764 1.137 0.16505 -0.004002 0.2923
#> 5 5 0.24938 1.2536 0.22957 1.148 0.19993 0.020610 0.3485
#> 6 6 0.27749 1.2622 0.26572 1.160 0.22910 0.040336 0.3878The returned object is a data frame with:
time — decision pointbeta_hat — raw (unsmoothed) estimated excursion
effects_hat — raw (unsmoothed) estimated outcome scalebeta_sm — smoothed excursion effect (equals
beta_hat if smooth = FALSE)s_sm — smoothed outcome scale (equals
s_hat if smooth = FALSE)estimate — standardized effect
beta_sm / s_smlower, upper — bootstrap confidence bounds
(present when do_bootstrap = TRUE)A simple numerical summary:
summary(ans_ci)
#>
#> Call:
#> calculate_mrt_effect_size(data = dat, id = "id", outcome = "outcome",
#> treatment = "treatment", time = "decision_point", rand_prob = "prob_treatment",
#> availability = "availability", covariates = "covariate1",
#> do_bootstrap = TRUE, boot_replications = 100)
#>
#> Participants: 100
#> Decision points: 50
#> Smoothing: LOESS (span = 0.25, degree = 1)
#> Bootstrap: 100 replications; alpha = 0.05
#>
#> Standardized effect summary:
#> Mean Median Min Time_at_Min Max Time_at_Max
#> 1 0.9037 0.9811 0.05396 1 1.489 45
#>
#> Bootstrap CI summary:
#> Mean CI Width Median CI Width Pct CI Excludes 0
#> 1 0.3801 0.3659 92To improve CI stability, increase the number of bootstrap replications. For example:
The plot below shows the standardized effect estimate with bootstrap confidence bounds.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.