# 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)
# Plots of epidemic progression (optional)
plot(out1, plottype = "spatial")
plot(out1, plottype = "curve", curvetype = "newinfect")
## Example 2: spatial SIR model
# generate infectious period(=3) for 100 individuals
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)
plot(out2, plottype = "spatial")
plot(out2, plottype = "curve", curvetype = "newinfect")
## Example 3: SI network model
contact1 <- matrix(rbinom(10000, 1, 0.1), nrow = 100, ncol = 100)
contact2 <- matrix(rbinom(10000, 1, 0.1), nrow = 100, ncol = 100)
diag(contact1[,] ) <- 0
diag(contact2[,] ) <- 0
contact <- array(c(contact1, contact2), dim = c(100, 100, 2))
out3 <- epidata(type = "SI", n = 100, tmax = 15, sus.par = 0.3, beta = c(3.0, 5.0),
contact = contact)
plot(out3, plottype = "curve", curvetype = "complete")
plot(out3, plottype = "curve", curvetype = "susceptible")
plot(out3, plottype = "curve", curvetype = "newinfect")
plot(out3, plottype = "curve", curvetype = "totalinfect")
# }
Run the code above in your browser using DataLab