[R-sig-dyn-mod] Problem with events in ode

Aurélien Jamotte aurelien.jamotte at gmail.com
Fri May 27 10:39:54 CEST 2016


Dear all,

I am currently developing a dynamic model for an infectious disease and I
am encountering a problem with the Events function of the deSolve package.

I want to simulate the effect of a vaccination program on the incidence of
the disease.
I am assuming that vaccines are all administered at a given time t. Thus I
tried to code the vaccination program as an event function.

Without specifying an event, the model is running and I have detected no
problem regarding the results.
When specifying the event, however, the ode procedure crashes and the
following error is displayed:

*Error in rk(y, times, func, parms, method = "ode23", ...) : 'rho' cannot
be C NULL: detected in C-level eval*

I have no idea of what this error means and I have found no information I
could understand relative to this error.
Unfortunately the model is quite complex and it is not possible for me to
share the code. Here is lines of code I used to run the model:

>times<-0:365
>out_light_event<-ode(y = yini, times = times, func = model, parms = pars,
method = "ode23", events = list(func = event_vaccination, time = 300))

event_vaccination is a function defined as function(t,y,pars). I have
tested the event function on different initial states values and the
function is working well on its own.

My first question is, is there a need to precise the pars argument knowing
that it is the same as for the model function?
I tried  out_light_event<-ode(y = yini, times = times, func = model, parms
= pars, method = "ode23", events = list(func = event_vaccination, time =
300, pars=pars))
but I did not notice any change, the error is still there.

And the second question of course is, does anyone have an idea of 1) what
this error means and 2) what could have caused the problem?

Thank you very much for your help,

Best regards,

Aurélien

	[[alternative HTML version deleted]]



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