Skip to contents

The output is plots of cumulative residuals.

Usage

plotCumRes(
  model,
  varlist = NULL,
  label = "",
  save = FALSE,
  variableonly = FALSE
)

Arguments

model

Fitted model object (glm or gam)

varlist

Vector of covariate names (continous covariates only)

label

Label printed at the end of the plot name to identify it if save=TRUE.

save

(default=FALSE). Logical stating whether plot should be saved into working directory.

Value

Cumulative residual plots are returned for residuals ordered by each covariate in varlist, predicted value and index of observations (temporally). The blue dots are the residuals The black line is the line of cumulative residual. On the covariate plots (those in varlist) the grey line indicates what we would expect from a well fitted covariate. i.e. one that is fitted with excessive knots.

Note: if the covariate is discrete in nature (like the example below), there will be a lot of overplotting of residuals.

Examples

# load data
data(ns.data.re)

model<-gamMRSea(birds ~ observationhour + as.factor(floodebb) + as.factor(impact), 
           family='quasipoisson', data=ns.data.re)

plotCumRes(model, varlist=c('observationhour'))
#> [1] "Calculating cumulative residuals"
#> Error in mutate(., Predicted = fitted(model), Index = 1:n()): could not find function "mutate"