Displaying 20 results from an estimated 700 matches similar to: "Fitting compartmental model with nls and lsoda?"
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
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
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 Apr 06
1
estimating the starting value within a ODE using nls and lsoda
All-
I am interested in estimating a parameter that is the starting value for an ODE model.
That is, in the typical combined fitting procedure using nls and lsoda (alternatively rk4), I first defined the ODE model:
minmod <- function(t, y, parms) {
G <- y[1]
X <- y[2]
with(as.list(parms),{
I_t <- approx(time, I.input, t)$y
dG <- -1*(p1 + X)*G +p1*G_b
dX <-
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),method =
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 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
2004 Jun 08
1
Differential Equations
Hello!
I would like to know if R can solve Differential Equations...
I don't think so because, in my point, I see R like a Statistical System, not a
Math System. Am I wrong?
Thank you very much.
M??rcio de Medeiros Ribeiro
Graduando em Ci??ncia da Computa????o
Departamento de Tecnologia da Informa????o - TCI
Universidade Federal de Alagoas - UFAL
Macei?? - Alagoas - Brasil
Projeto CoCADa
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
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
2004 Jun 14
1
olesolve: stepsize
Hi,
I am doing a project on the simulation of glucose metabolism based on a
pharmacokinetic modeling in which we have 4 differential equations. I did
this in R by using the odesolve package. It works very well, but I have two
questions:
Here is the odemodel function
_________________________________________________
Ogtt.Odemodel <- function(t, y, p) {
absx <- c(-60, -45, -30,
2007 Apr 09
1
How to solve differential and integral equation using R?
Hello,
I want to know if there are some functions or packages to solve differential
and integral equation using R.
Thanks.
Shao chunxuan.
[[alternative HTML version deleted]]
2002 Jun 27
1
Building from a source-code library under windows
Dear All,
I have a pair of .cpp and .def file can be compiled using VC++ and works
perfectly well in S-PLUS.
I wanted to do the same for R; so I followed the guidline given in "Building
from a source-code library under Windows" as much as possible and manage to
compile them using VC++ and call it from R. But it gives different answer
from the one called from S-Plus.
I know that I did
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
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) {
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
2004 Feb 05
1
Installing odesolve under MacOSX
Installing odesolve in Raqua 1.8.0 or 1.8.1 under MacOSX gives the following
message:
Warning message: Installation of package odesolve had non-zero exit status
in: install.packages(ui.pkgs, CRAN = getOption(where), lib = .libPaths()[1])
Moreover, in the source of odesolve is no makefile.
Does anyone know how to get a proper installation?
Maartje
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 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"]; ry <- p["ry"]
Kx <-