1 - Running a simple simulation

library(landsepi)

General presentation of the package

See ?lansdepi for a complete description of the model, assumptions and available functions. See also the vignette list of parameters for a detailed description of all model parameters.
Take a quick overview of what landsepi can do.

Initialisation of simulation parameters

The function createSimulParams() will create a directory to store simulation outputs, and return an object of class LandsepiParams that will further contain all simulation parameters.

simul_params <- createSimulParams(outputDir = getwd())

In the following, the object simul_params is to be updated with all simulation parameters using set*() functions. For some specific parameters already set using set*() functions, they may be next updated using update*() functions. To help parameterisation, built-in parameters are available and may be loaded via load*() functions.

To avoid dependency issues between functions, we recommend to parameterise the simulation with the following order (functions in bold are crucial to run a simulation, others are optional):
- createSimulParams()
- setSeed()
- setTime()
- setPathogen()
- updateReproSexProb()
- setLandscape()
- setDispersal()
- setGenes()
- setCultivars()
- allocateCultivarGenes()
- allocateCroptypeCultivars()
- setCroptypes()
- allocateLandscapeCroptypes()
- setInoculum()
- updateSurvivalProb()
- setTreatments()
- setOutputs()
- checkSimulParams()
- runSimul()

Setting the seed and time parameters

A seed (for random number generator) is randomly generated when simul_params is initialised by createSimulParams(). If a specific seed is required, it can be set using the function setSeed():

simul_params@Seed
#> [1] 1727092025
simul_params <- setSeed(simul_params, seed = 1)
simul_params@Seed
#> [1] 1

The number of cropping seasons to simulate (e.g. 6 years) and the number of time steps per cropping season (e.g. 120 days/year) can be set using setTime():

simul_params <- setTime(simul_params, Nyears = 6, nTSpY = 120)
simul_params@TimeParam
#> $Nyears
#> [1] 6
#> 
#> $nTSpY
#> [1] 120

Setting pathogen parameters

Pathogen parameters must be stored in a list of aggressiveness components defined on a susceptible host for a pathogen genotype not adapted to resistance.

Buit-in parameterisation for different pathogens (e.g. rusts of cereal crops, mildew of grapevine, black sigatoka of banana) are available using function loadPathogen():

basic_patho_param <- loadPathogen(disease = "rust")
basic_patho_param
#> $name
#> [1] "rust"
#> 
#> $survival_prob
#> [1] 1e-04
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $infection_rate
#> [1] 0.4
#> 
#> $propagule_prod_rate
#> [1] 3.125
#> 
#> $latent_period_mean
#> [1] 10
#> 
#> $latent_period_var
#> [1] 9
#> 
#> $infectious_period_mean
#> [1] 24
#> 
#> $infectious_period_var
#> [1] 105
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0
basic_patho_param <- loadPathogen(disease = "mildew")
basic_patho_param
#> $name
#> [1] "mildew"
#> 
#> $survival_prob
#> [1] 1e-04
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $infection_rate
#> [1] 0.9
#> 
#> $propagule_prod_rate
#> [1] 2
#> 
#> $latent_period_mean
#> [1] 7
#> 
#> $latent_period_var
#> [1] 8
#> 
#> $infectious_period_mean
#> [1] 14
#> 
#> $infectious_period_var
#> [1] 22
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 5
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 1
basic_patho_param <- loadPathogen(disease = "sigatoka")
basic_patho_param
#> $name
#> [1] "sigatoka"
#> 
#> $survival_prob
#> [1] 0.5
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $infection_rate
#> [1] 0.02
#> 
#> $propagule_prod_rate
#> [1] 90.9
#> 
#> $latent_period_mean
#> [1] 25.5
#> 
#> $latent_period_var
#> [1] 1.5
#> 
#> $infectious_period_mean
#> [1] 22
#> 
#> $infectious_period_var
#> [1] 14
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0

This list may be updated to change a specific parameter. For instance, to change the infection rate to 50%:

basic_patho_param <- loadPathogen("rust")
basic_patho_param$infection_rate <- 0.5
basic_patho_param
#> $name
#> [1] "rust"
#> 
#> $survival_prob
#> [1] 1e-04
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $infection_rate
#> [1] 0.5
#> 
#> $propagule_prod_rate
#> [1] 3.125
#> 
#> $latent_period_mean
#> [1] 10
#> 
#> $latent_period_var
#> [1] 9
#> 
#> $infectious_period_mean
#> [1] 24
#> 
#> $infectious_period_var
#> [1] 105
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0

Alternatively, the list may be generated manually to control all parameters:

basic_patho_param <- list(infection_rate = 0.4
                          , latent_period_mean = 10
                          , latent_period_var = 9
                          , propagule_prod_rate = 3.125
                          , infectious_period_mean = 24
                          , infectious_period_var = 105
                          , survival_prob = 1e-4
                          , repro_sex_prob = 0
                          , sigmoid_kappa = 5.333
                          , sigmoid_sigma = 3
                          , sigmoid_plateau = 1
                          , sex_propagule_viability_limit = 1
                          , sex_propagule_release_mean = 1
                          , clonal_propagule_gradual_release = 0)

Then, the list is used to fuel the object simul_params via the function setPathogen():

simul_params <- setPathogen(simul_params, patho_params = basic_patho_param)
simul_params@Pathogen
#> $infection_rate
#> [1] 0.4
#> 
#> $latent_period_mean
#> [1] 10
#> 
#> $latent_period_var
#> [1] 9
#> 
#> $propagule_prod_rate
#> [1] 3.125
#> 
#> $infectious_period_mean
#> [1] 24
#> 
#> $infectious_period_var
#> [1] 105
#> 
#> $survival_prob
#> [1] 1e-04
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0

Setting the landscape and pathogen dispersal

The landscape (i.e. boundaries of fields) must be in shapefile format. Five built-in landscapes of about 150 fields are available using the function loadLandscape():

landscape <- loadLandscape(id = 1)
length(landscape)
#> [1] 155
plot(landscape, main = "Landscape structure")

The first Landscape available

See also tutorial on how to parameterise landscape and dispersal to use your own landscape and compute your own dispersal matrices.

Dispersal is given by a vectorised matrix giving the probability of dispersal from any field of the landscape to any other field. The size of the matrix must be the square of the number of fields in the landscape. It is thus specific to both the pathogen and the landscape. For rusts pathogens, a built-in dispersal matrix is available for each landscape using the function loadDispersalPathogen():

disp_patho_clonal <- loadDispersalPathogen(id = 1)[[1]]
head(disp_patho_clonal)
#> [1] 8.814254e-01 9.525884e-04 7.079895e-10 1.594379e-10 3.285800e-06
#> [6] 3.634297e-11
length(landscape)^2 == length(disp_patho_clonal)
#> [1] TRUE

Then, the object simul_params is updated with the landscape and dispersal matrix via the functions setLandscape() and setDispersalPathogen(), respectively:

simul_params <- setLandscape(simul_params, land = landscape)
simul_params <- setDispersalPathogen(simul_params, disp_patho_clonal)

Setting croptypes, cultivars and resistance genes

Fields of the landscape are cultivated with different croptypes that can rotate through time; each croptype is composed of a pure cultivar or a mixture; and each cultivar may carry one or several resistance genes.

Cultivars

