Skip to content

Instantly share code, notes, and snippets.

@juanchiem
Created August 11, 2021 01:39
Show Gist options
  • Save juanchiem/64a2f4f311543fba9e2bf0bf6049b159 to your computer and use it in GitHub Desktop.
Save juanchiem/64a2f4f311543fba9e2bf0bf6049b159 to your computer and use it in GitHub Desktop.
library(tidyverse)
# Establezcamos el periodo critico
plot_base <- ggplot(data = data.frame(t = 0), aes(x = t))+
annotate("rect", xmin = 15, xmax = 40,
ymin = 0, ymax = 100,
alpha = .2)+
labs(y="Incidencia %")+
xlim(0,40) +
cowplot::theme_minimal_grid()+
scale_y_continuous(limits = c(0,100),
breaks = scales::pretty_breaks(5))
plot_base
# Definición matemática del modelo logistico
lo <- function(x, K, y0, r) {K/(1+((K-y0)/y0)*exp(-r*x))}
# Curva logistica de referencia de manchas sin intervencion r =.7
param1 = list(K=60, y0=0.01, r=.7)
plot_base + stat_function(fun = lo, args=param1, col="red")
# Aplicamos un fungicida mezcla triazoles y disminuimos la tasa de progreso a .3
param2 = list(K=60, y0=0.01, r=.3)
plot_base +
stat_function(fun = lo, args=param1, col="red") +
stat_function(fun = lo, args=param2, col="blue")
# Aplicamos un fungicida mezcla triple y disminuimos la tasa de progreso a .2
param3 = list(K=60, y0=0.01, r=.2)
plot_base +
stat_function(fun = lo, args=param1, col="red") +
stat_function(fun = lo, args=param3, col="blue")
# https://git.io/JRKKR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment