[R] ODE's in R

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Tue Jan 22 12:30:43 CET 2008


Markku Karhunen wrote:
> Thanks, Dr. Maechler.
>   
>> No, there's no such track.
>> [ Matlab users coming to R may produce wrong R code
>>   by using 0:n-1 instead of 0:(n-1) ; but I don't assume this
>>   would be the case ]
>>
>>   
>>     
> Been there, done that!
>   
>>     MK>  We use just a simple discretisation written in a for loop 
>>     MK> and a variable (i.e. user-fed) time step.
>>
>> I don't think you should use your own code instead of "professional"
>> ODE solvers, such as the one in R package 'odesolve'....
>>
>>   
>>     
> We must look into that. The problem, maybe, is that in fact half of the 
> equations are, in fact, simple PDE's and I don't know, if you can put 
> them into odesolve.
>   
Usually, you can convert them to a system of ODE's ("the method of
lines" if i remember correctly).

One slight caveat with the high-end ODE solvers is that sometimes they
are too smart for their own good when used in connection with parameter
estimation. Because of things like adaptive stepsizing, you might end up
with sums of squared residuals that are non-smooth functions of the
parameters. This happens especially easily if the system itself is not
quite smooth (e.g. if your input to the system is a step function).

>>     MK> Maybe, I'm too neurotic about this, but I guess I just want some comfort 
>>     MK> after seeing a few particularly nasty orbits.
>>
>> As we know ``from Chaos theory'', there can be delicate
>> inhereent and numerical problems in ODE solving..
>>   
>>     
> But - to our best knowledge - they should not be any more acute in R, 
> than on any other platform...
>
> BR,
> Markku
>
> ______________________________________________
> R-help at r-project.org 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.
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list