Characteristics of each host genotype (i.e. cultivar) are summarised in a dataframe, which contains parameters representing the cultivar as if it was cultivated in a pure crop. Note that the name of the cultivar cannot accept spaces.
A buit-in parameterisation for classical types of cultivars is available using loadCultivar() to generate each line of the dataframe. Type “nonCrop” allows the simulation of forest, fallows, etc. i.e. everything that is not planted, does not cost anything and does not yield anything (with regard to the subject of the study).
It is advised to implement a susceptible cultivar at first line of the dataframe to allow pathogen initial inoculation in default parameterisation.

cultivar1 <- loadCultivar(name = "Susceptible", type = "wheat")
cultivar2 <- loadCultivar(name = "Resistant1", type = "wheat")
cultivar3 <- loadCultivar(name = "Resistant2", type = "banana")
cultivar4 <- loadCultivar(name = "Resistant3", type = "pepper")
cultivar5 <- loadCultivar(name = "Forest", type = "nonCrop")
cultivars <- data.frame(rbind(cultivar1, cultivar2, cultivar3, cultivar4, cultivar5)
                        , stringsAsFactors = FALSE)
cultivars
#>   cultivarName initial_density max_density growth_rate reproduction_rate
#> 1  Susceptible            0.10        2.00        0.10                 0
#> 2   Resistant1            0.10        2.00        0.10                 0
#> 3   Resistant2            0.90        1.80        0.02                 0
#> 4   Resistant3            1.75        1.75        0.00                 0
#> 5       Forest            0.00        2.00        0.00                 0
#>   yield_H yield_L yield_I yield_R planting_cost market_value
#> 1     2.5     0.0       0       0           225          200
#> 2     2.5     0.0       0       0           225          200
#> 3    46.8    46.8       0       0             0            0
#> 4     0.5     0.5       0       0             0            0
#> 5     0.0     0.0       0       0             0            0

Similarly as pathogen parameters, characteristics of the cultivars may be updated as required. For example, to change the growth rate of the susceptible cultivar:

cultivars[cultivars$cultivarName == "Susceptible", "growth_rate"] <- 0.2
cultivars
#>   cultivarName initial_density max_density growth_rate reproduction_rate
#> 1  Susceptible            0.10        2.00        0.20                 0
#> 2   Resistant1            0.10        2.00        0.10                 0
#> 3   Resistant2            0.90        1.80        0.02                 0
#> 4   Resistant3            1.75        1.75        0.00                 0
#> 5       Forest            0.00        2.00        0.00                 0
#>   yield_H yield_L yield_I yield_R planting_cost market_value
#> 1     2.5     0.0       0       0           225          200
#> 2     2.5     0.0       0       0           225          200
#> 3    46.8    46.8       0       0             0            0
#> 4     0.5     0.5       0       0             0            0
#> 5     0.0     0.0       0       0             0            0

Finally, the dataframe cultivars can also be generated entirely from scratch:

cultivars_new <- data.frame(cultivarName = c("Susceptible", "Resistant"),
                            initial_density =   c(0.1, 0.2),
                            max_density =       c(2.0, 3.0),
                            growth_rate =       c(0.1, 0.2),
                            reproduction_rate = c(0.0, 0.0),
                            yield_H =           c(2.5, 2.0),
                            yield_L =           c(0.0, 0.0),
                            yield_I =           c(0.0, 0.0),
                            yield_R =           c(0.0, 0.0),
                            planting_cost =   c(225, 300),
                            market_value =      c(200, 150),
                            stringsAsFactors = FALSE)
cultivars_new
#>   cultivarName initial_density max_density growth_rate reproduction_rate
#> 1  Susceptible             0.1           2         0.1                 0
#> 2    Resistant             0.2           3         0.2                 0
#>   yield_H yield_L yield_I yield_R planting_cost market_value
#> 1     2.5       0       0       0           225          200
#> 2     2.0       0       0       0           300          150

Note, assuming that only healthy hosts (state H) contribute to host growth, the production of healthy biomass between \(t\) and \(t+1\) is computed using the following logistic equation: \[H_{t+1} = H_{t} \times \left[1 + growth\_rate \times (1-\frac{N_{t}}{K})\right]\] with \(N_t\) the total number of individual hosts at time-step \(t\) and \(K\) the carrying capacity.

Resistance genes

This part can be skipped if no resistance gene is to be simulated. Characteristics of each plant resistance gene and each corresponding pathogenicity gene are summarised in a dataframe.
A built-in parameterisation for classical resistance sources is available using loadGene() to generate each line of the dataframe. Type “majorGene” is for completely efficient resistance to which pathogen may adapt via a single mutation.
Type “APR” stands for Adult Plant Resistance, i.e. a major gene which activates after a delay after planting, and type “QTL” is a partially efficient resistance source to which the pathogen may adapt gradually. The type “immunity” code for a completely efficient resistance gene that cannot be overcome, in such a way that infection is totally impossible; it is helpful to parameterise non-host cultivars.

gene1 <- loadGene(name = "MG 1", type = "majorGene")
gene2 <- loadGene(name = "Lr34", type = "APR")
gene3 <- loadGene(name = "gene 3", type = "QTL")
gene4 <- loadGene(name = "nonhost resistance", type = "immunity")
genes <- data.frame(rbind(gene1, gene2, gene3, gene4), stringsAsFactors = FALSE)
genes
#>             geneName efficiency age_of_activ_mean age_of_activ_var
#> 1               MG 1        1.0                 0                0
#> 2               Lr34        1.0                30               30
#> 3             gene 3        0.5                 0                0
#> 4 nonhost resistance        1.0                 0                0
#>   mutation_prob Nlevels_aggressiveness adaptation_cost relative_advantage
#> 1         1e-07                      2             0.5                0.5
#> 2         1e-07                      2             0.5                0.5
#> 3         1e-04                      6             0.5                0.5
#> 4         0e+00                      1             0.0                0.0
#>   tradeoff_strength target_trait recombination_sd
#> 1                 1           IR             1.00
#> 2                 1           IR             1.00
#> 3                 1           IR             0.27
#> 4                 1           IR             1.00

Similarly as pathogen parameters, characteristics of the genes may be updated as required. For example, to change the mutation probability of the pathogen with regard to its adaptation to “MG 1”:

genes[genes$geneName == "MG 1", "mutation_prob"] <- 1e-3
genes
#>             geneName efficiency age_of_activ_mean age_of_activ_var
#> 1               MG 1        1.0                 0                0
#> 2               Lr34        1.0                30               30
#> 3             gene 3        0.5                 0                0
#> 4 nonhost resistance        1.0                 0                0
#>   mutation_prob Nlevels_aggressiveness adaptation_cost relative_advantage
#> 1         1e-03                      2             0.5                0.5
#> 2         1e-07                      2             0.5                0.5
#> 3         1e-04                      6             0.5                0.5
#> 4         0e+00                      1             0.0                0.0
#>   tradeoff_strength target_trait recombination_sd
#> 1                 1           IR             1.00
#> 2                 1           IR             1.00
#> 3                 1           IR             0.27
#> 4                 1           IR             1.00

Alternatively, the dataframe genes can also be generated entirely from scratch:

genes_new <- data.frame(geneName =               c("MG1", "MG2"),
                        efficiency =             c(1.0  , 0.8  ),
                        age_of_activ_mean =      c(0.0  , 0.0  ),
                        age_of_activ_var =       c(0.0  , 0.0  ),
                        mutation_prob =          c(1E-7 , 1E-4),
                        Nlevels_aggressiveness = c(2    , 2    ),
                        adaptation_cost =        c(0.50 , 0.75 ),
                        relative_advantage =     c(0.50 , 0.75 ),
                        tradeoff_strength =      c(1.0  , 1.0  ),
                        target_trait =           c("IR" , "LAT"),
                        recombination_sd =       c(1.0,1.0),
                        stringsAsFactors = FALSE)
