est.transdist.temporal.bootstrap.ci {IDSpatialStats} | R Documentation |
Bootstrapped confidence intervals for the change in mean transmission distance over time
Description
Estimates bootstrapped confidence intervals for the mean transmission distance over the duration of the epidemic by running est.trandsdist
on all cases
occuring up to each time point.
Usage
est.transdist.temporal.bootstrap.ci(
epi.data,
gen.t.mean,
gen.t.sd,
t1,
max.sep,
max.dist,
n.transtree.reps = 100,
mean.equals.sd = FALSE,
theta.weights = NULL,
boot.iter,
ci.low = 0.025,
ci.high = 0.975,
parallel = FALSE,
n.cores = NULL
)
Arguments
epi.data |
a three-column matrix giving the coordinates ( |
gen.t.mean |
mean generation time of the infecting pathogen |
gen.t.sd |
standard deviation of generation time of the infecting pathogen |
t1 |
time step to begin estimation of transmission distance |
max.sep |
maximum number of time steps allowed between two cases (passed to the |
max.dist |
maximum spatial distance between two cases considered in calculation |
n.transtree.reps |
number of time to simulate transmission trees when estimating the weights of theta (passed to the |
mean.equals.sd |
logical term indicating if the mean and standard deviation of the transmission kernel are expected to be equal (default = FALSE) |
theta.weights |
use external matrix of theta weights. If NULL (default) the matrix of theta weights is automatically estimated by calling the |
boot.iter |
the number of bootstrapped iterations to perform |
ci.low |
low end of the confidence interval (default = 0.025) |
ci.high |
high end of the confidence interval (default = 0.975) |
parallel |
run bootstraps in parallel (default = FALSE) |
n.cores |
number of cores to use when |
Value
a four-column numeric matrix containing the point estimate for mean transmission distance, low and high bootstrapped confidence intervals, and the sample size up to each time step
Author(s)
John Giles, Justin Lessler, and Henrik Salje
References
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.
See Also
Other transdist:
est.transdist()
,
est.transdist.bootstrap.ci()
,
est.transdist.temporal()
,
est.transdist.theta.weights()
,
get.transdist.theta()
Examples
set.seed(123)
# Exponentially 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=2,
gen.t.mean=7,
gen.t.sd=2,
tot.generations=8,
min.cases=30,
trans.kern.func=dist.func)
a <- a[sample(1:nrow(a), 70),] # subsample a to 70 observations
# Estimate change in mean transmission kernel over time with confidence intervals
b <- est.transdist.temporal.bootstrap.ci(epi.data=a,
gen.t.mean=7,
gen.t.sd=2,
t1=0,
max.sep=1e10,
max.dist=1e10,
n.transtree.reps=10,
mean.equals.sd=TRUE,
boot.iter=10,
ci.low=0.025,
ci.high=0.975,
n.cores=2)
plot(b[,2], pch=19, col='grey', ylim=c(min(b[,1:3], na.rm=TRUE), max(b[,2:4], na.rm=TRUE)),
xlab='Time step', ylab='Estimated mean of transmission kernel')
abline(h=100, col='red', lty=2)
axis(3, 1:nrow(b), b[,5])
low <- loess(b[,2] ~ as.vector(1:nrow(b)), span=1)
low <- predict(low, newdata=data.frame(as.vector(1:nrow(b))))
lines(low, lwd=3, col='blue')
for(i in 3:4) {
low <- loess(b[,i] ~ as.vector(1:nrow(b)), span=1)
low <- predict(low, newdata=data.frame(as.vector(1:nrow(b))))
lines(low, lty=2, lwd=3, col='blue')
}