sim.rho: Simulate proportion remaining for full generation (rho)

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hmob_funcs.R

Description

A function that takes output from the calc.p function and simulates one stochastic realization of rho. The function does so by calculating the mean and variance of p at the level indicated by the level argument, and then derives the shape and rate parameters for the beta distribution.

Usage

1
sim.rho(p, level)

Arguments

p

an array produced by the calc.p function giving the proportion of travellers remaining after n generations

level

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

Value

a numerical matrix when level = 'route'

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.pi(), sim.tau()

Examples

1
2
3
4
d <- read.csv("./data/trip_durations_longform_metadata_13_34_42_85_10_14_16_99_urban_rural.csv", stringsAsFactors=F)
d <- mob.data.array(d=d, time='month', variable='duration', agg.int=1)
p <- calc.prop.remain(d=d, gen.t=3)
rho.hat <- sim.rho(p=p, level='route')

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