Re: [R] Fwd: Using odesolve to produce non-negative solutions

From: <>
Date: Mon, 11 Jun 2007 14:30:55 -0400

By the way, if someone could forward the original question to me (I'm subscribed to but not currently receiving R-help, as I found I was spending too much time reading it!) I might think of something more useful. (alternatively, when was it posted; I can find it on gmane, too).

R. Woodrow Setzer, Ph. D.
National Center for Computational Toxicology US Environmental Protection Agency
Mail Drop B205-01/US EPA/RTP, NC 27711
Ph: (919) 541-0128 Fax: (919) 541-1194

             "Martin Henry H.                                           
             <HStevens_at_muohio                                        To 
             .edu>                    Spencer Graves                    
             06/11/2007 01:02                                        cc 
             PM                       Jeremy Goldhaber-Fiebert          
                                      Woodrow Setzer/RTP/USEPA/US_at_EPA   
                                      Re: [R] Fwd: Using odesolve to    
                                      produce non-negative solutions    

Hi Spencer,
I have copied Woody Setzer. I have no idea whether lsoda can estimate parameters that could take imaginary values. Hank
On Jun 11, 2007, at 12:52 PM, Spencer Graves wrote:

> <in line>
> Martin Henry H. Stevens wrote:
>> Hi Jeremy,
>> First, setting hmax to a small number could prevent a large step, if
>> you think that is a problem. Second, however, I don't see how you can
>> get a negative population size when using the log trick.
> SG: Can lsoda estimate complex or imaginary parameters?
Hmm. I have no idea.
>> I would think that that would prevent completely any negative values
>> of N (i.e. e^-100000 > 0). Can you explain? or do you want to a void
>> that trick? The only other solver I know of is rk4 and it is not
>> recommended.
>> Hank
>> On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:
>>> Hi Spencer,
>>> Thank you for your response. I also did not see anything on the
>>> lsoda
>>> help page which is the reason that I wrote to the list.
>>>> From your response, I am not sure if I asked my question clearly.
>>> I am modeling a group of people (in a variety of health states)
>>> moving through time (and getting infected with an infectious
>>> disease). This means that the count of the number of people in each
>>> state should be positive at all times.
>>> What appears to happen is that lsoda asks for a derivative at a
>>> given
>>> point in time t and then adjusts the state of the population.
>>> However, perhaps due to numerical instability, it occasionally lower
>>> the population count below 0 for one of the health states (perhaps
>>> because it's step size is too big or something).
>>> I have tried both the logarithm trick
> <snip>
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

Dr. Hank Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243

"E Pluribus Unum" mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 11 Jun 2007 - 18:38:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Jun 2007 - 19:31:48 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.