Re: [R] DeSolve Package and Moving Average

2017-11-29 Thread Eric Berger
Since you only provide pseudo-code I will give a guess as to the source of the problem. It is easy to get "burned" by use of the ifelse statement. Its results have the same "shape" as the first argument. My suggestion is to try replacing ifelse by a standard if ( ) { } else { } HTH, Eric

[R] DeSolve Package and Moving Average

2017-11-29 Thread Werning, Jan-Philipp
Dear all, I am using the DeSolve Package to simulate a system dynamics model. At the problematic point in the model, I basically want to decide how many products shall be produced to be sold. In order to determine the amount a basic forecasting model of using the average of the last 12 time pe

Re: [R] deSolve package

2015-10-17 Thread Thomas Petzoldt
Dear Andre, some people would be happy to assist you, but your code fragment is incomplete, so diagnosing your problem was impossible. Please read the posting guide and provide a minimum reproducible example. Furthermore I wonder why you use dede and not ode, and why sum() with empty parenth

Re: [R] DeSolve package

2015-10-16 Thread Giorgio Garziano
It is likely the "p" variable is not defined in your R environment. Inside your function model.LIDR, the variable "p" is used before being initialized in any of the environments reachable by the search path, included the model.LIDR function environment. The remedy is to define and initiali

[R] DeSolve package

2015-10-15 Thread Andre Jackson
I have the following differential equations and return list: dCgd.dt = -kad*y[1]-kgd*y[1] # PK model equation gut d dCld.dt= kad*y[1]-rhyd-rmetd #pk model equation liver d dCgl.dt = -kal*y2[1]-kgl*y2[1] # PK model equation gut l dCll.dt= kal*y2[1]-rhyl-rmetl #pk model

Re: [R] deSolve ODE Output Question

2015-05-20 Thread David Winsemius
On May 20, 2015, at 6:45 AM, walke554 wrote: > Hello, > > I am working on a simple ODE problem with the deSolve package, and I was > hoping that someone could answer a question about how the deSolve package > does integration. > > Here is my program: > > #The function > STDMod<-function(t,y,

[R] deSolve ODE Output Question

2015-05-20 Thread walke554
Hello, I am working on a simple ODE problem with the deSolve package, and I was hoping that someone could answer a question about how the deSolve package does integration. Here is my program: #The function STDMod<-function(t,y,p){ IH = y[1]; IL = y[2]; with(as.list(p),

Re: [R] deSolve, unresolved namespace error -- solved

2013-11-07 Thread Thomas Petzoldt
We have been able to reproduce the reported issue on another Linux system: Fedora 19, and the solution was quite simple: The deSolve package must always to be loaded *before* loading the shared library of the compiled model. Thomas __ R-help@r-project

Re: [R] deSolve, unresolved namespace error

2013-11-06 Thread Thomas Petzoldt
On 11/6/2013 6:50 PM, Adam Clark wrote:> Addendum: unloading and reloading deSolve.so does indeed fix the problem: library.dynam.unload("deSolve", libpath=paste(.libPaths()[1], "//deSolve", sep="")) library.dynam("deSolve", package="deSolve", lib.loc=.libPaths()[1]) However, this is a little cl

Re: [R] deSolve, unresolved namespace error

2013-11-06 Thread Adam Clark
Addendum: unloading and reloading deSolve.so does indeed fix the problem: library.dynam.unload("deSolve", libpath=paste(.libPaths()[1], "//deSolve", sep="")) library.dynam("deSolve", package="deSolve", lib.loc=.libPaths()[1]) However, this is a little clunky, and seems like overkill. Does anybody

Re: [R] deSolve, unresolved namespace error

2013-11-06 Thread Prof Brian Ripley
On 06/11/2013 17:20, Adam Clark wrote: I'm having trouble running the "ode" function from the "deSolve" package. I am running RStudio under Ubuntu 13.1 I am running ode() on compiled code that returns delta values using the .C convention. While I can include an example of the code, I suspect th

