This function fits a variety of mobility models to a supplied movement matrix (M
) and covariates (D
and N
) using Bayesian MCMC inference.
The function specifies the type of mobility model and serves as a wrapper for the fit_jags
function.
mobility( data, model, type, hierarchical = FALSE, n_chain = 2, n_burn = 1000, n_samp = 1000, n_thin = 1, DIC = FALSE, parallel = FALSE )
data | a list containing mobility data and covariates. The list object must include EITHER
|
---|---|
model | character vector indicating which mobility model to fit to the data. Mobility models include: |
type | character vector indicating the particular sub-type of mobility model to fit.
See model list vignette for more detailed description of each model type. |
hierarchical | Applies only to the |
n_chain | number of MCMC sampling chains |
n_burn | number of iterations to discard before sampling of chains begins (burn in) |
n_samp | number of iterations to sample each chain |
n_thin | interval to thin samples |
DIC | logical indicating whether or not to calculate the Deviance Information Criterion (DIC) (default = |
parallel | logical indicating whether or not to run MCMC chains in parallel or sequentially (default = |
An object of class mobility.model
containing model information, data, and fitted model parameters
John Giles
mod <- mobility(data=mobility_matrices, model='gravity', type='transport')#>#> 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 #> #>mod <- mobility(data=mobility_matrices, model='radiation', type='finite')#>mod <- mobility(data=mobility_matrices, model='departure-diffusion', type='power')#>#> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 70 #> Unobserved stochastic nodes: 34 #> Total graph size: 970 #> #> Initializing model #> #> NOTE: Stopping adaptation #> #>