[R-sig-dyn-mod] deSolve failed integration, values too close to zero?

HuiYing Chua hyc.tartoon at gmail.com
Thu Jul 28 04:29:08 CEST 2016


Hi all,

I'm running deSolve on R on a mosquito life cycle model and climate. 

The codes and equations are all fine, until i added a binary parameter, z.dia. z.dia is the mosquitoes diapause period, 0 or 1, depending on time.

climate$z.dia.t <- ifelse(climate$date < "2011-03-10" |climate$date > "2011-09-30" & climate$date < "2012-03-10" |climate$date > "2012-09-30" & climate$date < "2013-03-10" |climate$date > "2013-09-30" & climate$date < "2014-03-10" |climate$date > "2014-09-30" & climate$date < "2015-03-10" |climate$date > "2015-09-30", 0, 1)
z.dia <- climate$z.dia.t

dEv <- ne*dr.a*Am - (mr.ev + z.dia*dr.ev)*Ev ### mosquito eggs
dLv <- z.dia*dr.ev*Ev - (mr.lv*(1 + (Lv/k.lv)) + dr.lv)*Lv ### larva
dPv <- dr.lv*Lv - (mr.pv + dr.pv)*Pv ### pupa
dAm <- (1/2)*dr.pv*Pv - mu.v*Am ### adult mosquitoes
However the integration terminated prematurely at time 435 (out of 1826). Error code as below:

DLSODA-  Warning..Internal T (=R1) and H (=R2) are
      such that in the machine, T + H = T on the next step  
     (H = step size). Solver will continue anyway.
In above message, R1 = 435, R2 = 7.18888e-15

DLSODA-  Warning..Internal T (=R1) and H (=R2) are
      such that in the machine, T + H = T on the next step  
     (H = step size). Solver will continue anyway.
In above message, R1 = 435, R2 = 1.43778e-14

DLSODA-  Above warning has been issued I1 times.  
     It will not be issued again for this problem.
In above message, I1 = 10

DLSODA-  At current T (=R1), MXSTEP (=I1) steps   
      taken on this call before reaching TOUT     
In above message, I1 = 5000

In above message, R1 = 435

 Error in `$<-.data.frame`(`*tmp*`, "time.month", value = c("Jan 2011",  : 
  replacement has 1826 rows, data has 435 In addition: Warning messages:
1: In lsoda(y, times, func, parms, ...) :
  an excessive amount of work (> maxsteps ) was done, but integration was not successful - increase maxsteps
2: In lsoda(y, times, func, parms, ...) :
  Returning early. Results are accurate, as far as they go
When I examined the output and by alternating z.dia value to 0 and a value smaller than 1, it seems that at the point of termination, z.dia changes from 0 to 1 and Lv and Pv have values very close to zero (around 0.2 and 0.09 respectively). The next value for Lv and Pv at time 436 are likely to be very high. I think this causes the error.

I have to keep z.dia as 0 and 1. Have tried methods="ode45" etc but does not work. I’m not sure if floor/round works. If anyone has any ideas on the alternative options to go about this, please kindly let me know. Thanks much !

Best regards,
Huiying
	[[alternative HTML version deleted]]



More information about the R-sig-dynamic-models mailing list