plot.sdlrm: Diagnostic Plots for the Modified Skew Discrete Laplace...

plot.sdlrmR Documentation

Diagnostic Plots for the Modified Skew Discrete Laplace Regression

Description

This function provides plots for diagnostic analysis of a modified skew discrete Laplace regression fit.

Usage

## S3 method for class 'sdlrm'
plot(
  x,
  which = 1:4,
  type = c("quantile", "pearson", "response"),
  ask = prod(graphics::par("mfcol")) < length(which) && grDevices::dev.interactive(),
  pch = "+",
  lty = 2,
  ...
)

Arguments

x

an object of class "sdlrm", a result of a call to sdlrm.

which

numeric; if a subset of the plots is required, specify a subset of the numbers 1:6.

type

character; specifies which residual should be produced in the envelope plot. The available options are "quantile" (default), "pearson", and "response" (raw residuals, y - mu).

ask

logical; if TRUE, the user is asked before each plot.

pch, lty, ...

graphical parameters (see par)

Details

The plot method for "sdlrm" objects provides six types of diagnostic plots in the following order:

Residuals vs fitted values

a plot of the residuals against fitted values.

Residuals vs observation indices.

an index plot of the residuals against observation indices.

Normal probability plot

a normal probability plot of the residuals.

Fitted vs observed frequencies

a bar plot with comparisons of the observed and fitted frequencies.

Sample autocorrelation plot

sample autocorrelation function plot of the residuals.

Sample partial autocorrelation plot

sample partial autocorrelation function plot of the residuals.

The which argument can be used to select a subset of the implemented plots. Default is which = 1:4.

Value

plot method for "sdlrm" objects returns six types of diagnostic plots.

Author(s)

Francisco F. de Queiroz <felipeq@ime.usp.br>

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

Examples

## Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit with a model only for the mean (mode = 1)
fit <- sdlrm(difference ~ group, data = pss, xi = 1)

## Available plots (using the randomized quantile residuals):
# Residuals versus fitted values
plot(fit, which = 1)

# Residuals versus observation indices
plot(fit, which = 2)

# Normal Q-Q plot
plot(fit, which = 3)

# Observed versus fitted frequencies
plot(fit, which = 4)

# Sample autocorelation function of residuals
plot(fit, which = 5)

# Sample partial autocorelation of residuals
plot(fit, which = 6)

sdlrm documentation built on April 12, 2025, 1:15 a.m.