| plot_prism | R Documentation |
Creates a matrix of scatterplots for diagnosing antedependence structure.
The upper triangle shows ordinary scatterplots of Y[i] vs Y[j].
The lower triangle shows PRISM plots: residuals from regressing Y[i] and Y[j]
on the intervenor variables Y[i+1], ..., Y[j-1].
plot_prism(
y,
time_labels = NULL,
pch = 20,
cex = 0.6,
col_upper = "steelblue",
col_lower = "firebrick",
main = "PRISM Diagnostic Plot"
)
y |
Numeric matrix with n_subjects rows and n_time columns. |
time_labels |
Optional character vector of time point labels. Default uses column names or "T1", "T2", etc. |
pch |
Point character for scatterplots. Default 20 (filled circle). |
cex |
Point size. Default 0.6. |
col_upper |
Color for upper triangle plots. Default "steelblue". |
col_lower |
Color for lower triangle (PRISM) plots. Default "firebrick". |
main |
Overall title. Default "PRISM Diagnostic Plot". |
Under an antedependence model of order p, the partial correlation between
Y[i] and Y[j] given the intervenors should be zero when |i-j| > p.
This means PRISM plots in the lower triangle should show no association
for lags greater than p.
Interpretation:
Upper triangle: Shows marginal associations between time points
Lower triangle (PRISM): Shows conditional associations after removing effects of intervenor variables
If AD(1) holds: Only the first sub-diagonal of lower triangle should show association
If AD(2) holds: First two sub-diagonals should show association
Invisibly returns NULL. Called for side effect (plotting).
Zimmerman, D. L. and Nunez-Anton, V. (2009). Antedependence Models for Longitudinal Data. CRC Press. Chapter 2.
partial_corr for numerical partial correlations
data("bolus_inad")
plot_prism(bolus_inad$y)
# With custom labels
plot_prism(bolus_inad$y, time_labels = paste0("Hour ", seq(0, 44, by = 4)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.