## Example 1: spatial SI model
# generate 100 individuals
x <- runif(100,0,10)
y <- runif(100,0,10)
covariate <- runif(100,0,2)
out <- epidata(type="SI",n=100, Sformula=~covariate, tmax=15, alpha=c(0.1,0.3), beta=5.0, x=x, y=y)
# Plots of epidemic progression (optional)
epispatial(type="SI", x=x, y=y, inftime=out$inftime)
epicurve(type="SI", inftime=out$inftime, plottype="newinfect")
## Example 2: spatial SIR model
# generate infectious period(=3) for 100 individuals
lambda <- rep(3,100)
epidata(type="SIR",n=100, tmax=15, alpha=0.3,beta=5.0, infperiod=lambda, x=x, y=y)
## Example 3: SI network model
## Not run: ------------------------------------
# contact1 <- matrix(rbinom(1000,1,0.1), nrow=100, ncol=100)
# contact2 <- matrix(rbinom(1000,1,0.1), nrow=100, ncol=100)
# diag(contact1[,] ) <- 0
# diag(contact2[,] ) <- 0
# contact <- array(c(contact1,contact2),dim=c(100,100,2))
# epidata(type="SI", n=100, tmax=15, alpha=0.3,beta=c(3.0,5.0), contact=contact)
#
## ---------------------------------------------
Run the code above in your browser using DataLab