Suppose in a disease outbreak scenario and we want to estimate number of infected people based infections over time.
Why we cannot simply fit the data with some polynomials (or some MLP neural network)?
what are the advantages of using some complicated model such as SIR model from ODE?
(Attached code and plot is an example of fitting a high order polynomial (red line) with SIR model generated data (black dots), we can see we are getting an almost perfect fit.)
library(deSolve)
# generate data from SIR Model
N <- 1000
init <- c(S = 999, I = 1, R = 0)
SIR <- function(time, state, parameters) {
par <- as.list(c(state, parameters))
with(par, { dS <- -beta * (S/N) * I
dI <- beta * (S/N) * I - gamma * I
dR <- gamma * I
list(c(dS, dI, dR))
})
}
out <- ode(init, seq(1000), func = SIR, parms = c(beta=0.1, gamma=0.01))
# fit with high order polynomial
d = as.data.frame(out[50:300,])
names(d) = c('time', 'susceptible', 'infected', 'recovered')
poly_fit = lm(infected~poly(time,15),d)
plot(d$time, d$infected)
lines(d$time, predict(poly_fit, d), col ='red', lwd = 3)
grid()