Description Usage Arguments Value Author(s) See Also Examples
This function calculates the highest posterior density (HPD) interval for the aggregated
waiting time distributions returned by the calc.wait.time
function. The function
calculates the maximum of each aggregated probability distribution along with the HPD intervals given by ci
.
Code adapted from the hpd
function in the TeachingDemos
package.
1 | calc.hpd(x, ci = 0.95)
|
x |
aggregated waiting time distributions for each district (output from |
ci |
a scalar or vector giving the HPD intervals to be calculated (default = 0.95) |
a dataframe
John Giles
Other simulation:
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.rho()
,
sim.tau()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | load("./output/simulations/13/influenza.Rdata")
x <- sim$B$wait.time # basic gravity model
#x <- sim$R$wait.time # gravity model with duration
agg <- calc.wait.time(x)
hpd <- calc.hpd(agg, ci=c(0.5, 0.95))
par(mfrow=c(3,4))
for (i in 1:nrow(hpd)) {
plot(agg[i,], type='l', main=paste("district ", hpd$district[i]), ylab='Waiting time density')
abline(v=hpd$lo95[i], lty=2, col='red')
abline(v=hpd$hi95[i], lty=2, col='red')
abline(v=hpd$max[i], col='red')
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.