R Under development (unstable) (2025-09-25 r88874 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library("EpiILM") Loading required package: coda Loading required package: adaptMCMC Loading required package: parallel Loading required package: Matrix Loading required package: LaplacesDemon > > set.seed(789) > # generating the XY coordinates of individuals: > x <- runif(256, 0, 100) > y <- runif(256, 0, 100) > > # generating the sus. covariate: > A <- round(rexp(256, 1/100)) > # simulating an epidemic: > out_cov <- epidata(type = "SI", n = 256, tmax = 10, x = x, y = y, Sformula = ~A, sus.par = c(0.01, 0.05), beta = 2) > > # performing the MCMC using the epimcmc function: > t_end <- max(out_cov$inftime) > unif_range <- matrix(c(0, 0, 1, 1), nrow = 2, ncol = 2) > > mcmcout_M8 <- epimcmc(out_cov, Sformula = ~A, + tmax = t_end, niter = 100, + sus.par.ini = c(0.03, 0.005), beta.ini = 2, + pro.sus.var = c(0.005, 0.005), pro.beta.var = 0.01, + prior.sus.dist = c("uniform", "uniform"), prior.sus.par = unif_range, + prior.beta.dist = "uniform", prior.beta.par = c(0, 10), + adapt = TRUE, acc.rate = 0.5) generate 100 samples > > summary(mcmcout_M8) Model: SI distance-based discrete-time ILM Method: Markov chain Monte Carlo (MCMC) Iterations = 1:100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 100 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE alpha.1 0.07818 0.06499 0.006499 0.021637 alpha.2 0.05911 0.01923 0.001923 0.003013 beta.1 2.06607 0.07078 0.007078 0.024573 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% alpha.1 0.002556 0.03000 0.06800 0.09392 0.2445 alpha.2 0.005000 0.05666 0.05878 0.06395 0.1005 beta.1 1.992376 2.02379 2.04600 2.10372 2.3060 > > > mcmcout_M9 <- epimcmc(out_cov, + tmax = t_end, niter = 100, sus.par.ini = 0.01, + beta.ini = 2, pro.sus.var = 0.1, pro.beta.var = 0.5, + prior.sus.dist = "uniform", prior.sus.par = c(0, 3), + prior.beta.dist = "uniform", prior.beta.par = c(0, 10), + adapt = TRUE, acc.rate = 0.5) generate 100 samples > > summary(mcmcout_M9) Model: SI distance-based discrete-time ILM Method: Markov chain Monte Carlo (MCMC) Iterations = 1:100 Thinning interval = 1 Number of chains = 1 Sample size per chain = 100 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE alpha.1 0.711 0.2264 0.02264 0.10137 beta.1 1.620 0.1150 0.01150 0.05539 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% alpha.1 0.1568 0.5334 0.8332 0.8356 1.056 beta.1 1.4639 1.5656 1.6314 1.6400 1.937 > > > #set.seed(23456) > predepi1<-pred.epi(object = out_cov, xx = mcmcout_M8, criterion = "newly infectious", n.samples = 50, tmin = 1, Sformula = ~A) generate 50 epidemics > > loglike1 <- epilike(object = out_cov, tmax = t_end, Sformula = ~A, sus.par = c(0.08806, 0.04421), beta = 1.96839) > loglike2 <- epilike(object = out_cov, tmax = t_end, sus.par = 0.735, beta = 1.554) > > dic1 <- epidic(burnin = 10, niter = 100, LLchain = mcmcout_M8$Loglikelihood, LLpostmean = loglike1) > dic1 [1] 816.5224 > > dic2 <- epidic(burnin = 10, niter = 100, LLchain = mcmcout_M9$Loglikelihood, LLpostmean = loglike2) > dic2 [1] 1052.309 > > proc.time() user system elapsed 3.23 0.12 3.34