Title: | Analysis and Simulation of Plant Disease Progress Curves |
---|---|
Description: | Analysis and visualization of plant disease progress curve data. Functions for fitting two-parameter population dynamics models (exponential, monomolecular, logistic and Gompertz) to proportion data for single or multiple epidemics using either linear or no-linear regression. Statistical and visual outputs are provided to aid in model selection. Synthetic curves can be simulated for any of the models given the parameters. See Laurence V. Madden, Gareth Hughes, and Frank van den Bosch (2007) <doi:10.1094/9780890545058> for further information on the methods. |
Authors: | Kaique dos S. Alves [aut, cre] , Emerson M. Del Ponte [aut] |
Maintainer: | Kaique dos S. Alves <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.0 |
Built: | 2024-11-16 04:51:10 UTC |
Source: | https://github.com/alvesks/epifitter |
Calculates the area under disease progress curves.
AUDPC(time, y, y_proportion = TRUE, type = "absolute")
AUDPC(time, y, y_proportion = TRUE, type = "absolute")
time |
A vector object of time. |
y |
A vector object of disease intensity. |
y_proportion |
Logical. If disease intensity is proportion (TRUE) or percentage(FALSE). |
type |
Set if is absolute or relative AUDPC. type = "absolute" is default. |
Kaique dos S. Alves
Madden, L. V., Hughes, G., and van den Bosch, F. 2007. The Study of Plant Disease Epidemics. American Phytopathological Society, St. Paul, MN.
epi = sim_logistic(N = 30, y0 = 0.01,dt = 5, r = 0.3, alpha = 0.5, n = 1) AUDPC(time = epi$time, y = epi$y, y_proportion = TRUE)
epi = sim_logistic(N = 30, y0 = 0.01,dt = 5, r = 0.3, alpha = 0.5, n = 1) AUDPC(time = epi$time, y = epi$y, y_proportion = TRUE)
Calculates the area under disease progress stairs.
AUDPS(time, y, y_proportion = TRUE, type = "absolute")
AUDPS(time, y, y_proportion = TRUE, type = "absolute")
time |
A vector object of time. |
y |
A vector object of disease intensity. |
y_proportion |
Logical. If disease intensity is proportion (TRUE) or percentage(FALSE) |
type |
Set if is absolute or relative AUDPC. type = "absolute" is default. |
Kaique dos S. Alves
Simko, I., and Piepho, H.-P. 2012. The area under the disease progress stairs: Calculation, advantage, and application. Phytopathology 102:381- 389.
epi = sim_logistic(N = 30, y0 = 0.01,dt = 5, r = 0.3, alpha = 0.5, n = 1) AUDPS(time = epi$time, y = epi$y, y_proportion = TRUE)
epi = sim_logistic(N = 30, y0 = 0.01,dt = 5, r = 0.3, alpha = 0.5, n = 1) AUDPS(time = epi$time, y = epi$y, y_proportion = TRUE)
Base function for the Exponential model. This function is used in the Exponential model simulation function sim_exponential()
expo_fun(t, y, par)
expo_fun(t, y, par)
t |
Vector of time |
y |
Vector of disease intensity |
par |
List of parameters |
Fits epidemic models (Exponential, Monomolecular, Logistic and Gompertz) to data using data linearization
fit_lin(time,y)
fit_lin(time,y)
time |
Numeric vector which refers to the time steps in the epidemics |
y |
Numeric vector which refers to the disease intensity |
Kaique dos S. Alves
set.seed(1) epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.2, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fit_lin( time = data$time, y = data$y)
set.seed(1) epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.2, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fit_lin( time = data$time, y = data$y)
Estimate model parameters for multiple disease progress curves
fit_multi(time_col, intensity_col, data, strata_cols , starting_par = list(y0 = 0.01, r = 0.03, K = 0.8), maxiter=500, nlin = FALSE, estimate_K = FALSE)
fit_multi(time_col, intensity_col, data, strata_cols , starting_par = list(y0 = 0.01, r = 0.03, K = 0.8), maxiter=500, nlin = FALSE, estimate_K = FALSE)
time_col |
Character name specifying the column for the time. eg: time_col = "days". |
intensity_col |
Character name specifying the column for the disease intensity. |
data |
|
strata_cols |
Character name or vector specifying the columns for stratification. |
starting_par |
Starting value for initial inoculun (y0) and apparent infection rate (r). Please informe in that especific order |
maxiter |
Maximum number of iterations. Only used if is |
nlin |
Logical. If |
estimate_K |
Logical. If |
Returns a data.frame
containing estimated parameters for individual strata levels.
set.seed(1) # create stratified dataset data_A1 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.3, alpha = 0.5, n = 4) data_A1 = dplyr::mutate(data_A1, fun = "A", cultivar = "BR1") set.seed(1) data_B1 = sim_gompertz(N = 30, y0 = 0.01, dt = 5, r = 0.2, alpha = 0.5, n = 4) data_B1 = dplyr::mutate(data_B1, fun = "B", cultivar = "BR1") set.seed(1) data_A2 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4) data_A2 = dplyr::mutate(data_A2, fun = "A", cultivar = "BR2") set.seed(1) data_B2 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4) data_B2 = dplyr::mutate(data_B2, fun = "B", cultivar = "BR2") data = dplyr::bind_rows(data_A1, data_B1,data_A2, data_B2) fit_multi(time_col = "time", intensity_col = "random_y", data = data, strata_col = c("fun","cultivar"), starting_par = list(y0 = 0.01, r = 0.03), maxiter = 1024, nlin = FALSE, estimate_K = FALSE)
set.seed(1) # create stratified dataset data_A1 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.3, alpha = 0.5, n = 4) data_A1 = dplyr::mutate(data_A1, fun = "A", cultivar = "BR1") set.seed(1) data_B1 = sim_gompertz(N = 30, y0 = 0.01, dt = 5, r = 0.2, alpha = 0.5, n = 4) data_B1 = dplyr::mutate(data_B1, fun = "B", cultivar = "BR1") set.seed(1) data_A2 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4) data_A2 = dplyr::mutate(data_A2, fun = "A", cultivar = "BR2") set.seed(1) data_B2 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4) data_B2 = dplyr::mutate(data_B2, fun = "B", cultivar = "BR2") data = dplyr::bind_rows(data_A1, data_B1,data_A2, data_B2) fit_multi(time_col = "time", intensity_col = "random_y", data = data, strata_col = c("fun","cultivar"), starting_par = list(y0 = 0.01, r = 0.03), maxiter = 1024, nlin = FALSE, estimate_K = FALSE)
Fits epidemic models (Exponential, Monomolecular, Logistic and Gompertz) using nonlinear approach for estimate parameters.
fit_nlin(time, y, starting_par = list(y0 = 0.01, r = 0.03), maxiter = 50)
fit_nlin(time, y, starting_par = list(y0 = 0.01, r = 0.03), maxiter = 50)
time |
Numeric vector which refers to the time steps in the epidemics |
y |
Numeric vector which refers to the disease intensity |
starting_par |
Starting value for initial inoculun (y0) and apparent infection rate (r). Please informe in that especific order |
maxiter |
Maximun number of iterations |
Kaique dos S. Alves
set.seed(1) epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fit_nlin(time = data$time, y = data$y, starting_par = list(y0 = 0.001, r = 0.03), maxiter = 1024)
set.seed(1) epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fit_nlin(time = data$time, y = data$y, starting_par = list(y0 = 0.001, r = 0.03), maxiter = 1024)
Fits epidemic models (Exponential, Monomolecular, Logistic and Gompertz) using nonlinear approach for estimate parameters. This function also estimates the maximum disease intensity parameter K.
fit_nlin2(time, y, starting_par = list(y0 = 0.01, r = 0.03, K = 0.8), maxiter = 50)
fit_nlin2(time, y, starting_par = list(y0 = 0.01, r = 0.03, K = 0.8), maxiter = 50)
time |
Numeric vector which refers to the time steps in the epidemics. |
y |
Numeric vector which refers to the disease intensity. |
starting_par |
starting value for initial inoculun (y0) and apparent infection rate (r), and maximum disease intensity (K). Please informe in that especific order |
maxiter |
Maximun number of iterations. |
set.seed(1) epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fit_nlin2(time = data$time, y = data$y, starting_par = list(y0 = 0.01, r = 0.03, K = 1), maxiter = 1024)
set.seed(1) epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fit_nlin2(time = data$time, y = data$y, starting_par = list(y0 = 0.01, r = 0.03, K = 1), maxiter = 1024)
Base function for the Gompertz model. This function is used in the Gompertz model simulation function sim_gompertz()
gompi_fun(t, y, par)
gompi_fun(t, y, par)
t |
Vector of time |
y |
Vector of disease intensity |
par |
List of parameters |
Base function for the Logistic model. This function is used in the Logistic model simulation function sim_logistic()
logi_fun(t, y, par)
logi_fun(t, y, par)
t |
Vector of time |
y |
Vector of disease intensity |
par |
List of parameters |
Base function for the Monomolecular model. This function is used in the Monomolecular model simulation function sim_monomolecular()
mono_fun(t, y, par)
mono_fun(t, y, par)
t |
Vector of time |
y |
Vector of disease intensity |
par |
List of parameters |
Create a ggplot2
-style plot with the fitted models curves and the epidemic data.
plot_fit(object, point_size =1.2, line_size = 1, models = c("Exponential","Monomolecular", "Logistic", "Gompertz"))
plot_fit(object, point_size =1.2, line_size = 1, models = c("Exponential","Monomolecular", "Logistic", "Gompertz"))
object |
A |
point_size |
Point size |
line_size |
Line size |
models |
Select the models to be displayed in the panel |
It is possible to add more ggplot
components by using the +
syntax. See examples below.
epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fitted = fit_lin( time = data$time, y = data$y) plot_fit(fitted) # adding ggplot components library(ggplot2) plot_fit(fitted)+ theme_minimal()+ ylim(0,1)+ labs(y = "Disease internsity", x = "Time")
epi1 <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4) data = data.frame(time = epi1[,2], y = epi1[,4]) fitted = fit_lin( time = data$time, y = data$y) plot_fit(fitted) # adding ggplot components library(ggplot2) plot_fit(fitted)+ theme_minimal()+ ylim(0,1)+ labs(y = "Disease internsity", x = "Time")
Dataset containing experimental data of disease progress curves of powdery mildew under different irrigation systems and soil moisture levels in organic tomato.
data("PowderyMildew")
data("PowderyMildew")
A data frame with 240 observations on the following 2 variables.
irrigation_type
Irrigations Systems: MS = Micro Sprinkler
moisture
Levels of soils moisture
block
Experimental blocks
time
a numeric vector containing the time points
sev
a numeric vector containg disease severity data in proportinal scales
Lage, D. A. C., Marouelli, W. A., and Café-Filho, A. C. 2019. Management of powdery mildew and behaviour of late blight under different irrigation configurations in organic tomato. Crop Protection. 125:104886.
data(PowderyMildew) ## maybe str(PowderyMildew) ; plot(PowderyMildew) ...
data(PowderyMildew) ## maybe str(PowderyMildew) ; plot(PowderyMildew) ...
fit_lin()
or fit_nlin()
outputsThe print
method for density objects.
## S3 method for class 'fit_lin' print(x, ...)
## S3 method for class 'fit_lin' print(x, ...)
x |
output from |
... |
... |
fit_nlin2()
outputsThe print
method for density objects.
## S3 method for class 'fit_nlin2' print(x, ...)
## S3 method for class 'fit_nlin2' print(x, ...)
x |
output from |
... |
... |
Simulate a stochastic epidemic curve using the Exponential model.
sim_exponential(N = 10,dt = 1, y0 = 0.01, r, n, alpha = 0.2)
sim_exponential(N = 10,dt = 1, y0 = 0.01, r, n, alpha = 0.2)
N |
Total time course of the epidemic |
dt |
Time step |
y0 |
Initial inoculum or initial disease intensity |
r |
Infection rate |
n |
Number or replicates or sample size for each time step |
alpha |
Variation parameter. stands for the variation for the replicates for each time step. The standard deviation is calculated as sd = alpha * y * (1 - y), being y the disease intensity for each time step. |
rep |
Replicates |
time |
Time after epidemic start |
y |
Disease intensity |
random_y |
Disease intensity after applying the random |
sim_exponential(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4)
sim_exponential(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4)
Simulate a stochastic epidemic curve using the Gompertz model.
sim_gompertz(N = 10,dt = 1, y0 = 0.01, r, K = 1, n, alpha = 0.2)
sim_gompertz(N = 10,dt = 1, y0 = 0.01, r, K = 1, n, alpha = 0.2)
N |
Total time course of the epidemic |
dt |
Time step |
y0 |
Initial inoculum or initial disease intensity |
r |
Infection rate |
K |
Maximum asymptote |
n |
Number or replicates or sample size for each time step |
alpha |
Variation parameter. stands for the variation for the replicates for each time step. The standard deviation is calculated as sd = alpha * y * (1 - y), being y the disease intensity for each time step. |
rep |
Replicates |
time |
Time after epidemic start |
y |
Disease intensity |
random_y |
Disease intensity after applying the random |
sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.3, K = 1, alpha = 0.5, n = 4)
sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.3, K = 1, alpha = 0.5, n = 4)
Simulate a stochastic epidemic curve using the logistic model.
sim_logistic(N = 10,dt = 1, y0 = 0.01, r, K = 1, n, alpha = 0.2)
sim_logistic(N = 10,dt = 1, y0 = 0.01, r, K = 1, n, alpha = 0.2)
N |
Total time course of the epidemic |
dt |
Time step |
y0 |
Initial inoculum or initial disease intensity |
r |
Infection rate |
K |
Maximum asymptote |
n |
Number or replicates or sample size for each time step |
alpha |
Variation parameter. stands for the variation for the replicates for each time step. The standard deviation is calculated as sd = alpha * y * (1 - y), being y the disease intensity for each time step. |
rep |
Replicates |
time |
Time after epidemic start |
y |
Disease intensity |
random_y |
Disease intensity after applying the random |
sim_logistic(N = 30, y0 = 0.01,dt = 5, r = 0.3, K = 1, alpha = 0.5, n = 4)
sim_logistic(N = 30, y0 = 0.01,dt = 5, r = 0.3, K = 1, alpha = 0.5, n = 4)
Simulate a stochastic epidemic curve using the Monomolecular model.
sim_monomolecular(N = 10,dt = 1, y0 = 0.01, r,K = 1, n, alpha = 0.2)
sim_monomolecular(N = 10,dt = 1, y0 = 0.01, r,K = 1, n, alpha = 0.2)
N |
Total time course of the epidemic |
dt |
Time step |
y0 |
Initial inoculum or initial disease intensity |
r |
Infection rate |
K |
Maximum asymptote |
n |
Number or replicates or sample size for each time step |
alpha |
Variation parameter. stands for the variation for the replicates for each time step. The standard deviation is calculated as sd = alpha * y * (1 - y), being y the disease intensity for each time step. |
rep |
Replicates |
time |
Time after epidemic start |
y |
Disease intensity |
random_y |
Disease intensity after applying the random |
sim_monomolecular(N = 30, y0 = 0.01,dt = 5, r = 0.3, K = 1, alpha = 0.5, n = 4)
sim_monomolecular(N = 30, y0 = 0.01,dt = 5, r = 0.3, K = 1, alpha = 0.5, n = 4)