Martin Henry H. Stevens
2005-Jul-27 16:36 UTC
[R] odesolve/lsoda differences on Windows and Mac
Hi - I am getting different results when I run the numerical integrator function lsoda (odesolve package) on a Mac and a PC. I am trying to simulating a system of 10 ODE's with two exogenous pulsed inputs to the system, and have had reasonably good success with many model parameter sets. Under some parameter sets, however, the simulations fail on the Mac (see error message below). The same parameter sets, however, appear to run fine for our computational technician on his PC, generating apparently very reasonable data. Our tech is successfully running Dell Latitude D810, Windows XP Pro (Service Pack 2), 1Gb RAM. RGUI 2.1.1 I am running: R Version 2.1.1 (2005-06-20) on a Mac OS 10.3.9 Machine Model: Power Mac G5 CPU Type: PowerPC 970 (2.2) Number Of CPUs: 2 CPU Speed: 2 GHz L2 Cache (per CPU): 512 KB Memory: 1.5 GB Bus Speed: 1 GHz Boot ROM Version: 5.0.7f0 Serial Number: XB3472Q1NVS My Error Message > system.time( + outAc2 <- as.data.frame(lsoda(xstart,times, pondamph, parms, tcrit=170*730, hmin=.1)) + ) [1] 0.02 0.01 0.04 0.00 0.00 Warning messages: 1: lsoda-- at t (=r1) and step size h (=r2), the 2: corrector convergence failed repeatedly 3: or with abs(h) = hmin 4: Returning early from lsoda. Results are accurate, as far as they go Thanks for any input. Hank Stevens Dr. Martin Henry H. 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 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ "E Pluribus Unum"
Hello Hank, thank you for your interest in simulating ODEs with R. Unfortunately, I am out of office until end of August and I have no acces to a Mac with R. Maybe, Woodrow Setzer has an idea, and as an alternative I would suggest to post a minimal reproducible example to the R-help mailing list. Sorry that I can't do more in the moment Thomas Petzoldt Thomas Petzoldt, Institute of Hydrobiology, Dresden University of Technology petzoldt at rcs.urz.tu-dresden.de http://www.tu-dresden.de/fghhihb/
"Martin Henry H. Stevens" <HStevens at muohio.edu> writes:> Hi - > I am getting different results when I run the numerical integrator > function lsoda (odesolve package) on a Mac and a PC. I am trying to > simulating a system of 10 ODE's with two exogenous pulsed inputs to the > system, and have had reasonably good success with many model parameter > sets. Under some parameter sets, however, the simulations fail on the > Mac (see error message below). The same parameter sets, however, appear > to run fine for our computational technician on his PC, generating > apparently very reasonable data.One thought: Integrating across input pulses is a known source of "turbulence" in lsoda. You might have better luck integrating over intervals in which the input function is continuous. Tweaking the lsoda tolerances is another thing to try. I haven't seen lsoda fail like that, but it's not too surprising that marginal cases show platform dependency (i.e. the integrator just fails on Mac and barely succeeds on PC).> Our tech is successfully running > Dell Latitude D810, Windows XP Pro (Service Pack 2), 1Gb > RAM. RGUI 2.1.1 > > I am running: > R Version 2.1.1 (2005-06-20) on a > Mac OS 10.3.9 > Machine Model: Power Mac G5 > CPU Type: PowerPC 970 (2.2) > Number Of CPUs: 2 > CPU Speed: 2 GHz > L2 Cache (per CPU): 512 KB > Memory: 1.5 GB > Bus Speed: 1 GHz > Boot ROM Version: 5.0.7f0 > Serial Number: XB3472Q1NVS > > My Error Message > > system.time( > + outAc2 <- as.data.frame(lsoda(xstart,times, pondamph, parms, > tcrit=170*730, hmin=.1)) > + ) > [1] 0.02 0.01 0.04 0.00 0.00 > Warning messages: > 1: lsoda-- at t (=r1) and step size h (=r2), the > 2: corrector convergence failed repeatedly > 3: or with abs(h) = hmin > 4: Returning early from lsoda. Results are accurate, as far as they go > > Thanks for any input. > > Hank Stevens-- 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
Setzer.Woodrow@epamail.epa.gov
2005-Jul-28 13:14 UTC
[R] odesolve/lsoda differences on Windows and Mac
I've been talking offline with Hank Stephens about this; note that in the example he quotes, he set hmin = 0.1, and the quoted error message says that the stepsize had reached hmin with no convergence. I believe that he intended to set hmax (because of the pulsed input). Then, Peter Dalgaard's explanation would make sense -- the PPC platform just needs a smaller stepsize than does the PC to achieve convergence. R. Woodrow Setzer, Jr. National Center for Computational Toxicology US Environmental Protection Agency Mail Drop B305-03/US EPA/RTP, NC 27711 Ph: (919) 541-0128 Fax: (919) 541-4284 "Martin Henry H. Stevens" <HStevens at MUOhio To .edu> "'R-Help'" <r-help at stat.math.ethz.ch> 07/27/2005 12:36 cc PM Thomas Petzoldt <petzoldt at rcs.urz.tu-dresden.de>, Woodrow Setzer/RTP/USEPA/US at EPA Subject odesolve/lsoda differences on Windows and Mac Hi - I am getting different results when I run the numerical integrator function lsoda (odesolve package) on a Mac and a PC. I am trying to simulating a system of 10 ODE's with two exogenous pulsed inputs to the system, and have had reasonably good success with many model parameter sets. Under some parameter sets, however, the simulations fail on the Mac (see error message below). The same parameter sets, however, appear to run fine for our computational technician on his PC, generating apparently very reasonable data. Our tech is successfully running Dell Latitude D810, Windows XP Pro (Service Pack 2), 1Gb RAM. RGUI 2.1.1 I am running: R Version 2.1.1 (2005-06-20) on a Mac OS 10.3.9 Machine Model: Power Mac G5 CPU Type: PowerPC 970 (2.2) Number Of CPUs: 2 CPU Speed: 2 GHz L2 Cache (per CPU): 512 KB Memory: 1.5 GB Bus Speed: 1 GHz Boot ROM Version: 5.0.7f0 Serial Number: XB3472Q1NVS My Error Message > system.time( + outAc2 <- as.data.frame(lsoda(xstart,times, pondamph, parms, tcrit=170*730, hmin=.1)) + ) [1] 0.02 0.01 0.04 0.00 0.00 Warning messages: 1: lsoda-- at t (=r1) and step size h (=r2), the 2: corrector convergence failed repeatedly 3: or with abs(h) = hmin 4: Returning early from lsoda. Results are accurate, as far as they go Thanks for any input. Hank Stevens Dr. Martin Henry H. 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 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ "E Pluribus Unum"
Martin Henry H. Stevens
2005-Jul-28 13:51 UTC
[R] odesolve/lsoda differences on Windows and Mac UPDATE
To all: After talking to Woody Setzer offline, I ran my "problem" scripts again. I am embarrassed to say that it worked fine for all previously intransigent parameter sets. I compared the results to those of my Windows buddy, and they are essentially identical, with the average absolute difference at each time point is 1.3e-06. I am planning to go back and try to understand what went wrong before. I never used hmin (mistakenly of course, instead of hmax) UNTIL a run with default lsoda argument values failed. Now the default values work! Thus the mistaken use of hmin isn't the entire answer. Thank you for the time and interest, and I apologize for troubling you. I will get back to the list if I can ever repeat the problem or if I can figure out what I did wrong. Best Regards, Hank On Jul 27, 2005, at 12:36 PM, Martin Henry H. Stevens wrote:> Hi - > I am getting different results when I run the numerical integrator > function lsoda (odesolve package) on a Mac and a PC. I am trying to > simulating a system of 10 ODE's with two exogenous pulsed inputs to the > system, and have had reasonably good success with many model parameter > sets. Under some parameter sets, however, the simulations fail on the > Mac (see error message below). The same parameter sets, however, appear > to run fine for our computational technician on his PC, generating > apparently very reasonable data. > > Our tech is successfully running > Dell Latitude D810, Windows XP Pro (Service Pack 2), 1Gb > RAM. RGUI 2.1.1 > > I am running: > R Version 2.1.1 (2005-06-20) on a > Mac OS 10.3.9 > Machine Model: Power Mac G5 > CPU Type: PowerPC 970 (2.2) > Number Of CPUs: 2 > CPU Speed: 2 GHz > L2 Cache (per CPU): 512 KB > Memory: 1.5 GB > Bus Speed: 1 GHz > Boot ROM Version: 5.0.7f0 > Serial Number: XB3472Q1NVS > > My Error Message >> system.time( > + outAc2 <- as.data.frame(lsoda(xstart,times, pondamph, parms, > tcrit=170*730, hmin=.1)) > + ) > [1] 0.02 0.01 0.04 0.00 0.00 > Warning messages: > 1: lsoda-- at t (=r1) and step size h (=r2), the > 2: corrector convergence failed repeatedly > 3: or with abs(h) = hmin > 4: Returning early from lsoda. Results are accurate, as far as they go > > Thanks for any input. > > Hank Stevens > > > > Dr. Martin Henry H. 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 > http://www.cas.muohio.edu/botany/bot/henry.html > http://www.muohio.edu/ecology/ > http://www.muohio.edu/botany/ > "E Pluribus Unum" > > ______________________________________________ > 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 > >Dr. Martin Henry H. 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 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ "E Pluribus Unum"