genes_new
#>   geneName efficiency age_of_activ_mean age_of_activ_var mutation_prob
#> 1      MG1        1.0                 0                0         1e-07
#> 2      MG2        0.8                 0                0         1e-04
#>   Nlevels_aggressiveness adaptation_cost relative_advantage tradeoff_strength
#> 1                      2            0.50               0.50                 1
#> 2                      2            0.75               0.75                 1
#>   target_trait recombination_sd
#> 1           IR                1
#> 2          LAT                1

Note that the column “efficiency” refers to the percentage of reduction of the targeted aggressiveness component on hosts carrying the gene. For example, a 80% efficient resistance against infection rate (target_trait = “IR”) means that the infection rate of a non-adapted pathogen is reduced by 80% on a resistant host compared to what it is on a susceptible host. For resistances targeting the latent period, the percentage of reduction is applied to the inverse of the latent period in such a way that latent period is higher in resistant than in susceptible hosts.

Allocating genes to cultivars

The object simul_params can be updated with setGenes() and setCultivars():

simul_params <- setGenes(simul_params, dfGenes = genes)
simul_params <- setCultivars(simul_params, dfCultivars = cultivars)
simul_params@Genes
#>                              geneName efficiency age_of_activ_mean
#> MG 1                             MG 1        1.0                 0
#> Lr34                             Lr34        1.0                30
#> gene 3                         gene 3        0.5                 0
#> nonhost resistance nonhost resistance        1.0                 0
#>                    age_of_activ_var mutation_prob Nlevels_aggressiveness
#> MG 1                              0         1e-03                      2
#> Lr34                             30         1e-07                      2
#> gene 3                            0         1e-04                      6
#> nonhost resistance                0         0e+00                      1
#>                    adaptation_cost relative_advantage tradeoff_strength
#> MG 1                           0.5                0.5                 1
#> Lr34                           0.5                0.5                 1
#> gene 3                         0.5                0.5                 1
#> nonhost resistance             0.0                0.0                 1
#>                    target_trait recombination_sd
#> MG 1                         IR             1.00
#> Lr34                         IR             1.00
#> gene 3                       IR             0.27
#> nonhost resistance           IR             1.00
simul_params@Cultivars
#>             cultivarName initial_density max_density growth_rate
#> Susceptible  Susceptible            0.10        2.00        0.20
#> Resistant1    Resistant1            0.10        2.00        0.10
#> Resistant2    Resistant2            0.90        1.80        0.02
#> Resistant3    Resistant3            1.75        1.75        0.00
#> Forest            Forest            0.00        2.00        0.00
#>             reproduction_rate yield_H yield_L yield_I yield_R planting_cost
#> Susceptible                 0     2.5     0.0       0       0           225
#> Resistant1                  0     2.5     0.0       0       0           225
#> Resistant2                  0    46.8    46.8       0       0             0
#> Resistant3                  0     0.5     0.5       0       0             0
#> Forest                      0     0.0     0.0       0       0             0
#>             market_value
#> Susceptible          200
#> Resistant1           200
#> Resistant2             0
#> Resistant3             0
#> Forest                 0

Then the function allocateCultivarGenes() allows the attribution of resistance genes to cultivars:

simul_params <- allocateCultivarGenes(simul_params
                                      , cultivarName = "Resistant1"
                                      , listGenesNames = c("MG 1"))
simul_params <- allocateCultivarGenes(simul_params
                                      , cultivarName = "Resistant2"
                                      , listGenesNames = c("Lr34", "gene 3"))
simul_params <- allocateCultivarGenes(simul_params
                                      , cultivarName = "Resistant3"
                                      , listGenesNames = c("nonhost resistance"))
simul_params@CultivarsGenes
#>             MG 1 Lr34 gene 3 nonhost resistance
#> Susceptible    0    0      0                  0
#> Resistant1     1    0      0                  0
#> Resistant2     0    1      1                  0
#> Resistant3     0    0      0                  1
#> Forest         0    0      0                  0

With this example of parameterisation:
- “Susceptible” is a susceptible cultivar (initially infected by a wild-type pathogen)
- “Resistant1” is a mono-resistant cultivar
- “Resistant2” is a pyramided cultivar
- “Resistant3” is a nonhost cultivar
- “Forest” is not a crop.
Infection is impossible on both “Resistance3” and “Forest”, but the former will be considered for host growth, yield and planting costs, whereas the latter won’t.

Allocating cultivars to croptypes

Characteristics of each croptype (a croptype is a set of hosts cultivated in a field with specific proportions) are summarised in a dataframe.
A buit-in parameterisation for classical croptypes is available using loadCroptypes() to generate the whole table filled with zeros:

croptypes <- loadCroptypes(simul_params, names = c("Susceptible crop"
                                                   , "Pure resistant crop"
                                                   , "Mixture"
                                                   , "Other"))
croptypes
#>   croptypeID        croptypeName Susceptible Resistant1 Resistant2 Resistant3
#> 1          0    Susceptible crop           0          0          0          0
#> 2          1 Pure resistant crop           0          0          0          0
#> 3          2             Mixture           0          0          0          0
#> 4          3               Other           0          0          0          0
#>   Forest
#> 1      0
#> 2      0
#> 3      0
#> 4      0

Then croptypes is updated by allocateCroptypeCultivars() to specify the composition of every croptype with regard to cultivars (and proportion for mixtures):

croptypes <- allocateCroptypeCultivars(croptypes
                                       , croptypeName = "Susceptible crop"
                                       , cultivarsInCroptype = "Susceptible")
croptypes <- allocateCroptypeCultivars(croptypes
                                       , croptypeName = "Pure resistant crop"
                                       , cultivarsInCroptype = "Resistant1")
croptypes <- allocateCroptypeCultivars(croptypes
                                       , croptypeName = "Mixture"
                                       , cultivarsInCroptype = c("Resistant2","Resistant3")
                                       , prop = c(0.4, 0.6))
croptypes <- allocateCroptypeCultivars(croptypes
                                       , croptypeName = "Other"
                                       , cultivarsInCroptype = "Forest")
croptypes
#>   croptypeID        croptypeName Susceptible Resistant1 Resistant2 Resistant3
#> 1          0    Susceptible crop           1          0        0.0        0.0
#> 2          1 Pure resistant crop           0          1        0.0        0.0
#> 3          2             Mixture           0          0        0.4        0.6
#> 4          3               Other           0          0        0.0        0.0
#>   Forest
#> 1      0
#> 2      0
#> 3      0
#> 4      1

Finally the object simul_params is updated using setCroptypes():

simul_params <- setCroptypes(simul_params, dfCroptypes = croptypes)
simul_params@Croptypes
#>   croptypeID        croptypeName Susceptible Resistant1 Resistant2 Resistant3
#> 0          0    Susceptible crop           1          0        0.0        0.0
#> 1          1 Pure resistant crop           0          1        0.0        0.0
#> 2          2             Mixture           0          0        0.4        0.6
#> 3          3               Other           0          0        0.0        0.0
#>   Forest
#> 0      0
#> 1      0
#> 2      0
#> 3      1

Alternatively, the dataframe croptypes can be generated from scratch:

