residuals: Extract model residuals

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/check.R

Description

Generic fundtion that extracts model residuals from a 'mobility.model' object.

Usage

1
residuals(object, type, ...)

Arguments

object

a mobility.model object produced by the mobility function

type

the type of residuals to be returned. Available residual types include: 'deviance' (default), 'pearson', and 'raw'.

...

further arguments passed to or from other methods

Details

Residual types are calculated as:

raw

y_i - μ_i

pearson

(y_i - μ_i)/√{μ_i}

deviance

sign(y_i - μ_i) * √(2(log(y_i/μ_i) - (y_i - μ_i)))

Where, y_i is the observed data and μ_i is the value predicted by the model using the mean of parameter posterior distributions

Value

a matrix containing model residuals

Author(s)

John Giles

See Also

Other model: check(), compare(), fit_jags(), fit_prob_travel(), mobility(), predict(), summary()

Examples

1
2
3
mod <- mobility(data=mobility_matrices, model='gravity', type='transport', DIC=TRUE)

residuals(mod, type='pearson')

COVID-19-Mobility-Data-Network/mobility documentation built on Nov. 22, 2021, 12:17 a.m.