This function takes a fitted mobility mobility.model object and calculates goodness of fit metrics. If the Deviance Information Criterin (DIC) was calculated in the supplied model object, it is included in output. When plots = TRUE, two plots are shown containing the posterior distribution of trip counts compared to observed data and a Normal Q-Q plot showing the quantiles of model residuals against those expected from a Normal distribution.

check(object, plots, ...)

Arguments

object

a mobility.model object produced by the mobility function

plots

logical indicating whether to plot the Posterior Predictive Check and Normal Q-Q Plot (default = TRUE)

...

further arguments passed to or from other methods

Value

a list of goodness of fit measures

Details

Goodness of fit metrics include:

DIC

Deviance Information Criterion

RMSE

Root Mean Squared Error

MAPE

Mean Absolute Percent Error

R2

R-squared

See also

Author

John Giles

Examples

mod <- mobility(data=mobility_matrices, model='gravity', type='transport', DIC=TRUE)
#> ::Fitting transport gravity model for 10 origins and 10 destinations::
#> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 70 #> Unobserved stochastic nodes: 32 #> Total graph size: 417 #> #> Initializing model #> #> NOTE: Stopping adaptation #> #>
check(mod)
#> $DIC #> [1] 49310.87 #> #> $RMSE #> [1] 1105.722 #> #> $MAPE #> [1] 5.08787 #> #> $R2 #> [1] 0.7017928 #>