croptypes <- data.frame(croptypeID = c(0, 1, 2, 3) ## must start at 0 and match with values from landscape "croptypeID" layer
                        , croptypeName = c("Susceptible crop"
                                           , "Pure resistant crop"
                                           , "Mixture"
                                           , "Other")
                        , Susceptible = c(1,0,0  ,0)
                        , Resistant1  = c(0,1,0  ,0)
                        , Resistant2  = c(0,0,0.5,0)
                        , Resistant3  = c(0,0,0.5,0)
                        , Forest      = c(0,0,0  ,1)
                        , stringsAsFactors = FALSE)
simul_params <- setCroptypes(simul_params, croptypes)

Allocating croptypes to fields of the landscape

The function allocateLandscapeCroptypes() manages the allocation of croptypes in time (for rotations of different croptypes on the same fields) and space (for mosaic of fields cultivated with different croptypes). See ?allocateLandscapeCroptypes for help in parameters.
Briefly, a rotation sequence is defined by a list. Each element of this list is a vector containing the indices of the croptypes that are cultivated simultaneously in the landscape. The “rotation_period” parameter defines the duration before switching from one element of “rotation_sequence” to the next. For each element of “rotation_sequence” is associated a vector of proportions of each croptype in the landscape (parameter “prop”). The parameter “aggreg” controls the level of spatial aggregation between croptypes.

For example, to generate a landscape whose surface is composed of 1/3 of forests, 1/3 of susceptible crop, and 1/3 of fields where a pure resistant crop is alternated with a mixture every two years:

# croptypeIDs cultivated in each element of the rotation sequence:
rotation_sequence <- list(c(0,1,3), c(0,2,3))
rotation_period <- 2  # number of years before rotation of the landscape
prop <- list(rep(1/3, 3), rep(1/3, 3)) # proportion (in surface) of each croptype 
aggreg <-1 # level of spatial aggregation
simul_params <- allocateLandscapeCroptypes(simul_params
                                           , rotation_period = rotation_period
                                           , rotation_sequence = rotation_sequence
                                           , prop = prop
                                           , aggreg = aggreg
                                           , graphic = TRUE)
# plot(simul_params@Landscape)

Setting the inoculum

To set the inoculum, the function setInoculum() is used. Several scenarios may be simulated and are summarized below. For the default scenario (see below), the function is simply parameterised with the probability for individual hosts to be infectious (i.e. at state ‘I’) at the beginning of the simulation (i.e. at t=0).

For more complex scenarios (i.e. to specify the location and genetic structure of the inoculum), the function setInoculum() can be used with a 3D-array of dimensions (Nhost, Npatho, Npoly) indicating the initial probability to be infectious, for each cultivar, pathogen genotype and polygon, respectively. To define this array, the functions getMatrixGenePatho(), getMatrixCultivarPatho(), getMatrixCroptypePatho() and getMatrixPolyPatho() acknowledge which pathogen genotypes can infect which genes, cultivars, croptypes and polygons respectively. Each function returns a matrix indicating if there is compatibility (value of 1, i.e. infection is possible) or not (value of 0, i.e. the cultivar is not present, or protected by a fully efficient resistance gene targeting the infection rate from the beginning of the cropping season).

getMatrixGenePatho(simul_params)
#>                    [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#> MG 1                  0    0    0    0    0    0    0    0    0     0     0
#> Lr34                  1    1    1    1    1    1    1    1    1     1     1
#> gene 3                1    1    1    1    1    1    1    1    1     1     1
#> nonhost resistance    0    0    0    0    0    0    0    0    0     0     0
#>                    [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21]
#> MG 1                   0     1     1     1     1     1     1     1     1     1
#> Lr34                   1     1     1     1     1     1     1     1     1     1
#> gene 3                 1     1     1     1     1     1     1     1     1     1
#> nonhost resistance     0     0     0     0     0     0     0     0     0     0
#>                    [,22] [,23] [,24]
#> MG 1                   1     1     1
#> Lr34                   1     1     1
#> gene 3                 1     1     1
#> nonhost resistance     0     0     0
getMatrixCultivarPatho(simul_params)
#>             [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> Susceptible    1    1    1    1    1    1    1    1    1     1     1     1
#> Resistant1     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant2     1    1    1    1    1    1    1    1    1     1     1     1
#> Resistant3     0    0    0    0    0    0    0    0    0     0     0     0
#> Forest         0    0    0    0    0    0    0    0    0     0     0     0
#>             [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23]
#> Susceptible     1     1     1     1     1     1     1     1     1     1     1
#> Resistant1      1     1     1     1     1     1     1     1     1     1     1
#> Resistant2      1     1     1     1     1     1     1     1     1     1     1
#> Resistant3      0     0     0     0     0     0     0     0     0     0     0
#> Forest          0     0     0     0     0     0     0     0     0     0     0
#>             [,24]
#> Susceptible     1
#> Resistant1      1
#> Resistant2      1
#> Resistant3      0
#> Forest          0
getMatrixCroptypePatho(simul_params)
#>                     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#> Susceptible crop       1    1    1    1    1    1    1    1    1     1     1
#> Pure resistant crop    0    0    0    0    0    0    0    0    0     0     0
#> Mixture                1    1    1    1    1    1    1    1    1     1     1
#> Other                  0    0    0    0    0    0    0    0    0     0     0
#>                     [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21]
#> Susceptible crop        1     1     1     1     1     1     1     1     1     1
#> Pure resistant crop     0     1     1     1     1     1     1     1     1     1
#> Mixture                 1     1     1     1     1     1     1     1     1     1
#> Other                   0     0     0     0     0     0     0     0     0     0
#>                     [,22] [,23] [,24]
#> Susceptible crop        1     1     1
#> Pure resistant crop     1     1     1
#> Mixture                 1     1     1
#> Other                   0     0     0
getMatrixPolyPatho(simul_params)[1:10,]
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#>  [1,]    0    0    0    0    0    0    0    0    0     0     0     0     0
#>  [2,]    0    0    0    0    0    0    0    0    0     0     0     0     0
#>  [3,]    1    1    1    1    1    1    1    1    1     1     1     1     1
#>  [4,]    0    0    0    0    0    0    0    0    0     0     0     0     1
#>  [5,]    0    0    0    0    0    0    0    0    0     0     0     0     1
#>  [6,]    0    0    0    0    0    0    0    0    0     0     0     0     1
#>  [7,]    1    1    1    1    1    1    1    1    1     1     1     1     1
#>  [8,]    0    0    0    0    0    0    0    0    0     0     0     0     1
#>  [9,]    0    0    0    0    0    0    0    0    0     0     0     0     1
#> [10,]    1    1    1    1    1    1    1    1    1     1     1     1     1
#>       [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24]
#>  [1,]     0     0     0     0     0     0     0     0     0     0     0
#>  [2,]     0     0     0     0     0     0     0     0     0     0     0
#>  [3,]     1     1     1     1     1     1     1     1     1     1     1
#>  [4,]     1     1     1     1     1     1     1     1     1     1     1
#>  [5,]     1     1     1     1     1     1     1     1     1     1     1
#>  [6,]     1     1     1     1     1     1     1     1     1     1     1
#>  [7,]     1     1     1     1     1     1     1     1     1     1     1
#>  [8,]     1     1     1     1     1     1     1     1     1     1     1
#>  [9,]     1     1     1     1     1     1     1     1     1     1     1
#> [10,]     1     1     1     1     1     1     1     1     1     1     1

