# ordiresids: Plots of Residuals and Fitted Values for Constrained... In vegan: Community Ecology Package

## Description

The function provides `plot.lm` style diagnostic plots for the results of constrained ordination from `cca`, `rda` and `capscale`. Normally you do not need these plots, because ordination is descriptive and does not make assumptions on the distribution of the residuals. However, if you permute residuals in significance tests (`anova.cca`), you may be interested in inspecting that the residuals really are exchangeable and independent of fitted values.

## Usage

 ```1 2 3``` ```ordiresids(x, kind = c("residuals", "scale", "qqmath"), residuals = "working", type = c("p", "smooth", "g"), formula, ...) ```

## Arguments

 `x` Ordination result from `cca`, `rda` or `capscale`. `kind` The type of plot: `"residuals"` plot residuals against fitted values, `"scale"` the square root of absolute residuals against fitted values, and `"qqmath"` the residuals against expected distribution (defaults `qnorm`), unless defined differently in the `formula` argument). `residuals` The kind of residuals and fitted values. The argument is passed on to `fitted.cca` with alternatives `"working"` and `"response"`. `type` The type of plot. The argument is passed on to lattice functions. `formula` Formula to override the default plot. The formula can contain items `Fitted`, `Residuals`, `Species` and `Sites` (provided that names of species and sites are available in the ordination result). `...` Other arguments passed to lattice functions.

## Details

The default plots are similar as in `plot.lm`, but they use `Lattice` functions `xyplot` and `qqmath`. The alternatives have default formulae but these can be replaced by the user. The elements available in formula or in the `groups` argument are `Fitted`, `Residuals`, `Species` and `Sites`.

## Value

The function return a `Lattice` object that can displayed as plot.

## Author(s)

Jari Oksanen

`plot.lm`, `Lattice`, `xyplot`, `qqmath`.

## Examples

 ```1 2 3 4``` ```data(varespec) data(varechem) mod <- cca(varespec ~ Al + P + K, varechem) ordiresids(mod) ```

### Example output ```Loading required package: permute