plot.boral {boral} | R Documentation |

## Plots of a fitted boral object

### Description

Produces a set of four plots relating to the fitted boral object, which can be used for (some basic0 residual analysis. If some of the columns are ordinal, then a single confusion matrix is also produced.

### Usage

```
## S3 method for class 'boral'
plot(x, est = "median", include.ranef = TRUE, jitter = FALSE, ...)
```

### Arguments

`x` |
An object of class "boral". |

`est` |
A choice of either the posterior median ( |

`jitter` |
If |

`include.ranef` |
If response-specific random intercepts were included as part of the fitted model, then this determines whether the predicted random effects will be used in the calculated of the fitted values and Dunn-Smyth residuals. When set to |

`...` |
Additional graphical options to be included in. These include values for |

### Details

A set of four plots are provided:

Plot of Dunn-Smyth residuals against the linear predictors. For ordinal responses, things are more ambiguous due to the lack of single definition for "linear predictor". Therefore, instead of linear predictors the Dunn-Smyth residuals are plotted against the fitted values (defined as the level with the highest fitted probability). It is fully acknowledged that this makes things hard to interpret if only some of your columns are ordinal.

Plot of Dunn-Smyth residuals against the row index/names of the response matrix.

Plot of Dunn-Smyth residuals against the column index/names of the response matrix.

A normal quantile-quantile plot of the Dunn-Smyth residuals.

For ordinal responses, a single confusion matrix between the predicted levels (as based on the class with the highest probability) and true levels is aso returned. The table pools the results over all columns assumed to be ordinal.

### Note

Due the inherent stochasticity, Dunn-Smyth residuals and consequently the plots will be slightly different time this function is run. Note also the fitted values and residuals are calculated from point estimates of the parameters, as opposed to a fully Bayesian approach (please see details in `fitted.boral`

and `ds.residuals`

). Consequently, it is recommended that this function is run several times to ensure that any trends observed in the plots are consistent throughout the runs.

As mentioned above, for ordinal responses things are much more challenging as there is no single definition for "linear predictor". Instead of linear predictors then, for the first plot the Dunn-Smyth residuals are plotted against the fitted values, defined as the level with the highest fitted probability. It is fully acknowledged that this makes things VERY hard to interpret if only some of your columns are ordinal though. Suggestions to improve this are welcome!!!

### Author(s)

Francis K.C. Hui [aut, cre], Wade Blanchard [aut]

Maintainer: Francis K.C. Hui <fhui28@gmail.com>

### See Also

`fitted.boral`

to obtain the fitted values, `ds.residuals`

to obtain Dunn-Smyth residuals and details as to what they are.

### Examples

```
## Not run:
## NOTE: The values below MUST NOT be used in a real application;
## they are only used here to make the examples run quick!!!
example_mcmc_control <- list(n.burnin = 10, n.iteration = 100,
n.thin = 1)
testpath <- file.path(tempdir(), "jagsboralmodel.txt")
library(mvabund) ## Load a dataset from the mvabund package
data(spider)
y <- spider$abun
spiderfit_pois <- boral(y, family = "poisson", lv.control = list(num.lv = 2),
row.eff = "fixed", mcmc.control = example_mcmc_control
model.name = testpath)
par(mfrow = c(2,2))
plot(spiderfit_pois)
## A distinct fan pattern is observed in the plot of residuals
## versus linear predictors plot.
spiderfit_nb <- boral(y, family = "negative.binomial", lv.control = list(num.lv = 2),
row.eff = "fixed", mcmc.control = example_mcmc_control,
model.name = testpath)
par(mfrow = c(2,2))
plot(spiderfit_nb)
## The fan shape is not as clear now,
## and the normal quantile plot also suggests a better fit to the data
## End(Not run)
```

*boral*version 2.0.2 Index]