Finally, the function loadInoculum() helps build the inoculum array as follows:
Let \(\phi_{v,p,i}\) be the probability for an individual of cultivar \(v\) to be infected by pathogen genotype \(p\) in field \(i\) at the beginning of the simulation. This probability is computed as follows: \[\phi_{v, p, i} = \phi^0 \times \phi^{host}_{v} \times \phi^{patho}_{p} \times \phi^{poly}_{i} \times I^{present}_{v,i} \times I^{compatible}_{v,p}\] with:
\(\phi^{host}\) the vector of probabilities for every host (parameter pI0_host),
\(\phi^{patho}\) the vector of probabilities for every pathogen genotype (parameter pI0_patho),
\(\phi^{poly}\) the vector of probabilities for every polygon (parameter pI0_poly),
\(\phi^0\) a multiplicative constant (parameter pI0_all).
\(I^{present}_{v,i}\) a binary variable equal to 1 if cultivar \(v\) is grown in field \(i\) (and 0 otherwise),
\(I^{compatible}_{v,p}\) a binary variable equal to 1 if pathogen genotype \(p\) can infect cultivar \(v\) at the beginning of the cropping season (and 0 otherwise).

Scenario 1 (default). Only the avirulent pathogen on the susceptible cultivar in all fields (global inoculum)

The default scenario is the presence of a pathogen genotype not adapted to any resistance gene, and present in all fields of the landscape where a susceptible cultivar is grown. In this situation, it is important that the susceptible cultivar is entered at the first line of the table cultivars. Then, one can simply use:

# Option 1: simply use the default parameterisation
simul_params <- setInoculum(simul_params, 5E-4)
 
# Option 2: use loadInoculum()
Npatho <- prod(simul_params@Genes$Nlevels_aggressiveness)
Nhost <- nrow(simul_params@Cultivars)
pI0 <- loadInoculum(simul_params, pI0_all=5E-4, pI0_host=c(1,rep(0, Nhost-1)), pI0_patho=c(1,rep(0, Npatho-1)))
simul_params <- setInoculum(simul_params, pI0)

Scenario 2. Only the avirulent pathogen on the susceptible cultivar in only some fields (local inoculum)

To specify the location of the inoculum, the parameters pI0_host, pI0_patho and pI0_poly are filled with values of 1 and 0 indicating if the cultivar, pathogen genotype and field are inoculated or not. The probability is given by the constant pI0_all. In this example, 5 fields in the landscape are randomly chosen among those cultivated with the susceptible cultivar:

Npatho <- prod(simul_params@Genes$Nlevels_aggressiveness)  ## Nb of pathogen genotypes
Nhost <- nrow(simul_params@Cultivars)  ## Nb of cultivars
Npoly <- nrow(simul_params@Landscape)  ## Nb of polygons in the landscape
Npoly_inoc <- 5  ## number of inoculated polygons
compatible_poly <- getMatrixPolyPatho(simul_params)[,1]  ## whether the avr pathogen can infect the polygons
id_poly <- sample(grep(1, compatible_poly), Npoly_inoc)  ## random polygon picked among compatible ones
pI0_poly <- as.numeric(1:Npoly %in% id_poly)  
pI0 <- loadInoculum(simul_params, pI0_all=5E-4, pI0_host=c(1,rep(0, Nhost-1)), pI0_patho=c(1,rep(0, Npatho-1)), 
                    pI0_poly=pI0_poly)
simul_params <- setInoculum(simul_params, pI0)

Scenario 3. A diversity of pathogen genotypes in the inoculum, in all fields (global inoculum)

This scenario matches with situations where several pathogen genotypes (including those adapted to resistance) are initially present in the landscape at the beginning of the simulation. In this example, different probabilities are given to the different pathogen genotypes using the parameters pI0_patho (the same rationale can be used for different probabilities on the different hosts using pI0_host).

## Example with 4 pathogen genotypes and 2 cultivars
pI0 <- loadInoculum(simul_params, pI0_patho=c(1E-3,1E-4,1E-4,1E-5), pI0_host=c(1,1))
simul_params <- setInoculum(simul_params, pI0)

Scenario 4. A diversity of pathogen genotypes in the inoculum, in some fields only (local inoculum)

Here, the example is similar as the previous one but only 5 fields are inoculated:

Npoly <- nrow(simul_params@Landscape)
Npoly_inoc <- 5  ## number of inoculated polygons 
id_poly <- sample(1:Npoly, Npoly_inoc)  ## random polygon 
pI0_poly <- as.numeric(1:Npoly %in% id_poly) 
pI0 <- loadInoculum(simul_params, pI0_patho=c(1E-3,1E-4,1E-4,1E-5), pI0_host=c(1,1), pI0_poly=pI0_poly)
simul_params <- setInoculum(simul_params, pI0)

Scenario 5. Custom 3D array to define the inoculum

At last, if one wants to run a simulation with a custom inoculum on the whole landscape, it can simply be entered in the function setInoculum() as an array of dimension (Nhost, Npatho, Npoly). Note that in this situation, host individuals may be infected regardless the resistance gene they carry.

## example with 2 cultivars, 4 pathogen genotypes and 5 fields
Nhost=2
Npatho=4
Npoly=5
pI0 <- array(data = 1:40 / 100, dim = c(Nhost, Npatho, Npoly))
simul_params <- setInoculum(simul_params, pI0)

To generate an array that accounts for the fact that (i) the cultivars are not grown in all polygons, and (ii) cultivars may carry a resistance gene that prevent initial infection by some pathogen genotypes, one can use the function loadInoculum() as follows:

corrected_pI0 <- loadInoculum(simul_params, pI0_mat=pI0)
simul_params <- setInoculum(simul_params, corrected_pI0)

Visualization

The 3D-array inoculum can be vizualised using the function inoculumToMatrix():

