| plot_cits_result | R Documentation |
Visualizes the results of a controlled interrupted time series (CITS) model fitted using 'cits()'. The function plots observed data points, fitted values, and 95
plot_cits_result(
res,
y_col = "y",
T_col = "T",
E_col = "E",
intervention_time = NULL
)
res |
A list returned by 'cits()', containing model output and fitted values. |
y_col |
Name of the outcome variable (string). Corresponds to 'y' in 'cits()'. |
T_col |
Name of the time index variable (string). Corresponds to 'T' in 'cits()'. |
E_col |
Name of the group indicator variable (string). Corresponds to 'E' in 'cits()'. |
intervention_time |
Optional numeric. If provided, a vertical dashed line is drawn at this time to mark the intervention point. |
A ggplot object showing observed points, fitted lines, confidence ribbons, and (optionally) the intervention line.
# Synthetic example
df <- data.frame(
T = 1:100,
E = rep(c(0,1), each = 100),
I = c(rep(0,50), rep(1,50), rep(0,50), rep(1,50)),
y = rnorm(200)
)
# Use lightweight ARMA search for examples (CRAN speed requirement)
res <- cits(
df,
y_col = "y",
T_col = "T",
I_col = "I",
E_col = "E",
p_range = 0:1,
q_range = 0:0
)
plot_cits_result(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.