Description Usage Arguments Value Author(s) References See Also Examples
View source: R/transdistfuncs.r
This function estimates the weight of each theta value by performing a user defined number of replications with the get.transdist.theta
function. The weights
of each theta are calculated as the number of simulations in which a case at time t1
and t2
are separated by theta transmission events.
1 | est.transdist.theta.weights(case.times, gen.t.mean, t.density, t1, n.rep = 100)
|
case.times |
a vector giving the occurrence time for each case |
gen.t.mean |
the mean generation time of the infecting pathogen |
t.density |
a vector giving the generation time density of the infecting pathogen |
t1 |
time step to begin simulation |
n.rep |
number of replications in the simulation (default = 100) |
a three-dimensional array containing the mean normalized theta weights estimated across all replications
John Giles, Justin Lessler, and Henrik Salje
Salje H, Cummings DAT and Lessler J (2016). “Estimating infectious disease transmission distances using the overall distribution of cases.” Epidemics, 17, pp. 10–18. ISSN 1755-4365, doi: 10.1016/j.epidem.2016.10.001.
Other transdist:
est.transdist.bootstrap.ci()
,
est.transdist.temporal.bootstrap.ci()
,
est.transdist.temporal()
,
est.transdist()
,
get.transdist.theta()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | set.seed(1)
gen.t.mean <- 7
gen.t.sd <- 2
t1 <- 0
# Normally distributed transmission kernel with mean and standard deviation = 100
dist.func <- alist(n=1, a=1/100, rexp(n, a))
# Simulate epidemic
a <- sim.epidemic(R=5,
gen.t.mean=gen.t.mean,
gen.t.sd=gen.t.sd,
min.cases=5,
tot.generations=3,
trans.kern.func=dist.func)
# Get case times
a <- a[order(a[,3]),]
case.times <- round(a[,3])
unique.times <- unique(case.times)
ntimes <- length(unique.times)
# Generation time distribution
max.t <- round(max(unique.times) - t1) - 1
n.step <- round(max.t/gen.t.mean)
gen <- rep(0, max.t*2)
for (i in 1:n.step){gen <- gen + dnorm(1:(max.t*2), gen.t.mean*i, gen.t.sd*i)}
gen[1] <- 0 # No instantaneous infections
t.density <- gen/sum(gen)
# Estimation of theta weights matrix
b <- est.transdist.theta.weights(case.times=case.times,
n.rep=3,
gen.t.mean=gen.t.mean,
t1=t1,
t.density=t.density)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.