[R] deSolve, unresolved namespace error

2013-11-06 Thread Adam Clark
I'm having trouble running the "ode" function from the "deSolve" package. I am running RStudio under Ubuntu 13.1 I am running ode() on compiled code that returns delta values using the .C convention. While I can include an example of the code, I suspect that it will not be helpful, since the prob

Re: [R] deSolve question

2013-06-20 Thread Chris Campbell
, Chippenham, Wiltshire , SN14 OGB UK -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Andras Farkas Sent: 19 June 2013 00:46 To: r-help@r-project.org; r-sig-dynamic-mod...@r-project.org Subject: [R] deSolve question Dear All

[R] deSolve question

2013-06-18 Thread Andras Farkas
Dear All wonder if you could provide some insights on the following: currently I have this code which produces the expected results: require(deSolve) pars <- list(k = 0.08,v=15) intimes <- c(0,0.5,12) input <- c(800,0,0) forc <- approxfun(intimes, input, method="constant", rule=2) derivs <-

Re: [R] deSolve

2012-03-22 Thread Ben Bolker
Berend Hasselman xs4all.nl> writes: > > > On 22-03-2012, at 18:37, mhimanshu wrote: > > How to find best parameter values for deSolve function?? > > > > I assume you mean the deSolve package which has many options. > > I would suggest predicting which way the wind will blow the > day after

Re: [R] deSolve

2012-03-22 Thread Berend Hasselman
On 22-03-2012, at 18:37, mhimanshu wrote: > Hello all, > > How to find best parameter values for deSolve function?? > I assume you mean the deSolve package which has many options. I would suggest predicting which way the wind will blow the day after tomorrow. Berend

[R] deSolve

2012-03-22 Thread mhimanshu
Hello all, How to find best parameter values for deSolve function?? Thanks in Advance, -- View this message in context: http://r.789695.n4.nabble.com/deSolve-tp4496292p4496292.html Sent from the R help mailing list archive at Nabble.com. __ R-help@

[R] deSolve & optim, nlm function?

2012-03-22 Thread mhimanshu
Hi everyone. Can anyone please tell me how do i used optim or nlm function after solving a ode bx desolve package? I have a set of two differential equation, first i solved them with deSolve package and now i want to optimize my two parameter values for the same twoo differential equation? pleas

Re: [R] deSolve - Function daspk on DAE system - Error (Vince)

2011-10-03 Thread Soetaert, Karline
ere is a special R-mailinglist that deals with this type of problems: r-sig-dynamic-mod...@r-project.org Hope this helps, Karline - Original message: Date: Sat, 1 Oct 2011 20:20:10 -0700 (PDT) From: Vince To: r-help@r-project.org Subject: [R] deSolve - Function daspk on

[R] deSolve - Function daspk on DAE system - Error

