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

Ravi Varadhan rvaradhan at jhmi.edu
Mon Jun 11 19:27:33 CEST 2007


Spencer,

Lsoda does not "estimate" any parameters (nlmeODE does parameter
estimation).  It just computes the solution trajectory, at discrete times,
of a dynamical systems (i.e. set of differential equations).  It only works
with real numbers, as far as I know.


Ravi.

----------------------------------------------------------------------------
-------

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvaradhan at jhmi.edu

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 

----------------------------------------------------------------------------
--------


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Spencer Graves
Sent: Monday, June 11, 2007 12:53 PM
To: Martin Henry H. Stevens
Cc: Jeremy Goldhaber-Fiebert; r-help at stat.math.ethz.ch
Subject: Re: [R] Fwd: Using odesolve to produce non-negative solutions

<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? 

> 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>

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list