R: Diagnostic Plots

diagnostic-plots {bsts} | R Documentation

## Diagnostic Plots

### Description

Diagnostic plots for distributions of residuals.

### Usage

      qqdist(draws, ...)
      AcfDist(draws, lag.max = NULL, xlab = "Lag", ylab = "Autocorrelation", ...)

### Arguments

`draws` | A matrix of Monte Carlo draws of residual errors. Each row is a Monte Carlo draw, and each column is an observation. In the case of AcfDist successive observations are assumed to be sequential in time.
`lag.max` | The number of lags to plot in the autocorrelation function. See `acf`.
`xlab` | Label for the horizontal axis.
`ylab` | Label for the vertical axis.
`...` | Extra arguments passed to either `boxplot` (for `AcfDist`) or `PlotDynamicDistribution` (for `qqdist`).

### Details

`qqdist` sorts the columns of `draws` by their mean, and plots the resulting set of curves against the quantiles of the standard normal distribution. A reference line is added, and the mean of each column of draws is represented by a blue dot. The dots and the line are the transpose of what you get with `qqnorm` and `qqline`.

`AcfDist` plots the posterior distribution of the autocorrelation function using a set of side-by-side boxplots.

### Examples

    data(AirPassengers)
    y <- log(AirPassengers)

    ss <- AddLocalLinearTrend(list(), y)
    ss <- AddSeasonal(ss, y, nseasons = 12)
    model <- bsts(y, ss, niter = 500)

    r <- residuals(model)
    par(mfrow = c(1,2))
    qqdist(r)   ## A bit of departure in the upper tail
    AcfDist(r)

[Package bsts version 0.9.6 Index]