calc.prop.remain: Proportion of individuals remaining for full epidemic...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hmob_funcs.R

Description

This function calculates the proportion of individuals that remain in a location for all of epidemic generation n. The value is represented by the variable p_jt, which is defined as the effective probability if individuals that stay for a full epidemic generation when they travel to destination j at time t:

p_ij = Pr(remaining for all of n^th epidemic generation | generation time g)

Because the Namibia mobility data spans 4 years there are many potential time intervals for which to calculate the proportion of individuals remaining for full epidemic generation. The sub.samp argument randomly selects X number of these generations to reduce computation time.

Usage

1
calc.prop.remain(d, gen.t, max.gen = NULL, sub.samp = NULL)

Arguments

d

a three- or four-dimensional array containing route- or month-level trip duration counts produced by the mob.data.array function. Note that calc.prop.remain assumes that the duration data array is NOT aggregated (e.g. mob.data.array argument agg.int=1)

gen.t

the time interval in days used to define the epidemic generation

max.gen

the maximum number of generations to evaluate proportion of individuals remaining

sub.samp

scalar indicating the number of generations to subsample, if NULL (default), will use all observed generation times in the data (which will increase computation time for large numbers of locations)

Value

if d is a month-level duration data array, then a 4D array with values between 0 and 1 is returned. If d is a route-level duration data array, then returns a 3D array is returned.

Author(s)

John Giles

See Also

Other simulation: calc.hpd(), calc.prop.inf(), 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.rho(), sim.tau()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Duration data for the purpose of subsetting districts
load('./data/duration_data_arrays_1day_full.Rdata') 

# Proportion travellers remaining for full epidemic generation based on subsample of 10, where the generation time is 14 days (measles)
p1 <- calc.prop.remain(d=y.route, gen.t=14, sub.samp=10)
p2 <- calc.prop.remain(d=y.month, gen.t=14, sub.samp=10)

# Get destination-level mean and variance
p1.mean <- apply(p1, 2, mean, na.rm=TRUE)
p1.var <- apply(p1, 2, var, na.rm=TRUE)

p2.mean <- apply(p2, 2, mean, na.rm=TRUE)
p2.var <- apply(p2, 2, var, na.rm=TRUE)

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