sim.pi: Simulate connectivity matrix (pi)

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hmob_funcs.R

Description

This function takes the mean μ_π_{ijt} of the estimated posterior distribution of π_{ijt} (the probability of movement from district i to district i in time t) and returns one stochastic realization of the connectivity matrix. Each stochastic realization is produced by returning the vector \boldsymbolπ_{i\{j\}t} from a Dirichlet distribution.

Usage

1
sim.pi(mu, level)

Arguments

mu

a three dimensional array giving the mean of the posterior distribution for π_{ijt}

level

the level of the data for which to generate the stochastic realization of pi (e.g. destination-, route- or month-level)

Value

a numerical matrix (when level = 'route') with values between 0 and 1, where rows (all j destination districts) sum to 1

Author(s)

John Giles

See Also

Other simulation: calc.hpd(), calc.prop.inf(), calc.prop.remain(), calc.timing.magnitude(), calc.wait.time(), decay.func(), get.age.beta(), get.beta.params(), sim.TSIR.full(), sim.TSIR(), sim.combine.dual(), sim.combine(), sim.gravity.duration(), sim.gravity(), sim.lambda(), sim.rho(), sim.tau()

Examples

1
2
3
load('./output/gravity_model_8dists.Rdata')          # Gravity model parameters
tmp <- get.param.vals(n.districts=8, name='pi', level='month', stats=s.grav)
pi.hat <- sim.connectivity(mu=tmp$mean)

gilesjohnr/hmob documentation built on Aug. 8, 2020, 1:26 a.m.