# NOT RUN {
## 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)
alphapar1 <- matrix(c(1, 1, 1, 1), ncol = 2, nrow = 2)
betapar1 <- c(10, 2)
epi <- epimcmc(object = out1, tmin = 1, tmax = 15,
niter = 1000, sus.par.ini = c(1, 1), beta.ini = 1,
Sformula = ~covariate, pro.sus.var = c(0.5, 0.3), pro.beta.var = 0.1,
prior.sus.dist = c("gamma", "gamma"), prior.beta.dist = "gamma",
prior.sus.par = alphapar1, prior.beta.par = betapar1,
adapt = TRUE, acc.rate = 0.5)
epi
## Example 2: spatial SIR model
lambda <- rep(3, 100)
out2 <- epidata(type = "SIR", n = 100, tmax = 15, sus.par = 0.3, beta = 5.0, infperiod = lambda,
x = x, y = y)
alphapar2 <- c(1, 1)
betapar2 <- c(1, 1)
epi2 <- epimcmc(object = out2, tmin = 1, tmax = 15,
niter = 1000, sus.par.ini = 1, beta.ini = 1,
Sformula = NULL, pro.sus.var = 0.3, pro.beta.var = 0.1,
prior.sus.dist = "gamma", prior.beta.dist = "gamma",
prior.sus.par = alphapar2, prior.beta.par = betapar2,
adapt = FALSE, acc.rate = NULL)
epi2
# }
Run the code above in your browser using DataLab