Skip to contents

Creates a comprehensive set of diagnostic plots for a LAME (Longitudinal Additive and Multiplicative Effects) model, including MCMC diagnostics, parameter evolution over time, and longitudinal goodness-of-fit checks. This is the default plot method for LAME objects.

Usage

# S3 method for class 'lame'
plot(
  x,
  which = c(1, 2, 3, 4),
  time.points = NULL,
  ask = FALSE,
  pages = c("single", "multiple"),
  ...
)

Arguments

x

an object of class "lame" from fitting a LAME model

which

numeric or character vector specifying which plots to produce: 1 or "trace" = MCMC trace plots, 2 or "density" = posterior density plots, 3 or "gof" = longitudinal goodness-of-fit plots, 4 or "effects" = additive and multiplicative effects, 5 or "network" = network snapshots at selected times. Default is c(1,2,3,4) to show main diagnostic plots.

time.points

numeric vector of time points for network snapshots (only used if "network" in which). Default is c(1, middle, last).

ask

logical; if TRUE, user is prompted before each plot page

pages

character string specifying how to arrange plots: "single" = one comprehensive page (default), "multiple" = separate pages for each plot type

...

additional arguments (currently not used)

Value

NULL (invisibly). Plots are displayed as side effects.

Details

The function produces a multi-panel plot containing:

MCMC trace plots

Shows mixing and convergence of key parameters

Posterior distributions

Density plots of regression coefficients and variance components

Longitudinal GOF

Time series of observed network statistics with posterior predictive intervals

Effects over time

Evolution of additive effects across time periods (if applicable)

Network snapshots

Visualization of network at selected time points

The plot adapts to the longitudinal structure:

  • Shows temporal trends in network statistics

  • Highlights composition changes if actors enter/exit

  • Displays credible intervals for time-varying statistics

Author

Cassy Dorff, Shahryar Minhas, Tosin Salau

Examples

if (FALSE) { # \dontrun{
# Fit a LAME model
fit <- lame(Y_list, X_list, R = 2)

# Default comprehensive plot
plot(fit)

# Only MCMC diagnostics
plot(fit, which = c("trace", "density"))

# Include network snapshots at specific times
plot(fit, which = c(3, 4, 5), time.points = c(1, 5, 10))

# Separate pages for each plot type
plot(fit, pages = "multiple")
} # }