Displaying 20 results from an estimated 1100 matches similar to: "estimating the starting value within a ODE using nls and lsoda"
2010 Sep 20
1
ERROR: Object not found
Dear All,
I am trying to use ode solver "rk4" to solve an ODE system, however, it
keeps saying: Error in eval(expr, envir, enclos) : object "dIN" not found.
The sample codes are enclosed as follows, please help me. Thank you very
much!
rm(list=ls())
library(odesolve)
# The ODE system
ode <- function(t,x,p){
with(as.list(c(x,p)),{
2010 Sep 20
1
Ask for help with Error: Object not found
Dear All,
I am trying to use ode solver "rk4" to solve an ODE system, however, it
keeps saying: Error in eval(expr, envir, enclos) : object "dIN" not found.
The sample codes are enclosed as follows, please help me. Thank you very
much!
rm(list=ls())
library(odesolve)
# The ODE system
ode <- function(t,x,p){
with(as.list(c(x,p)),{
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
2009 Jun 12
2
External signal in ODE written in C (using deSolve and approx1?)
Dear list
The deSolve package allows you to specify the model code in C or Fortran.
Thanks to the excellent vignette this works fine. However I have not yet
managed to use forcing functions in C code.
In pure R code this works very well with approxfun() specified outside the
model:
###############################################
#Model
lvml <- function(t, x, parms) {
2004 Jun 10
2
odesolve: lsoda vs rk4
I'm trying to use odesolve for integrating various series of coupled 1st
order differential equations (derived from a system of enzymatic
catalysis and copied below, apologies for the excessively long set of
parameters).
The thing that confuses me is that, whilst I can run the function rk4:
out <- rk4(y=y,times=times,func=func, parms=parms)
and the results look not unreasonable:
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 1e-130) numbers.
Does R have more accurate ODE solvers as
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 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 below). The
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()
2004 Jan 23
0
cmptl_analy.R
Dear Michael,
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,
2005 Oct 25
2
solving ODE's in matrix form with lsoda()
Hello there,
Suppose you want to solve the following system of ODE's (a simple
Lotka-Volterra predator prey model)
dP/dt = beta*P*V - mu*P
dV/dt = r*V - beta*P*V
where P and V are the numbers of predators and prey. Now, this is
easy 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
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())
2013 Apr 10
0
Problem with ode
Hi,
I am trying to run a 1D nutrient-phytoplankton-zooplankton model in R
using the package 'deSolve'. The code is shown below:
DEPTH = seq(2.5, 147.5, 5)
NPZ = function(t, state, params){
with(as.list(params), {
P <- state[1:NB]
Z <- state[(NB + 1): (2*NB)]
N <- state[(2*NB + 1): (3*NB)]
F.I = function(z, hr){
I0 = function(hr){
2009 May 13
2
ode first step
Hi all,
I try to assess the parameters (K1,K2) of a model that describes the
adsorption of a molecule onto on adsorbent.
equation: dq/dt = K1*C*(qm-q)-K2*q
I know the value of 'qm' and I experimentally measure the variables 'q',
'C', and the time 't'.
t C q
1 0 144.05047 0.0000000
2 565 99.71492 0.1105625
3 988 74.99426
2003 Oct 23
2
OOP like handling of lists?
Hello,
I am writing a package with a collection of several models. In order to
allow users to play interactively with the models (in contrast to
hacking lengthy scripts), I want to put all what is needed to run a
particular model into a single list object for each model.
Then there will be a collection of functions to run the model or to
modify parameters, time steps, integration method ...,
2004 Oct 04
3
Beginners problem
Hi,
I'm new to R and have a problem with a little test program (see below).
Why doesn't <<- in function rk4
assign the new value to y so that it is seen in rktest. I thought that
<<- does exactly this. But it seems that I
didn't get it right. I would be very appreciative for an explanation of
that behaviour of <<-. I know how to
write the whole thing so that it
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 `times'."
I
2003 May 29
0
ODE solvers in R (was:The Wrong Choice: Locked in by license restrict...
Dear Colleague:
I am glad to hear from you. I was going to contact you and ask if you have
notes on the steps involved on how you implemented LSODA. I will gladly take the
project on. In addition to dassl, I want to implement ODESSA also. In other
words, my project is a "suite" of ode solvers for R. The application of these
solvers will be to the study of the distribution of
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
2018 May 31
0
Help in dynamic simulation using deSolve
Hi R help,
I wanted to simulate two pool model (A&B) using deSolve package for time 0 to 12 by 1.? Initial values of the state variables are A=5, B=3. The fluxes are as follows1) Flux into A= 5 units per unit time?2) Flux from A to B= 0.33) Flux out of A=0.1?4) Flux from B to A=0.35) Flux out of B=0.3
Here is the R code I compiled to estimate the size of A and B and graph the output