Learn R Programming

gctsc (version 0.1.3)

plot.gctsc: Diagnostic Plots for Fitted Gaussian Copula Time Series Models

Description

Produces a set of diagnostic plots based on randomized quantile residuals and PIT values for objects of class gctsc.

Usage

# S3 method for gctsc
plot(
  x,
  caption = rep("", 5),
  main = rep("", 5),
  level = 0.95,
  col.lines = "gray",
  ...
)

Value

This function is called for its side effects and returns invisible().

Arguments

x

An object of class gctsc, the result of a call to gctsc.

caption

Optional character vector of length 6 to use as captions for each plot.

main

Optional main title for the plots (recycled if shorter than the number of plots shown).

level

Confidence level for the Q--Q plot envelope (default is 0.95).

col.lines

Color for reference lines in residual and ACF/PACF plots.

...

Additional arguments passed to plotting functions.

Details

The function displays up to five plots: time series of residuals, Q--Q plot, PIT histogram, and ACF/PACF plots of the residuals. These plots help assess model fit and potential misspecification.

The five diagnostic plots shown are:

  1. Time series plot of randomized quantile residuals.

  2. Q--Q plot comparing residuals to a standard normal distribution.

  3. Histogram of probability integral transform (PIT) values.

  4. Autocorrelation function (ACF) of the residuals.

  5. Partial autocorrelation function (PACF) of the residuals.

See Also

residuals.gctsc for computing the residuals used in the plots.

Examples

Run this code
# Simulate data from a Poisson AR(1) model
set.seed(123)
n <- 2000
mu <- 5
phi <- 0.5
arma_order <- c(1, 0)
y <- sim_poisson(mu = mu, tau = phi, arma_order = arma_order, nsim = n)$y

# Fit the model using the CE method
fit <- gctsc(y~1,
  marginal = poisson.marg(link = "identity", lambda.lower = 0),
  cormat = arma.cormat(p = 1, q = 0),
  method = "CE",
  options = gctsc.opts(seed = 1, M = 1000),
  c = 0.5
)

# Produce diagnostic plots
plot(fit)

Run the code above in your browser using DataLab