# DGobj.simul.mechanistic

##### Simulation of a DG object under a mechanistic model

Simulation of a DG object under a mechanistic model generating a multi-strain epidemic with multiple introductions over a square grid.

- Keywords
- datagen

##### Usage

```
DGobj.simul.mechanistic(sqrtn, size1, size2, theta, beta, M, delta,
plots = FALSE)
```

##### Arguments

- sqrtn
[Positive integer] Side size of the square grid over which the epidemic is simulated. The inter-node distance in the grid is one in the horizontal and vertical directions. The total number of grid nodes is sqrtn^2.

- size1
[Positive integer] Maximum number of grid nodes where pathogen isolates are collected (sampling sites).

- size2
[Positive integer] Maximum number of pathogen isolates sampled in each sampling site.

- theta
[Vector of positive numerics] Fitness coefficients of the strains. The length of this vector determines the number of strains in the epidemic.

- beta
[Vector of postive numerics of size 2] Immigration parameters. The first component is the expected number of immigration nodes for every strain. The second component is the expected number of pathogen units in each immigration node.

- M
[Positive integer] Number of time steps of the epidemic.

- delta
[Positive numeric] Dispersal parameter.

- plots
[Logical] If TRUE, plots are produced. The plots show the curse of the epidemic for each strain and the proportion of each strain in space at the final time step.

##### Details

The effective number of sampling sites is the maximum of `size1`

and the number of sites occupied at the last time of the simulation.

In each sampling site, the effective number of sampled isolates is the maximum of `size2`

and the number of pathogen isolates in the site.

The immigration time \(T^{immigr}_s\) at which the sub-epidemic due to strain \(s\) is initiated is randomly drawn between 1 and `M`

with probabilities \(P(T^{immigr}_s=t)=(M-t)^2/\sum_{k=1}^M (M-k)^2\).

The number of immigration nodes is drawn from the binomial distribution with size `sqrtn`

\(^2\) and with expectation given by the first component of `beta`

. The immigration nodes are uniformly drawn in the grid.

At time \(T^{immigr}_s\), the numbers of pathogen units of strain \(s\) at the immigration nodes are independently drawn under the Poisson distribution with mean equal to the second component of `beta`

.

##### Value

An object from the DG class.

##### Note

Demographic measurements, say \(Y_i(M-1)\) and \(Y_i(M)\), made at the grid nodes and at times `M`

-1 and `M`

, are transformed into the values
\( Z_i=\log\left(\frac{1+Y_i(M-1)}{1+Y_i(M)}\right)\) characterizing the temporal growth of the epidemic in space at the end of the epidemic. The growth variable \(Z_i\) is given in the thrid column of the demographic slot of the returned DG object.

##### References

Soubeyrand S., Tollenaere C., Haon-Lasportes E. & Laine A.-L. (2014). Regression-based ranking of pathogen strains with respect to their contributions to natural epidemics. PLOS ONE 9(1): e86591.

##### See Also

##### Examples

```
# NOT RUN {
## Simulation of a data set
DGmech=DGobj.simul.mechanistic(sqrtn=10, size1=30, size2=10, theta=c(1.5,2,3),
beta=c(5,5), M=7, delta=0.2)
summary(DGmech)
## Simulation of a data set and plots of the sub-epidemics for the strains and their
## proportions in space at the final time step
DGmech=DGobj.simul.mechanistic(sqrtn=10, size1=30, size2=10, theta=c(1.5,2,3),
beta=c(5,5), M=7, delta=0.2, plots=TRUE)
summary(DGmech)
# }
```

*Documentation reproduced from package StrainRanking, version 1.2, License: GPL (>= 2.0) | file LICENSE*