2011-10-01 Thread Vince
I'm getting this error on the attached code and breaking my head but can't figure it out. Any help is much appreciated. Thanks, Vince CODE: library(deSolve) Res_DAE=function(t, y, dy, pars) { with(as.list(c(y, dy, pars)), { res1 = -dS -dES-k2*ES res2 = -dP + k2*ES eq1 = Eo-E -ES

Re: [R] deSolve, extracting variable values from inside ode function

2011-08-16 Thread Berend Hasselman
jamaas wrote: > > I'm just getting to grips with using ode function and have used the > examples and vignettes to produce a small model of a one-pool, > michaelis-menten, enzyme kinetic reaction. The rate of flux of substrate > into pool A is constant (fluxoa) however the rate of flux out of p

[R] deSolve, extracting variable values from inside ode function

2011-08-16 Thread Jim Maas
I'm just getting to grips with using ode function and have used the examples and vignettes to produce a small model of a one-pool, michaelis-menten, enzyme kinetic reaction. The rate of flux of substrate into pool A is constant (fluxoa) however the rate of flux out of pool A is controlled by th

[R] deSolve output

2011-08-12 Thread Sébastien Bihorel
Hi, Try with the following ODE function. This should give you an extra column with the derivative of G in your THAAC matrix. degradation = function (t, state, parameters) {  with(as.list(c(state, parameters)),    {dG = (-a*(t+i)^b)*(G)    list(c(dG),dG=dG)    }) } Any additional variables that y

[R] deSolve output

2011-08-12 Thread bosse
Hi, I've solved a simple differential equation describing the degradation of amino acid carbon (THAA-C) using deSolve. Code is a follows: # Input of model parameters, a and b describes form of curve, i is apparent initial age of Org. C. parameters <- c(a = a, b = b, i=i) # Initial val

Re: [R] deSolve: Problem solving ODE including modulo-operator

2011-01-30 Thread Thomas Petzoldt
Dear Albert2002, there is no problem with deSolve and, of course, no problem with R's modulo operator, but there are at least two errors in your model formulation: 1.) The order of the returned derivatives must be exactly the same as specified in the state variables. This is documented in th

[R] deSolve: Problem solving ODE including modulo-operator

2011-01-25 Thread apokaly
I have a problem integrating the 'standard map' ( http://en.wikipedia.org/wiki/Standard_map http://en.wikipedia.org/wiki/Standard_map ) with deSolve: By using the modulo-operator '%%' with 2*pi in the ODEs (standardmap1), the resulting values of P and Theta, should not be greater than 2pi. Becaus

Re: [R] Desolve package: How to pass thousand of parameters to C compiled code?

2010-06-11 Thread Thomas Petzoldt
On 6/8/2010 2:03 PM, Ben Bolker wrote: yahoo.com> writes: Hi, I have used DeSolve package for my ODE problem regarding infectious disease transmission and currently am trying to pass lots (roughly a thousand) of model parameters to the C compiled model (I have to use C compiled code inst

Re: [R] Desolve package: How to pass thousand of parameters to C compiled code?

2010-06-08 Thread Ben Bolker
yahoo.com> writes: > > Hi, > > I have used DeSolve package for my ODE problem regarding > infectious disease transmission and currently am > trying to pass lots (roughly a thousand) of model parameters > to the C compiled model (I have to use C > compiled code instead of R code purely because

[R] Desolve package: How to pass thousand of parameters to C compiled code?

2010-06-07 Thread cmmu_mile
Hi, I have used DeSolve package for my ODE problem regarding infectious disease transmission and currently am trying to pass lots (roughly a thousand) of model parameters to the C compiled model (I have to use C compiled code instead of R code purely because of the speed). I can't go define it

Re: [R] deSolve question

2009-06-12 Thread Karline
In-Sun, It is very simple. You define your state variables in the following order: y <- c(Agi = 0,Alu = 0, Abr = 0, Ah = 0, Ali = 0, Ak = 0, Am = 0, Ask = 0, Aad = 0, Apa = 0, Asp = 0, Aar = 0, Ave = 0) and your rates of change in another order: dy = c(dAar, dAve, dAlu, dAli, dAbr,

Re: [R] deSolve question

2009-06-11 Thread Thomas Petzoldt
insun nam wrote: Dear All, I like to simulate a physiologically based pharmacokinetics model using R but am having a problem with the daspk routine. The same problem has been implemented in Berkeley madonna and Winbugs so that I know that it is working. However, with daspk it is not, and the nu

Re: [R] deSolve question

2009-06-11 Thread spencerg
Dear In-Sun: I have not seen a reply, so I will offer some suggestions, hoping I can help without understanding all the details. 1. Have you run that code with "options(warn=2)"? It produced over 50 warnings for me, and "options(warn=2)" will convert the warnings to erro

[R] deSolve question

2009-06-11 Thread insun nam
Dear All, I like to simulate a physiologically based pharmacokinetics model using R but am having a problem with the daspk routine. The same problem has been implemented in Berkeley madonna and Winbugs so that I know that it is working. However, with daspk it is not, and the numbers are everywher