[R] Excessive precision requested error in deSolve package
Luigi Marongiu
m@rong|u@|u|g| @end|ng |rom gm@||@com
Fri May 29 15:59:59 CEST 2020
Hello,
I have a system of the differential equation for epidemic model that runs as:
```
fun = function(X, Y, P) {
# starting population
S = Y[1]
E = Y[2]
I = Y[3]
R = Y[4]
N = S+E+I+R
P = (S*I)/N
# parms
transm_rate = P["b"]
incubation_time = P["k"]
illness_time = P["r"]
# final population
dS = -transm_rate * P
dE = (transm_rate * P) - (incubation_time * E)
dI = (incubation_time * E) - (illness_time * I)
dR = illness_time * I
list(c(dS, dE, dI, dR))
}
I0 = 1
S0 = 19e6
Tmax = 10
initPop = c(S=S0-I0, I = I0, R = 0, D = 0)
period = seq(1, Tmax, 1)
p = c(b = 0.8, k = 7, r = 10)
mod = ode(y = initPop, times = period, func = fun, parms = p)
```
when I run I get:
```
DLSODA- At T (=R1), too much accuracy requested
for precision of machine.. See TOLSF (=R2)
In above message, R1 = 2, R2 = nan
Warning messages:
1: In lsoda(y, times, func, parms, ...) :
Excessive precision requested. scale up `rtol' and `atol' e.g by
the factor 10
2: In lsoda(y, times, func, parms, ...) :
Returning early. Results are accurate, as far as they go
```
What is this error about and how can I solve it?
Thank you
--
Best regards,
Luigi
More information about the R-help
mailing list