runDiagnostics: functions to create observed vs fitted and fitted vs scaled...

View source: R/runDiagnostics.R

runDiagnosticsR Documentation

functions to create observed vs fitted and fitted vs scaled pearsons residual plots

Description

functions to create observed vs fitted and fitted vs scaled pearsons residual plots

Usage

runDiagnostics(model, plotting = "b", save = FALSE, label = NULL)

Arguments

model

Fitted model object (glm or gam)

plotting

Plotting options (default='b'). b: returns both plots, f: returns observed vs fitted only and r: returns scale pearsons residual plot only.

save

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

label

Character string indicating an label to be added to the plot when using save = TRUE. Can also include a pathway to a directory of choice.

Value

Two plots:

Observed vs Fitted

Plot of observed vs fitted with concordence correlation and marginal R-squared printed in the plot title.

Fitted vs scaled Pearsons residuals

The red line is a locally weighted least squares regression line of all of the residuals.

Examples

# load data
data(ns.data.re)

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

runDiagnostics(model)


lindesaysh/MRSea documentation built on May 11, 2024, 11:30 p.m.