Displaying 20 results from an estimated 26 matches for "rtol".
Did you mean:
rtl
2003 Dec 01
1
matrix bending
Dear All,
I was wondering whether any one knows of a matrix bending function in
R that can turn non-positive definite matrices into the nearest
positive definite matrix. I was hoping there would be something akin
to John Henshall's flbend program
(http://agbu.une.edu.au/~kmeyer/pdmatrix.html), which allows the
standard errors of the estimated matrix elements to be considered in
the
2005 Jul 19
2
Michaelis-menten equation
...odel <- function(time, y, parms) {
dCpdt <- -(parms["Vm"]/parms["Vd"])*y[1]/(parms["Km"]+y[1])
list(dCpdt)}
Dose<-300
modfun <- function(time,Vm,Km,Vd) {
out <- lsoda(Dose/Vd,time,mm.model,parms=c(Vm=Vm,Km=Km,Vd=Vd),
rtol=1e-8,atol=1e-8)
out[,2] }
objfun <- function(par) {
out <- modfun(PKindex$time,par[1],par[2],par[3])
sum((PKindex$conc-out)^2) }
fit <- optim(c(10,1,80),objfun, method="Nelder-Mead)
print(fit$par)
[1] 10.0390733 0.1341544 34.9891829 #--Km=0.1341544,wrong value--...
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, :
Unable to find mond in mond
The C co...
2001 May 11
1
lsoda
...s needed
for that system of equations. Why is it needed?
For my function below ('lvcomp2'), I don't know what global values lsoda
needs at each point in time (see???), other than the previous time step's
values of y and the parms. Any help?
Also, any rule of thumb advice regarding rtol and atol would be appreciated.
p <- c(r1=.01, r2=.01, a12=0.5, a21=0.6, k1=1,k2=1)
t <- 1:20
lvcomp2 <- function(y, t, p)
{ # Lotka - Volterra model of two competing populations
dN1.dt <- p["r1"] * y[1] * (1-(y[1] + p["a12"]*y[2])/p["k1"])
dN2.dt <- p[&...
2004 Jun 10
2
odesolve: lsoda vs rk4
...ms)
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 causing this (I'm guessing the wide range of the
absolute val...
2008 Apr 09
3
LSODA not accurate when RK4 is; what's going on?
I'm solving the differential 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
2005 Nov 06
1
Problem defining a system of odes as a C library with lsoda
...require(odesolve)
parms <- c(k1 = 0.04, k2 = 1e4, k3=3e7)
my.atol <- c(1e-6, 1e-10, 1e-6)
times <- c(0, 4*10^(-1:10))
print(system.time(
out1 <- lsoda(c(1.0,0.0,0.0),times,"myderivs",
parms,
rtol=1e-4,atol=my.atol,jacfunc="myjac",
dllname="mymod")
)
)
### END
When I run this mymod.c compiles without any errors or warnings and the
mymod.so library seems to load fine via dyn.load (the call
is.loaded("mymod&...
2009 Jun 11
3
deSolve question
..., dAve, dAlu, dAli, dAbr, dAh, dApa, dAsp, dAgi, dAk,
dAm, dAad, dAsk),
Car = Car, Cve=Cve, Clu=Clu, Cli=Cli, Cbr=Cbr, Ch=Ch, Cpa=Cpa,
Csp=Csp, Cgi=Cgi, Ck=Ck, Cm=Cm, Cad=Cad, Csk=Csk))
})
}
ODE <- as.data.frame(daspk(y = y, times = times, func = Fun_ODE,
parms = pars, atol = 1e-10, rtol = 1e-10))
--
Dr In-Sun Nam Knutsson
Research Associate
The Centre for Applied Pharmacokinetic Research (CAPKR)
School of Pharmacy and Pharmaceutical Sciences
University of Manchester
Stopford Building
Oxford Road
Manchester
U.K.
Phone: +44 161 275 2355
Email: In-sunnam.Knutsson@manchester.ac.u...
2020 Sep 13
1
[cfe-dev] Phabricator -> GitHub PRs?
...e time cleaning up the description so a commit may look like:
>
> ```
> RFC: treat small negative λ as 0 for sqrt(::Hermitian) (#35057)
>
> * treat small negative λ as 0 for sqrt(::Hermitian) and log(::Hermitian)
>
> * typo
>
> * added tests, docs; removed rtol argument for log
>
> * don't ask for rtol so close to eps(Float64)
> ```
There are some inelegant ways to workaround that problem (see, for
example,
https://github.com/material-foundation/github-squash-and-merge-pr-descriptions
if you are using Chrome).
I think I suggested GitHub...
2012 Nov 26
1
Help on function please
...c=c(32,28,25,22,18,14,11))
Dose<-200
Tinf <-0.5
defun<- function(time, y, parms) {
dCpdt <- -parms["kel"] * y[1]
list(dCpdt)
}
modfun <- function(time,kel, Vd) {
out <- lsoda(((Dose/Tinf)*(1/(kel*Vd)))*(1-exp(-kel*time)),c(0,time),defun,parms=c(kel=kel,Vd=Vd),rtol=1e-3,atol=1e-5)
out[-1,2]
}
objfun <- function(par) {
out <- modfun(PKindex$time, par[1], par[2])
gift <- which( PKindex$conc != 0 )
sum((PKindex$conc[gift]-out[gift])^2)
}
gen<-genoud(objfun,nvars=2,max=FALSE,pop.size=30,max.generations=100,wait.generations=100,starting....
2013 Apr 21
1
lsoda question from deSolve package
...f (t < tin) R <- (D/tin) else R <- 0
dy1 <- R - (p["k12"]+p["k"])* y[1] + p["k21"]*y[2]
dy2 <- p["k12"]* y[1] - p["k21"] *y[2]
list(c(dy1, dy2))
}
p <- c(k=k, k12=k12, k21=k21, V=V)
result <- lsoda( yini, times, pkmod, p,rtol = 1e-08, atol = 1e-08,events = list(data = events))
result <- data.frame(result)
names(result) <- c("time","Amount1", "Amount2")
plot(result$Amount1 ~ result$time, type="b", main="Central", xlab="time", ylab="Amount")
plot(...
2008 Nov 21
1
lsoda warning "too much accuracy requested"
...deas / 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 June 2004 but this has not helped me.
I have built the model in stages and the problem only occurs when the
exponent beta in the third DE is anything other than 0 or 1. If beta = 0 or
1 then the solver gives me perfectly ju...
2004 Jun 10
0
lsoda with arbitrary zero thresholds (with psuedo-solution)
...ot;] * y[1] + p["k2"] * y[2]*y[3]
> if(y[3] < .4) yd3 <- -y[3] ### These if,else statements are new
> else yd3 <- p["k3"] * y[2]^2
> list(c(yd1,-yd1-yd3,yd3),c(massbalance=sum(y)))
> }
> out <- lsoda(c(.5,0,.5),times,lsexamp, parms, rtol=1e-4, atol=
my.atol,
> hmax=.1)
> matplot(out[,1],out[,2:5], type="l")
> out[dim(out)[1],] # The intent of my could was to cause population 1
to
> fall to zero as soon as it reached < 0.4. However, the populations 1
> and 2 reach approximations of 0 (4e-281 and 5e-11)....
2018 Jul 30
2
trace in uniroot() ?
...quivalent operation at
the same precision level. It is very easy for codes to be very slightly
different and give quite widely different output.
Indeed, even without the trace, we see (zeroin from rootoned here)
> zeroin(ff, c(0, 10), trace=FALSE)
$root
[1] 1.386294
$froot
[1] -5.658169e-10
$rtol
[1] 7.450581e-09
$maxit
[1] 9
> uniroot(ff, c(0, 10), trace=FALSE)
$root
[1] 1.38629
$f.root
[1] -4.66072e-06
$iter
[1] 10
$init.it
[1] NA
$estim.prec
[1] 6.103516e-05
>
Is the lack of trace a bug, or at least an oversight? Being able to follow iterations is a
classic approach to chec...
2006 Apr 25
1
Windows MinGW compiler clarification, consequences
...-- t (=r1) illegal
Warning: t not in interval tcur - hu (= r1) to tcur (=r2)
Warning: intdy-- t (=r1) illegal
Warning: t not in interval tcur - hu (= r1) to tcur (=r2)
Warning: lsoda-- trouble from intdy. itask = i1, tout = r1
Error in lsoda(y = y0, times = times, fderiv, parms = c(mod = mod), rtol = 1e-04, :
Illegal input to lsoda
R version: 2.3.0 (2006-04-24)
>gcc --version
gcc (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR...
2002 Feb 01
1
typo and user-proofing in odesolve() (PR#1295)
A couple of minor points about the odesolve package
(which I am otherwise enjoying very much):
1. "scalar" is misspelled as "scaler" in the definitions of
the rtol and atol parameters
2. it is possible to crash R by doing something dumb, e.g
failing to read the documentation carefully enough and (a)
returning only a vector of derivatives and not a list of
(derivatives, global values) and (b) making the derivative
vector shorter than the vector of initial co...
2020 Sep 11
2
[cfe-dev] Phabricator -> GitHub PRs?
On Fri, Sep 11, 2020 at 6:53 PM David Blaikie <dblaikie at gmail.com> wrote:
> Is there any observable difference between "Squash and Merge" or "Rebase
> and Merge" when "enforce linear history" is enabled, then?
>
"Squash and Merge" will only generate one commit.
>
> On Fri, Sep 11, 2020 at 3:45 PM Stephen Neuendorffer via llvm-dev
2006 Aug 26
1
problems with loop
...ot;k")
{
I=x[1]
dI=-w["mu"]*I+w["beta0"]*exp(-w["k"]*t)*(1-I)
list(c(dI),c(S=1-I))
}
output = lsoda(c(I_mod),times,ODE_sys, parms, rtol=1e-6, atol=
my.atol)
return(output)
}
# The negative log likelihood of this model given a data set "new". This
works fine if it is used in the optim() routine with only one data set.
NLL=function(coef)
{
beta0=coef[1]
mu=coef[2]
k=coef[3]...
2018 Aug 13
1
trace in uniroot() ?
...ly
> different and give quite widely different output.
>
> Indeed, even without the trace, we see (zeroin from rootoned here)
>
> > zeroin(ff, c(0, 10), trace=FALSE)
> $root
> [1] 1.386294
>
> $froot
> [1] -5.658169e-10
>
> $rtol
> [1] 7.450581e-09
>
> $maxit
> [1] 9
>
> > uniroot(ff, c(0, 10), trace=FALSE)
> $root
> [1] 1.38629
>
> $f.root
> [1] -4.66072e-06
>
> $iter
> [1] 10
>
> $init.it <http://init.it>
> [1]...
2011 Oct 02
0
deSolve - Function daspk on DAE system - Error
...0.02, k2=250, E=0.01); pars
yini <- c(S=0.01, ES = 0.01, P=0.0, E=0.01); yini
times <- seq(0, 0.01, by = 0.0001); times
dyini = c(dS=0.0, dES=0.0, dP=0.0)
## Tabular output check of matrix output
DAE <- daspk(y = yini, dy = dyini, times = times, res = Res_DAE, parms =
pars, atol = 1e-10, rtol = 1e-10)
ERROR:
daspk-- warning.. At T(=R1) and stepsize H (=R2) the nonlinear solver
f
nonlinear solver failed to converge repeatedly of with abs (H) =
H
repeatedly of with abs (H) = HMIN preconditioner had repeated
failur
0.0000000000000D+00 0.5960464477539D-...