Skip to content
Prev 389 / 696 Next

[R-sig-dyn-mod] Help with function

Daniel,

I apologize for the confusion. I feel bad asking for this much help. As
earlier stated, I am still extremely new to R. I have only used it on
extremely simple linear statistics (e.g., multiple regression, ANOVA, etc).
I am trying to learn deSolve and do not know what the program requires for
my syntax to run on my data. Specifically, what I need to name my variable
in the dataset or name the variable in equation syntax.

For example, below is my equation and a link to my dataset variable names.
When I run the syntax for that model, it does not run on my data and give
me a summary of the fit and other results. I was wondering if you could
help me learn to run it, and after this example, I would hopefully be able
to run these models on my own.

Link:
http://s1074.photobucket.com/user/austinmullings89/media/Picture%20of%20Levy%20Model%20data.jpg.html

Equation syntax:

library(deSolve)

myfn <- function(t, y, p) {

  dy <- numeric(6)
  dy[1] <- p[1] - p[2]*y[4] - p[3]*y[1]
  dy[2] <- y[5]*dy[1]*(1+y[6]) - p[5]*y[2] - (p[6]*y[3]*y[4]*y[1] - p[7])
  dy[3] <- p[8] - p[9]*y[2]
  dy[4] <- y[6]*dy[1] - p[10]*y[4] + p[11]*(p[6]*y[3]*y[4]*y[1] - p[7]) +
p[4]
  dy[5] <- 1.0 - y[5]*(y[1] + y[4] + 1)
  dy[6] <- 1.0 - y[6]*(y[1] + 1)

  return(list(dy))

}

pars <- runif(11)
yini <- runif(6)
times <- seq(0, 10, .01)


out <- ode(yini, times, myfn, pars)
plot(out)

On Thu, Mar 12, 2015 at 8:23 AM, Daniel Kaschek <
daniel.kaschek at physik.uni-freiburg.de> wrote: