residuals.gw: Extract and Visualize GWRM Model Residuals

Description Usage Arguments Details Value Examples

View source: R/residuals.R

Description

residuals is a method which extracts model residuals from "gw", commonly returned by gw function. Optionally, it produces a normal plot with a simulated envelope of the residuals.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'gw'
residuals(
  object,
  type = "pearson",
  rep = 19,
  envelope = FALSE,
  title = "Simulated Envelope of Residuals",
  trace = FALSE,
  parallel = TRUE,
  ncores = 2,
  ...
)

Arguments

object

object of class "gw" holding the fitted model

type

type of residuals to be extracted. Default is "pearson". "response" and "deviance" are also available. Deviance residuals are defined as 2[ln f(y_i|y_i)-ln f(\widehat{μ}_i|y_i)], so that their sum is the value of the deviance statistic.

rep

number of replications for envelope construction. Default is 19, that is the smallest 95 percent band that can be built.

envelope

a logical value to specify if the envelope is required.

title

a title for the envelope.

trace

if TRUE a sort of information is printed during the running time.

parallel

if TRUE use parallel executation.

ncores

is the number of cores that we use if parallel is TRUE.

...

further arguments passed to or from other methods.

Details

The usual Q-Q plot may show an unsatisfactory pattern of the residuals of a model fitted: then we are led to think that the model is badly specificated. The normal plot with simulated envelope indicates that under the distribution of the response variable the model is OK if only a few points fall off the envelope.

Value

Residuals values and plot

Examples

1
2
3
4
data(goals)
set.seed(1)
fit0 <- gw(goals ~ position, data = goals[sample(1:nrow(goals), 75), ])
residuals(fit0, type = "pearson", rep = 19, envelope = TRUE, trace = FALSE, ncores = 2)

GWRM documentation built on July 26, 2021, 5:09 p.m.

Related to residuals.gw in GWRM...