knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(MRTAnalysis)
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 @luers2019standardized 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)
We 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)
The returned object is a data frame with:
time — decision point beta_hat — raw (unsmoothed) estimated excursion effect s_hat — raw (unsmoothed) estimated outcome scale beta_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_sm lower, upper — bootstrap confidence bounds (present when do_bootstrap = TRUE)A simple numerical summary:
summary(ans_ci)
To improve CI stability, increase the number of bootstrap replications. For example:
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 = 1000 )
The plot below shows the standardized effect estimate with bootstrap confidence bounds.
plot(ans_ci)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.