inoculumToMatrix(simul_params)[,,1:5]
#> , , 1
#> 
#>             [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> Susceptible    0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant1     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant2     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant3     0    0    0    0    0    0    0    0    0     0     0     0
#> Forest         0    0    0    0    0    0    0    0    0     0     0     0
#>             [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23]
#> Susceptible     0     0     0     0     0     0     0     0     0     0     0
#> Resistant1      0     0     0     0     0     0     0     0     0     0     0
#> Resistant2      0     0     0     0     0     0     0     0     0     0     0
#> Resistant3      0     0     0     0     0     0     0     0     0     0     0
#> Forest          0     0     0     0     0     0     0     0     0     0     0
#>             [,24]
#> Susceptible     0
#> Resistant1      0
#> Resistant2      0
#> Resistant3      0
#> Forest          0
#> 
#> , , 2
#> 
#>             [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> Susceptible    0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant1     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant2     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant3     0    0    0    0    0    0    0    0    0     0     0     0
#> Forest         0    0    0    0    0    0    0    0    0     0     0     0
#>             [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23]
#> Susceptible     0     0     0     0     0     0     0     0     0     0     0
#> Resistant1      0     0     0     0     0     0     0     0     0     0     0
#> Resistant2      0     0     0     0     0     0     0     0     0     0     0
#> Resistant3      0     0     0     0     0     0     0     0     0     0     0
#> Forest          0     0     0     0     0     0     0     0     0     0     0
#>             [,24]
#> Susceptible     0
#> Resistant1      0
#> Resistant2      0
#> Resistant3      0
#> Forest          0
#> 
#> , , 3
#> 
#>              [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> Susceptible 5e-04    0    0    0    0    0    0    0    0     0     0     0
#> Resistant1  0e+00    0    0    0    0    0    0    0    0     0     0     0
#> Resistant2  0e+00    0    0    0    0    0    0    0    0     0     0     0
#> Resistant3  0e+00    0    0    0    0    0    0    0    0     0     0     0
#> Forest      0e+00    0    0    0    0    0    0    0    0     0     0     0
#>             [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23]
#> Susceptible     0     0     0     0     0     0     0     0     0     0     0
#> Resistant1      0     0     0     0     0     0     0     0     0     0     0
#> Resistant2      0     0     0     0     0     0     0     0     0     0     0
#> Resistant3      0     0     0     0     0     0     0     0     0     0     0
#> Forest          0     0     0     0     0     0     0     0     0     0     0
#>             [,24]
#> Susceptible     0
#> Resistant1      0
#> Resistant2      0
#> Resistant3      0
#> Forest          0
#> 
#> , , 4
#> 
#>             [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> Susceptible    0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant1     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant2     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant3     0    0    0    0    0    0    0    0    0     0     0     0
#> Forest         0    0    0    0    0    0    0    0    0     0     0     0
#>             [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23]
#> Susceptible     0     0     0     0     0     0     0     0     0     0     0
#> Resistant1      0     0     0     0     0     0     0     0     0     0     0
#> Resistant2      0     0     0     0     0     0     0     0     0     0     0
#> Resistant3      0     0     0     0     0     0     0     0     0     0     0
#> Forest          0     0     0     0     0     0     0     0     0     0     0
#>             [,24]
#> Susceptible     0
#> Resistant1      0
#> Resistant2      0
#> Resistant3      0
#> Forest          0
#> 
#> , , 5
#> 
#>             [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> Susceptible    0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant1     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant2     0    0    0    0    0    0    0    0    0     0     0     0
#> Resistant3     0    0    0    0    0    0    0    0    0     0     0     0
#> Forest         0    0    0    0    0    0    0    0    0     0     0     0
#>             [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23]
#> Susceptible     0     0     0     0     0     0     0     0     0     0     0
#> Resistant1      0     0     0     0     0     0     0     0     0     0     0
#> Resistant2      0     0     0     0     0     0     0     0     0     0     0
#> Resistant3      0     0     0     0     0     0     0     0     0     0     0
#> Forest          0     0     0     0     0     0     0     0     0     0     0
#>             [,24]
#> Susceptible     0
#> Resistant1      0
#> Resistant2      0
#> Resistant3      0
#> Forest          0

Updating the survival probability during the off-season

At the end of each cropping season, pathogens experience a bottleneck representing the off-season. The probability for a pathogen propagule to survive the off-season depends on the capacity of the “green bridge” to host the pathogen. This green bridge can, for example, be a wild reservoir or volunteer plants remaining in the field (e.g. owing to seedlings or incomplete harvest). It is assumed that the probability of survival is the same every year and in every polygon, but this assumption can be relaxed by updating the probability with a matrix indicating a probability for every croptype and every year. This simulates different management strategies or agronomic practices during the off-season. The function updateSurvivalProb() creates this matrix as follows:

Let \(\lambda_{y,c}\) be the probability for a pathogen propagule to survive the off-season between year \(y\) and year \(y+1\) in a polygon cultivated with croptype \(c\). Unless the matrix is directly entered via the parameter mat, it is computed by \(\lambda_{y,c} = \lambda_{y} \times \lambda_{c}\) with:
\(\lambda_{y}\) the vector of probabilities for every year (parameter mat_year),
\(\lambda_{c}\) the vector of probabilities for every croptype (parameter mat_croptype).

Ncroptypes <- nrow(simul_params@Croptypes)
Nyears <- simul_params@TimeParam$Nyears
## Same probability in every croptype:
simul_params <- updateSurvivalProb(simul_params, mat_year=1:Nyears/100)
simul_params@Pathogen
#> $infection_rate
#> [1] 0.4
#> 
#> $latent_period_mean
#> [1] 10
#> 
#> $latent_period_var
#> [1] 9
#> 
#> $propagule_prod_rate
#> [1] 3.125
#> 
#> $infectious_period_mean
#> [1] 24
#> 
#> $infectious_period_var
#> [1] 105
#> 
#> $survival_prob
#>  [1] 0.01 0.02 0.03 0.04 0.05 0.06 0.01 0.02 0.03 0.04 0.05 0.06 0.01 0.02 0.03
#> [16] 0.04 0.05 0.06 0.01 0.02 0.03 0.04 0.05 0.06
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0
## Same probability every year:
simul_params <- updateSurvivalProb(simul_params, mat_croptype=1:Ncroptypes/10)
simul_params@Pathogen
#> $infection_rate
#> [1] 0.4
#> 
#> $latent_period_mean
#> [1] 10
#> 
#> $latent_period_var
#> [1] 9
#> 
#> $propagule_prod_rate
#> [1] 3.125
#> 
#> $infectious_period_mean
#> [1] 24
#> 
#> $infectious_period_var
#> [1] 105
#> 
#> $survival_prob
#>  [1] 0.1 0.1 0.1 0.1 0.1 0.1 0.2 0.2 0.2 0.2 0.2 0.2 0.3 0.3 0.3 0.3 0.3 0.3 0.4
#> [20] 0.4 0.4 0.4 0.4 0.4
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0
## specific probability for different croptypes and years:
simul_params <- updateSurvivalProb(simul_params, mat_year=1:Nyears/100, mat_croptype=1:Ncroptypes/10)
simul_params@Pathogen
#> $infection_rate
#> [1] 0.4
#> 
#> $latent_period_mean
#> [1] 10
#> 
#> $latent_period_var
#> [1] 9
#> 
#> $propagule_prod_rate
#> [1] 3.125
#> 
#> $infectious_period_mean
#> [1] 24
#> 
#> $infectious_period_var
#> [1] 105
#> 
#> $survival_prob
#>  [1] 0.001 0.002 0.003 0.004 0.005 0.006 0.002 0.004 0.006 0.008 0.010 0.012
#> [13] 0.003 0.006 0.009 0.012 0.015 0.018 0.004 0.008 0.012 0.016 0.020 0.024
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0
## One probability per year and per croptype:
simul_params <- updateSurvivalProb(simul_params, mat=matrix(runif(Nyears*Ncroptypes), ncol=Ncroptypes))
simul_params@Pathogen
#> $infection_rate
#> [1] 0.4
#> 
#> $latent_period_mean
#> [1] 10
#> 
#> $latent_period_var
#> [1] 9
#> 
#> $propagule_prod_rate
#> [1] 3.125
#> 
#> $infectious_period_mean
#> [1] 24
#> 
#> $infectious_period_var
#> [1] 105
#> 
#> $survival_prob
#>  [1] 0.33532076 0.63790872 0.82920106 0.70897520 0.34855035 0.12832787
#>  [7] 0.38807849 0.92817755 0.80439077 0.75869681 0.95724989 0.99391388
#> [13] 0.60644099 0.02937717 0.33644536 0.27765809 0.11719755 0.04321826
#> [19] 0.37030979 0.33687831 0.17365255 0.62177328 0.39784363 0.95567577
#> 
#> $repro_sex_prob
#> [1] 0
#> 
#> $sigmoid_kappa
#> [1] 5.333
#> 
#> $sigmoid_sigma
#> [1] 3
#> 
#> $sigmoid_plateau
#> [1] 1
#> 
#> $sex_propagule_viability_limit
#> [1] 1
#> 
#> $sex_propagule_release_mean
#> [1] 1
#> 
#> $clonal_propagule_gradual_release
#> [1] 0

Visualization

The matrix of survival probabilities for every year and croptype, as well as for every polygon and year, can be vizualised using the function survivalProbToMatrix():

