Learn R Programming

mvabund (version 2.2-5.6)

plot.manylm: Plot Diagnostics for a manylm or a manyglm Object

Description

Four plots (selectable by which) are currently available: a plot of residuals against fitted values, a Normal Q-Q plot, a Scale-Location plot of $\sqrt{| residuals |}$ against fitted values, a plot of Cook's distances versus row labels. By default, all of them are provided. The function is not yet available for manyglm object

Usage

## S3 method for class 'manylm':
plot(
  x, which=1:4, caption=c("Residuals vs Fitted", "Normal Q-Q", 
  "Scale-Location", "Cook's distance"), overlay=TRUE, 
  n.vars=12, var.subset=NULL, sub.caption=NULL, studentized= TRUE, ...)

## S3 method for class 'manyglm':
plot(
  x, which=1, caption=c("Residuals vs Fitted", "Normal Q-Q", 
  "Scale-Location", "Cook's distance"), overlay=TRUE, 
  n.vars=12, var.subset=NULL, sub.caption=NULL, ...)

Arguments

x
manylm object or manyglm object, typically the result of a call to manylm or manyglm.
which
if a subset of the plots is required, specify a subset of the numbers 1:4.
caption
captions to appear above the plots
overlay
logical, whether or not the different variables should be overlaid on a single plot.
n.vars
the number of variables to include in the plot.
var.subset
the variables to include in the plot.
sub.caption
common title---above figures if there are multiple; used as sub (s.title) otherwise. If NULL, as by default, a possible shortened version of deparse(x$call) is used.
...
other parameters to be passed through to plotting functions.
studentized
logical indicating whether studentized or standardized residuals should be used for plot 2 and 3.

Details

plot.manylm is used to check the linear model assumptions that are made when fitting a model via manylm. Similarly, plot.manyglm checks the generalised linear model assumptions made when using manyglm. You should check the residual vs fits plot for no pattern (hence no suggestion of failure of key linearity and mean-variance assumptions). For manylm fits of small datasets, it is desirable that residuals on the normal Q-Q plot be close to a straight line, although in practice the most important thing is to make sure there are no big outliers and no suggestion of strong skew in the data. Some technical details on usage of this function: sub.caption - by default the function call - is shown as a subtitle (under the x-axis title) on each plot when plots are on separate pages, or as a subtitle in the outer margin (if any) when there are multiple plots per page. The Scale-Location plot, also called Spread-Location or S-L plot, takes the square root of the absolute residuals in order to diminish skewness ($\sqrt{| E |}$ is much less skewed than $| E |$ for Gaussian zero-mean $E$). If studentized=FALSE the S-L, the Q-Q, and the Residual-Leverage plot, use standardized residuals which have identical variance (under the hypothesis) otherwise studentized residuals are used. Unlike other plotting functions plot.manylm and plot.manyglm respectively do not have a subset argument, the subset needs to be specified in the manylm or respectively manyglm function. For all arguments that are formally located after the position of ..., positional matching does not work. For restrictions on filename see R's help on eps/pdf/jpeg. Note that keep.window will be ignored if write.plot is not show.

See Also

manylm

Examples

Run this code
require(graphics)

data(spider)
spiddat <- mvabund(spider$abund)
X <- spider$x

## plot the diagnostics for the linear fit of the spider data
spidlm <- manylm(spiddat~X)
plot(spidlm,which=1:2,col.main="red",cex=3,overlay=FALSE)

plot(spidlm,which=1:4,col.main="red",cex=3,overlay=TRUE)

Run the code above in your browser using DataLab