
Plot observed and predicted outcomes by cluster over time
Source:R/plot_clusters.R
plot_clusters.RdPlot observed and predicted outcomes by cluster over time
Value
A list with a `ggplot2` object of the actual (and predicted, if applicable) outcomes by cluster.
Examples
# Load data
test_data <- load_data(time ="period", cluster_id = "cluster", individual_id = NULL,
treatment = "trt", outcome = "outcome_cont", data = sw_data_example)
# Plot just the dataset
plot_clusters(test_data)
# Analyze using TATE estimand for exposure times 1 through 4
results_tate <- analyze(dat = test_data, method = "mixed", estimand_type = "TATE",
estimand_time = c(1, 4), exp_time = "ETI")
# Plot analysis results (with predicted lines) by cluster
plot_clusters(results_tate)