Description Usage Arguments References Examples
Computes the Deviance Information Criterion for individual level models
1 | epidic (burnin, niter, LLchain, LLpostmean)
|
burnin |
Burnin period for MCMC |
niter |
Number of MCMC iterations |
LLchain |
Loglikelihood values from the MCMC output |
LLpostmean |
Loglikelihood value of the model with posterior mean of estimates |
Spiegelhalter, D., Best, N., Carlin, B., Van der Linde, A. (2002). Bayesian Measures of Model Complexity and Fit. Journal of the Royal Statistical Society. Series B (Statistical Methodology), 64(4), 583-639.
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 | ## Example 1: spatial SI model
# generate 100 individuals
x <- runif(100, 0, 10)
y <- runif(100, 0, 10)
covariate <- runif(100, 0, 2)
out1 <- epidata(type = "SI", n = 100, Sformula = ~covariate, tmax = 15,
sus.par = c(0.1, 0.3), beta = 5.0, x = x, y = y)
unif_range <- matrix(c(0, 0, 10000, 10000), nrow = 2, ncol = 2)
# estimate parameters
mcmcout <- epimcmc(out1, tmax = 15, niter = 1500,
Sformula = ~covariate,
sus.par.ini = c(0.003, 0.01), beta.ini =0.01,
pro.sus.var = c(0.1, 0.1),pro.beta.var = 0.5,
prior.sus.par = unif_range,
prior.sus.dist = c("uniform","uniform"), prior.beta.dist = "uniform",
prior.beta.par = c(0, 10000), adapt = TRUE, acc.rate = 0.5 )
# store the estimates
sus.parameters = c(mean(unlist(mcmcout$Estimates[1])), mean(unlist(mcmcout$Estimates[2])))
beta.par = mean(unlist(mcmcout$Estimates[3]))
# likelihood value
loglike <- epilike(out1, tmax = 15, Sformula = ~covariate, sus.par = sus.parameters,
beta = beta.par)
# deviance information criterion calculation for the above epidemic
dic <- epidic(burnin = 500, niter = 1500, LLchain = mcmcout$Loglikelihood,
LLpostmean = loglike)
dic
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.