survivalProbToMatrix(simul_params)
#> $survival_prob
#>        Susceptible crop Pure resistant crop    Mixture     Other
#> year_1        0.3353208           0.3880785 0.60644099 0.3703098
#> year_2        0.6379087           0.9281775 0.02937717 0.3368783
#> year_3        0.8292011           0.8043908 0.33644536 0.1736526
#> year_4        0.7089752           0.7586968 0.27765809 0.6217733
#> year_5        0.3485504           0.9572499 0.11719755 0.3978436
#> year_6        0.1283279           0.9939139 0.04321826 0.9556758
#> 
#> $survival_prob_poly
#>             year_1    year_2    year_3    year_4    year_5    year_6
#> poly_1   0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_2   0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_3   0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_4   0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_5   0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_6   0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_7   0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_8   0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_9   0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_10  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_11  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_12  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_13  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_14  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_15  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_16  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_17  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_18  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_19  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_20  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_21  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_22  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_23  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_24  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_25  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_26  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_27  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_28  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_29  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_30  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_31  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_32  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_33  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_34  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_35  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_36  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_37  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_38  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_39  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_40  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_41  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_42  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_43  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_44  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_45  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_46  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_47  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_48  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_49  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_50  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_51  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_52  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_53  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_54  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_55  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_56  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_57  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_58  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_59  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_60  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_61  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_62  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_63  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_64  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_65  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_66  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_67  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_68  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_69  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_70  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_71  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_72  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_73  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_74  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_75  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_76  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_77  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_78  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_79  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_80  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_81  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_82  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_83  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_84  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_85  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_86  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_87  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_88  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_89  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_90  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_91  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_92  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_93  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_94  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_95  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_96  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_97  0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_98  0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_99  0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_100 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_101 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_102 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_103 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_104 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_105 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_106 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_107 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_108 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_109 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_110 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_111 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_112 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_113 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_114 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_115 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_116 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_117 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_118 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_119 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_120 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_121 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_122 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_123 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_124 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_125 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_126 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_127 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_128 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_129 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_130 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_131 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_132 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_133 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_134 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_135 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_136 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_137 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_138 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_139 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_140 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_141 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_142 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_143 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_144 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_145 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_146 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_147 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_148 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_149 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_150 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_151 0.3353208 0.6379087 0.8292011 0.7089752 0.3485504 0.1283279
#> poly_152 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_153 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139
#> poly_154 0.3703098 0.3368783 0.1736526 0.6217733 0.3978436 0.9556758
#> poly_155 0.3880785 0.9281775 0.3364454 0.2776581 0.9572499 0.9939139

Setting chemical treatments

This part can be skipped if no chemical treatment is to be simulated.

Cultivars may be treated with chemicals which reduce the pathogen infection rate. Treatment efficiency is maximum (i.e. equal to the parameter treatment_efficiency) at the time of treatment application (noted \(t^*\)); then it decreases with time (i.e. natural pesticide degradation) and host growth (i.e. new biomass is not protected by treatments):

\[IR(t) = IR_{max} \times \left(1 - \frac{treatment\_efficiency}{1+e^{4.0- 8.5 \times C(t)}}\right)\] \(C(t) = C_1 \times C_2\) is the treatment concentration at \(t\), which depends on:

\[C_1 = e^{-treatment\_degradation\_rate \times \Delta t}\]

\[C_2 = min(1.0, N(t^*)/N(t))\] Cultivars to be treated with chemicals and dates of (possible) applications are defined with parameters treatment_cultivars and treatment_timesteps, and are the same for all polygons cultivated with the cultivars to be treated. However, the chemicals are applied in a polygon only if the disease severity (i.e. \(I(t^*) / N(t^*)\)) at the application date is higher than a given threshold, defined by treatment_application_threshold. The cost of a single treatment application (monetary units/ha) is defined by treatment_cost and will impact the economic outputs. Treatment parameters can be loaded via the function loadTreatment and next set via the function setTreatment:

## Via function loadTreatment:
treatment <- loadTreatment(disease="mildew")
## Direct implementation:
treatment <- list(treatment_degradation_rate = 0.1,
                  treatment_efficiency = 0.8,
                  treatment_timesteps =  seq(1,120,14) ,
                  treatment_cultivars  = c(0),
                  treatment_cost = 0,
                  treatment_application_threshold = c(0.0))
## Set the parameters
simul_params <- setTreatment(simul_params, treatment)
#> Warning in checkTreatment(params): Simulation with chemical treatment
#> applications

Choosing output variables

Several epidemiological, evolutionary and economic outputs can be generated by landsepi and represented in text files (writeTXT=TRUE), graphics (graphic=TRUE) and a video (videoMP4=TRUE).
See equation below, as well as ?epid_output and ?evol_output for details on the different output variables.

Possible epidemiological outputs include:
- “audpc” : Area Under Disease Progress Curve (average number of diseased hosts per square meter, \(AUDPC_{v,y}\))
- “audpc_rel” : relative Area Under Disease Progress Curve (average proportion of diseased hosts relative to the total number of existing hosts, \(AUDPC_{v,y}^r\))
- “gla” : Green Leaf Area (average number of healthy hosts per square meter, \(GLA_{v,y}\))
- “gla_rel” : relative Green Leaf Area (average proportion of healthy hosts relative to the total number of existing hosts, \(GLA_{v,y}^r\))
- “eco_yield” : total crop yield (in weight or volume units per ha, \(Yield_{v,y}\))
- “eco_cost” : operational crop costs (in monetary units per ha, \(Operational\_cost_{v,y}\))
- “eco_product” : total crop products (in monetary units per ha, \(Product_{v,y}\))
- “eco_margin” : margin (products - operational costs, in monetary units per ha, \(Margin_{v,y}\))
- “contrib”: contribution of pathogen genotypes to LIR dynamics (\(Contrib_{p,v,y}\)) - “HLIR_dynamics”, “H_dynamics”, “L_dynamics”, “IR_dynamics”, “HLI_dynamics”, etc.: Epidemic dynamics related to the specified sanitary status (H, L, I or R and all their combinations). Graphics only, works only if graphic=TRUE.
- “all” : compute all these outputs (default)
- ““ : none of these outputs will be generated.

Possible evolutionary outputs, based on the computation of genotype frequencies (\(freq(I)_{p,t}\)) include:
- “evol_patho”: evolution of pathogen genotypes
- “evol_aggr”: evolution of pathogen aggressiveness (i.e. phenotype)
- “durability”: durability of resistance genes
- “all”: compute all these outputs (default)
- ““: none of these outputs will be generated.

Equations

In the following equations, \(H_{i,v,t}\), \(L_{i,v,p,t}\), \(I_{i,v,p,t}\) and \(R_{i,v,p,t}\) respectively denote the number of healthy, latent, infectious and removed host individuals, respectively, in field \(i\) (\(i=1,…,J\)), for cultivar \(v\) (\(v=1,…,V\)) at time step \(t\) (\(t=1,…,T \times Y\) with \(Y\) the total number of cropping seasons and \(T\) the number of time-steps per season).

\(AUDPC_{v,y} = \frac{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} \sum_{p=1}^{P} \{I_{i,v,p,t}+R_{i,v,p,t}\}}{T \times \sum_{i=1}^{J} A_i}\)

\(AUDPC^r_{v,y} = \frac{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} \sum_{p=1}^{P} \{I_{i,v,p,t}+R_{i,v,p,t}\}}{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} \left(H_{i,v,t}+\sum_{p=1}^{P} \{L_{i,v,p,t}+I_{i,v,p,t}+R_{i,v,p,t}\}\right)}\)

