# DGobj.simul.regression

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

Simulation of a DG object under a regression model generating proportions of pathogen strains in each node of a square grid.

- Keywords
- datagen

##### Usage

```
DGobj.simul.regression(sqrtn, size1, size2, theta, alpha.function, sigma,
plots = FALSE)
```

##### Arguments

- sqrtn
[Positive integer] Side size of the square grid over which the proportions are 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] Number of grid nodes where pathogen isolates are collected (sampling sites).

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

- theta
[Vector of numerics] Regression coefficients representing the fitness of the strains. The length of this vector determines the number of strains.

- alpha.function
[Function] Function whose value is a matrix of positive numerics with number of columns equal to the number of strains and the number of rows is the number of grid nodes. Each row of the matrix provides the parameters of the Dirichlet distribution used to draw the proportions of strains at each node. The argument of the function is a 2-column matrix of coordinates.

- sigma
[Postive numeric] Standard deviation of the white noise.

- plots
[Logical] If TRUE, plots are produced. The plots show the proportion of each strain in space.

##### Value

An object from the DG class.

##### Note

The function `DGobj.simul.regression`

generates a growth variable (third column of the demographic slot of the returned DG object) satisfying:
$$Z_i=\left(\sum_{s=1}^S p_i(s) \code{theta}[s])\right) + \eta_i,$$
for each demographic sampling site \(i\). In this expression, \((p_i(1),...,p_i(S))\) are the proportions of the strains at sampling site \(i\), where \(S\) is the number of different strains. These proportions are drawn in Dirichlet distributions. `theta`

\([s]\) denotes the \(s\)-th component of `theta`

. \(\eta_i\) denotes a centered random normal variable (white noise) with standard deviation `sigma`

.

##### 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

DGobj-class, DGobj.rawdata, DGobj.simul.mechanistic, generation.alpha.3strains

##### Examples

```
# NOT RUN {
## Simulation of a data set
DGreg=DGobj.simul.regression(sqrtn=10, size1=30, size2=10, theta=c(1.5,2,3),
alpha.function=generation.alpha.3strains, sigma=0.1)
summary(DGreg)
## Simulation of a data set and plots of the proportions in space the strains
DGreg=DGobj.simul.regression(sqrtn=10, size1=30, size2=10, theta=c(1.5,2,3),
alpha.function=generation.alpha.3strains, sigma=0.1,plots=TRUE)
summary(DGreg)
# }
```

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