% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/diagnostics.R
\name{plot_prism}
\alias{plot_prism}
\title{PRISM plot (Partial Residual Intervenor Scatterplot Matrix)}
\usage{
plot_prism(
  y,
  time_labels = NULL,
  pch = 20,
  cex = 0.6,
  col_upper = "steelblue",
  col_lower = "firebrick",
  main = "PRISM Diagnostic Plot"
)
}
\arguments{
\item{y}{Numeric matrix with n_subjects rows and n_time columns.}

\item{time_labels}{Optional character vector of time point labels.
Default uses column names or "T1", "T2", etc.}

\item{pch}{Point character for scatterplots. Default 20 (filled circle).}

\item{cex}{Point size. Default 0.6.}

\item{col_upper}{Color for upper triangle plots. Default "steelblue".}

\item{col_lower}{Color for lower triangle (PRISM) plots. Default "firebrick".}

\item{main}{Overall title. Default "PRISM Diagnostic Plot".}
}
\value{
Invisibly returns NULL. Called for side effect (plotting).
}
\description{
Creates a matrix of scatterplots for diagnosing antedependence structure.
The upper triangle shows ordinary scatterplots of \code{Y[i]} vs \code{Y[j]}.
The lower triangle shows PRISM plots: residuals from regressing \code{Y[i]} and \code{Y[j]}
on the intervenor variables \verb{Y[i+1], ..., Y[j-1]}.
}
\details{
Under an antedependence model of order p, the partial correlation between
\code{Y[i]} and \code{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:
\itemize{
\item Upper triangle: Shows marginal associations between time points
\item Lower triangle (PRISM): Shows conditional associations after
removing effects of intervenor variables
\item If AD(1) holds: Only the first sub-diagonal of lower triangle
should show association
\item If AD(2) holds: First two sub-diagonals should show association
}
}
\examples{
\donttest{
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)))
}

}
\references{
Zimmerman, D. L. and Nunez-Anton, V. (2009). Antedependence Models for
Longitudinal Data. CRC Press. Chapter 2.
}
\seealso{
\code{\link{partial_corr}} for numerical partial correlations
}
