Displaying 20 results from an estimated 80 matches for "lsoda".
Did you mean:
lsda
2008 Apr 09
3
LSODA not accurate when RK4 is; what's going on?
...ial equation dy/dx = xy-1 with y(0) = sqrt(pi/2).
This can be used in computing the tail of the normal distribution.
(The actual solution is y(x) = exp(x^2/2) * Integral_x_inf {exp(-t^2/2) dt}
= Integral_0_inf {exp (-xt - t^2/2) dt}. For large x, y ~ 1/x, starting
around x~2.)
I'm testing both lsoda and rk4 from the package odesolve.
rk4 is accurate using step length 10^-2 and probably would be with even
larger steps.
lsoda is pretty accurate out to about x=4, then starts acting strangely. For
step length 10^-3, y suddenly starts to increase after 4, when it should be
strictly decreasing. For...
2004 Jan 22
4
Fitting compartmental model with nls and lsoda?
Dear Colleagues,
Our group is also working on implementing the use of R for pharmacokinetic compartmental analysis. Perhaps I have missed something, but
> fit <- nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=0.5, k2=0.5)),
+ data=C1.lsoda,
+ start=list(K1=0.3, k2=0.7),
+ trace=T
+ )
Error in eval(as.name(varName), data) : Object "C1.lsoda" not found
What part of the e-mail did I miss? I would like to get th...
2004 Jan 23
0
cmptl_analy.R
...hael,
One key is adjustment of nls optimizer tolerance. I notice it has to be
higher than usual, but, I recovered your noisy "known" parameter values
with an error of K1 (-7%) and k1 (-6%):
#### Miller problem with Dalgaard modifications
## Linares 1/22/2004
## Solution 1
nls(noisy ~ lsoda(xstart, time, one.compartment.model, c(K1=K1,
k2=k2))[,2],
data=C1.lsoda,
start=list(K1=0.3, k2=0.7),
control=nls.control(maxiter=50,tol=1),
trace=T
)
0.3594355 : 0.3 0.7
0.006118908 : 0.3456684 0.3518834
0.002828044 : 0.4057868 0.40...
2008 Nov 21
1
lsoda warning "too much accuracy requested"
Dear list -
Does anyone have any ideas / comments about why I am receiving the following
warning when I run lsoda:
1: lsoda-- at t (=r1), too much accuracy requested in: lsoda(start, times,
model, parms)
2: for precision of machine.. see tolsf (=r2) in: lsoda(start, times,
model, parms)
I have tried changing both rtol and atol but without success. I saw the
thread in the R-archive of 11 Jun...
2005 Jul 27
4
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 be...
2003 Nov 05
3
using LSODA in R
R help list subscribers,
I am a new user of R. I am attempting to use R to explore a set of
equations specifying the dynamics of a three trophic level food chain. I
have put together this code for the function that is to be evaluted by
LSODA. My equations Rprime, Cprime, and Pprime are meant to describe the
actual equation of the derivative. When I run LSODA, I do not get the
output that these equations should be giving. Can someone tell me if I have
set this function up correctly to use with LSODA when the user is specifying
th...
2004 Sep 06
1
A naive lsoda question....
Hello,
I am an R newbie, trying to use lsoda to solve standard
Lotka-Volterra competition equations. My question is: how do I
pass a parameter that varies with time, like say, phix <- 0.7 +
runif(tmax) in the example below.
# defining function
lotvol <- function(t,n,p){
x <- n[1]; y <- n[2]
rx <- p["rx"];...
2005 Dec 05
1
how to save output all together
...()
{
.......
for( i in 1:Subject) {
kel<-par1
Vd<-par2
PKindex<-sbolus1.out(PKtime,kel,Vd,defun,par1,par2,Dose,i)
}
savefile(PKindex)
}
sbolus1.out<-function(PKtime,kel,Vd,defun,par1,par2,Dose,i)
{
time<-PKtime$time
parms<-c(kel=kel,Vd=Vd)
C1.lsoda<-data.frame(lsoda(Dose/Vd,c(0,time),defun,parms))
cat("\n")
sim<-matrix(c(kel,Vd,par1,par2),2,2)
dimnames(sim)<-list(c("kel","Vd"),c("Value","Original"))
show(sim)
cat("\n\n<< Output >>\n\n")
good<-ifelse...
2005 Nov 06
1
Problem defining a system of odes as a C library with lsoda
I have been trying to make use of the odesolve library on my
university's Linux grid - currently R version 2.0.1 is installed and
the system runs 64-bit Scientific Linux based on Redhat. I cannot seem
to get lsoda working when I define the model as a shared C library. For
example, the following snippet uses the mymod.c example bundled with
the package:
### START
rm(list=ls())
setwd("~/projects/test_odesolve")
invisible(file.remove("mymod.o","mymod.so"))
system("R CMD SHL...
2004 Jun 10
2
odesolve: lsoda vs rk4
...unction rk4:
out <- rk4(y=y,times=times,func=func, parms=parms)
and the results look not unreasonable:
out<-as.data.frame(out)
par(mfrow=c(4,1))
for (i in 2:(dim(out)[2]))plot(out[,1],out[,i], pch=".", xlab="time",
ylab=names(out)[i])
If I try doing the same thing with lsoda:
out <- lsoda(y=y,times=times,func=func, parms=parms, rtol=1e-1, atol=
1e-1)
I run into problems with a series of 'Excessive precision requested'
warnings with no output beyond the first time point.
Fiddling with rtol and atol doesn't seem to do very much.
What is likely to be ca...
2006 Aug 08
1
Fitting data with optim or nls--different time scales
Hi,
I have a system of ODE's I can solve with lsoda.
Model=function(t,x,parms)
{
#parameter definitions
lambda=parms[1]; beta=parms[2];
d = parms[3]; delta = parms[4];
p=parms[5]; c=parms[6]
xdot[1] = lambda - (d*x[1])- (beta*x[3]*x[1])
xdot[2] = (beta*x[3]*x[1]) - (delta*x[2])
xdot[3] = (p*x[2]) - (c*...
2001 May 11
1
lsoda
I am running R 1.2.3 with ESS5.1.18 with Windows 98.
I am trying to use lsoda in the odesolve apckage and am having problems.
Question:
The return value of the function of the system of ode's has to be a list
that includes first, the ode's and second, "a vector
(possibly with a `names' attribute) of global values that are
required at each point in...
2009 May 26
2
using lsoda() and nls() together
Thanks to Dieter Menne and Spencer Graves I started to get my way through
lsoda()
Now I need to use it in with nls() to assess parameters
I have a go with a basic example
dy/dt = K1*conc
I try to assess the value of K1 from a simulated data set with a K1 close to
2.
Here is (I think) the best code that I've done so far even though it crashes
when I call nls()
--------...
2009 Dec 06
2
Error in eval(expr, envir, enclos) : object 'N' not found
I'm running an LSODA to generate some graphs, but I need to stop at a certain
point and use those values to generate another LSODA output. This is
working fine, but when I try to run the second LSODA, I get the "Error in
eval(expr, envir, enclos) : object 'N' not found". Any ideas what can be
causin...
2005 Oct 25
2
solving ODE's in matrix form with lsoda()
...y to do, but suppose you have a system of equations like this,
dP1/dt = beta1*P1*V1 - mu1*P1
dP2/dt = beta2*P2*V2 - mu2*P2
dV1/dt = r1*V1 - beta1*P1*V1
dV2/dt = r1*V2 - beta1*P2*V2
System 1 and system 2 are independent but that doesn't need to be the
case. Now can you specify this system in lsoda() as:
dP/dt = beta*P*V - mu*P
dV/dt = r*V - beta*P*V
but now the initial state variables are 1x2 vectors and the
parameters beta, mu and r are also vectors of size 1x2:
y=c(10,20,10,20)
parms = matrix(c(0.05,0.1,0.2,0.05,0.1,0.2),nc=3,byrow=T)
model = function(times,y,parms) {
y=matrix(y,nc=2...
2004 Jun 10
0
lsoda with arbitrary zero thresholds (with psuedo-solution)
...0.0 faster by setting the
derivatives even larger in absolute value. You may run into problems
with the solver when the derivatives are discontinuous functions of the
state variables.
There is a simple and elegant solution in theory, but not (yet)
available in odesolve. soda has a variant called lsodar that returns
whenever a function of the state variables satisfies a given set of
conditions (in your case, you could tell lsodar to return whenever any
state variable drops below 0.4). Once the call to lsodar returns, you'd
then reset all the state variables that were < 0.4 to 0, and resta...
2005 Oct 26
2
changing memory limits to speed up lsoda
Hi All,
I am running R 2.2.0 on Mac OS 10.4.2, dual G5 processors with 8 Gig
RAM.
I am running a simulation with lsoda that requires ~378 s to complete
one set of time intervals. I need to optimize the parameters, and so
need to considerably speed up the simulation.
I have tried to figure out how to change the appropriate memory
allocation and have search R help and Introductory information and
the archives...
2004 Oct 06
1
Foreign code problem
Hello,
I wanted to test the odesolve package and tried to use compiled C-code.
But when I do:
erg <- lsoda(y, times, "mond", parms, rtol, atol, tcrit=NULL, jacfunc=NULL,
verbose=FALSE, dllname="mond", hmin=0, hmax=Inf)
I get the error message:
Error in lsoda(y, times, "mond", parms, rtol, atol, tcrit = NULL,
jacfunc = NULL, :...
2013 Apr 21
1
lsoda question from deSolve package
Dear List,
Wonder if you have some thoughts on the following question using lsoda in desolve:
I have the following data and function:
require(deSolve)
times <- c(0:24)
tin <- 0.5
D <- 400
V <- 26.3
k <-0.056
k12 <- 0.197118
k21 <- 0.022665
yini <- c(dy1 = 0,dy2 = 0)
events <- data.frame(var = "dy1",time = c(10,15),value = c(200,100),me...
2010 Sep 16
1
More accurate ODE solver?
Dear All,
I was using rk4 and lsoda to solve a ODE system. However, both of them gave
bad accurate solutions, especially compared with Matlab solver ODE45. For
example, ODE45 gave solutions that can go to a stable level (about 1.6) when
time goes to infinity, however, the solutions from lsoda are decreasing to
very very small (about...