\(GLA_{v,y} = \frac{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} H_{i,v,t}}{T \times \sum_{i=1}^{J} A_i}\)

\(GLA^r_{v,y} = \frac{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} H_{i,v,t}}{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} \left(H_{i,v,t}+\sum_{p=1}^{P} \{L_{i,v,p,t}+I_{i,v,p,t}+R_{i,v,p,t}\}\right)}\)

\(Yield_{v,y} = \frac{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} \left( y_{H,v} \times H_{i,v,t} + \sum_{p=1}^{P} \{y_{L,v} \times L_{i,v,p,t} + y_{I,v} \times I_{i,v,p,t} + y_{R,v} \times R_{i,v,p,t}\} \right)} {\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} H^*_{i,v,t}}\) with \(y_{H,v}\), \(y_{L,v}\), \(y_{I,v}\) and \(y_{R,v}\) the theoretical yield of cultivar v in pure crop (in weight or volume unit/ha/season) associated with the sanitary statuses ‘H’, ‘L’, ‘I’ and ‘R’, respectively. \(H^*_{i,v,t}\) is the number of healthy hosts in a pure crop and in absence of disease.

\(Operational\_cost_{v,y}=planting\_cost_v \times \frac{\sum_{i \in \Omega_{v,y}}(area_i \times prop_{v,i})} {\sum_{i \in \Omega_{v,y}}area_i} + treatment\_cost \times \frac{\sum_{i \in \Omega_{v,y}}(TFI_{i,v,y} \times area_i \times prop_{v,i})} {\sum_{i \in \Omega_{v,y}}area_i}\) with \(\Omega_{v,y}\) the set of polygon indices where cultivar \(v\) is cultivated at year \(y\), and \(prop_{v,i}\) the proportion of cultivar \(v\) in polygon \(i\) (for mixtures). \(TFI\) stands for the Treatment Frequency Indicator (number of treatment applications per ha).

\(Product_{v,y}=yield_{v,y} \times market\_value\)

\(Margin_{v,y} = Product_{v,y} - Operational\_Cost_{v,y}\)

\(Contrib_{p,v,y} = \frac{\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} \{L_{i,v,p,t}+I_{i,v,p,t}+R_{i,v,p,t}\}} {\sum_{t=t^0(y)}^{t^f(y)} \sum_{i=1}^{J} \sum_{p=1}^{P} \{L_{i,v,p,t}+I_{i,v,p,t}+R_{i,v,p,t}\}}\)

\(freq(I)_{p,t} = \frac{\sum_{i=1}^{J} \sum_{v=1}^{V} I_{i,v,p,t}} {\sum_{p=1}^{P} \sum_{i=1}^{J} \sum_{v=1}^{V} I_{i,v,p,t}}\)

With respect to evolutionary outputs, for each pathogen genotype (evol_patho) or phenotype (evol_aggr, note that different pathogen genotypes may lead to the same phenotype on a resistant host, i.e. level of aggressiveness), several computations are performed:
- appearance: time to first appearance (as propagule);
- R_infection: time to first true infection of a resistant host;
- R_invasion: time to invasion, when the number of infections of resistant hosts reaches thres_breakdown, above which the genotype or phenotype is unlikely to go extinct.
The value Nyears + 1 time step is used if the genotype or phenotype never appeared/infected/invaded.
Durability is defined as the time to invasion of completely adapted pathogen individuals.

Parameterisation

A list of outputs can be generated using loadOutputs():

outputlist <- loadOutputs(epid_outputs = "all", evol_outputs = "all", disease="rust")
outputlist
#> $epid_outputs
#> [1] "all"
#> 
#> $evol_outputs
#> [1] "all"
#> 
#> $thres_breakdown
#> [1] 50000
#> 
#> $audpc100S
#> [1] 0.76

Among the elements of outputList, “audpc100S” is the audpc in a fully susceptible landscape (used as reference value for graphics). If necessary, the function compute_audpc100S helps compute this value in a single 1-km^2 field:

audpc100S <- compute_audpc100S("rust", "wheat", area=1E6)
#> Computing audpc100S for rust in a single susceptible field of 1e+06 m^2 during 120 time steps
#> [1] "Run the C++ model"
#> 
#> *** SPATIOTEMPORAL MODEL SIMULATING THE SPREAD AND EVOLUTION OF A PATHOGEN IN A LANDSCAPE ***
#> 
#> ----------------------------- YEAR 1 -----------------------------
#> ----------------------------- YEAR 2 -----------------------------
#> ----------------------------- YEAR 3 -----------------------------
#> ----------------------------- YEAR 4 -----------------------------
#> ----------------------------- YEAR 5 -----------------------------
#> total computational time 1 seconds. 
#> [1] "Compute model outputs"
#> [1] "remove binary files"
#> [1] "model outputs stored in : /tmp/RtmpUzBAeX/Rbuild235f14885137/landsepi/vignettes"
audpc100S <- compute_audpc100S("mildew", "grapevine", area=1E6)
#> Computing audpc100S for mildew in a single susceptible field of 1e+06 m^2 during 120 time steps
#> [1] "Run the C++ model"
#> 
#> *** SPATIOTEMPORAL MODEL SIMULATING THE SPREAD AND EVOLUTION OF A PATHOGEN IN A LANDSCAPE ***
#> 
#> ----------------------------- YEAR 1 -----------------------------
#> ----------------------------- YEAR 2 -----------------------------
#> ----------------------------- YEAR 3 -----------------------------
#> ----------------------------- YEAR 4 -----------------------------
#> ----------------------------- YEAR 5 -----------------------------
#> total computational time 13 seconds. 
#> [1] "Compute model outputs"
#> [1] "remove binary files"
#> [1] "model outputs stored in : /tmp/RtmpUzBAeX/Rbuild235f14885137/landsepi/vignettes"
audpc100S <- compute_audpc100S("sigatoka", "banana", area=1E6, nTSpY=182)
#> Computing audpc100S for sigatoka in a single susceptible field of 1e+06 m^2 during 182 time steps
#> [1] "Run the C++ model"
#> 
#> *** SPATIOTEMPORAL MODEL SIMULATING THE SPREAD AND EVOLUTION OF A PATHOGEN IN A LANDSCAPE ***
#> 
#> ----------------------------- YEAR 1 -----------------------------
#> ----------------------------- YEAR 2 -----------------------------
#> ----------------------------- YEAR 3 -----------------------------
#> ----------------------------- YEAR 4 -----------------------------
#> ----------------------------- YEAR 5 -----------------------------
#> total computational time 1 seconds. 
#> [1] "Compute model outputs"
#> [1] "remove binary files"
#> [1] "model outputs stored in : /tmp/RtmpUzBAeX/Rbuild235f14885137/landsepi/vignettes"

Then simul_params can be updated via setOutputs():

simul_params <- setOutputs(simul_params, outputlist)

See also tutorial on how to run a numerical experimental design to compute your own output variables and to run several simulations within an experimental design

Running the simulation

The functions checkSimulParams() and saveDeploymentStrategy() check simulation parameters and save the object simul_params (which contains all parameters associated with the deployment strategy) into a GPKG file, respectively.

checkSimulParams(simul_params)
simul_params <- saveDeploymentStrategy(simul_params)

Then, the function runSimul() launches the simulation. Use ?runSimul to get all available options.

runSimul(simul_params, graphic = TRUE, videoMP4 = FALSE)