plot.lmvar: Plot diagnostics for an 'lmvar' object

Description Usage Arguments Details Value Examples

Description

This function produces 5 plots which should help to judge the goodness of an 'lmvar' fit.

Usage

1
2
3
## S3 method for class 'lmvar'
plot(x, which = c(1:3, 5), id.n = 3, cex.id = 0.75,
  show = TRUE, ...)

Arguments

x

Object of class 'lmvar'

which

Integer vector slecting which of the 5 plots is produced

id.n

Integer, the number of 'extreme' observations that are labelled in the plots

cex.id

Numeric, scale-factor for the size of the observation labels in the plots

show

Boolean, if TRUE the number of the plot is shown in the plot-title and the name of x is shown in the label of the x-axis.

...

for compatibility with plot generic

Details

The plots are intended to be a quick and easy way to get an impression of the goodness-of-fit. The function is intended for an interactive R-session and users must hit <enter> before each plot is deplayed. The following plots can be produced.

  1. A plot of the residuals y - μ versus the fitted values μ.

  2. A QQ-plot, showing the z-score (y - μ) / σ resulting from the fit versus the z-score calculated from the sample quantiles. The sample quantiles are calculated as ppoints(n) with n the number of obervations in x.

  3. A histogram of the distribution of the quantiles of the response values. The quantiles are calculated under the assumption that the response values are normally distributed with expected values μ and standard deviations σ.

  4. A plot of the z-scores versus the fitted values.

  5. A scale-location plot showing the square root of the absolute z-scores versus the fitted values.

If relevant, plots show the average y-value as a red line. This line is created by the function panel.smooth. If relevant, plots show the expected average y-value as a dotted gray line.

To suppress labelling of observations in the plots, set id.n to zero or a negative value. If id.n is set to a value equal to or larger than the number of observations in x, all points in the plots are labelled.

Value

There is no return value. The function only shows plots in the graphics output device.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
if (interactive()){

# As example we use the dataset 'cats' from the library 'MASS'.
library(MASS)

# We regress the cats heart weight 'Hwt' onto its body weight 'Bwt'
X = model.matrix(~ Bwt - 1, cats)
fit = lmvar(cats$Hwt, X_mu = X, X_sigma = X)

# Display all plots
plot(fit)

# Display two plots that focus on the shape of the distribution
plot(fit, which = c(2, 3))

# Suppress plot number and name of the 'lmvar' object being plot in  plot 3
plot(fit, which = 3, show = FALSE)

# Label the 5 observations with the most extreme residuals in plot 1
plot(fit, which = 1, id.n = 5)

}

lmvar documentation built on May 16, 2019, 5:06 p.m.