hey can anybody help me? i have to simulate the richardson Arms race model on R.. for my simulation class...
First search the web; there seems to be an abundance of material on what the algorithm is and then implement the algorithm in R. Once you have something, then if you are having problems with it, then ask a question. We can not solve your homework for you. On Sun, Nov 9, 2008 at 3:18 PM, dennis campos <abstrasctik at gmail.com> wrote:> hey can anybody help me? i have to simulate the richardson Arms race model > on R.. for my simulation class... > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Sure, but we aren't going to do it for you... Start simulating and then give use specific problems. On Sun, Nov 9, 2008 at 3:18 PM, dennis campos <abstrasctik at gmail.com> wrote:> hey can anybody help me? i have to simulate the richardson Arms race model > on R.. for my simulation class... > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
dennis campos wrote: > hey can anybody help me? i have to simulate the richardson Arms race model on R.. for my simulation class... Hi Dennis, this list is not intended for solving your homework, however, the following may help you to go one step ahead. You should have a look into the help pages of packages deSolve and/or simecol. Please find below the (IMHO rather elegant) simecol implementation but beware, your professor might expect the "basic" deSolve style, so be prepared about discussing both. And, don't forget to read the background. ## deSolve ##################### library(deSolve) ? ode ## simecol ##################### library(simecol) ## open the directory with R sourcecode examples browseURL(paste(system.file(package="simecol"), "/examples", sep="")) .... and modify the example lv.R Thomas P. ############################################################## library("simecol") armsrace <- new("odeModel", main = function (time, init, parms) { x <- init[1] y <- init[2] with(as.list(parms), { dx <- a * y - m * x + r dy <- b * x - n * y + s list(c(dx, dy)) }) }, parms = c(a=2, m=5, r=5, b=2, n=3, s=5), times = c(from=0, to=10, by=0.5), init = c(x=0.5, y=1), solver = "lsoda" ) ar1 <- ar2 <- ar3 <- ar4 <- armsrace parms(ar2) <- c(a=2, m=1, r=3, b=2, n=2, s=3) parms(ar3) <- c(a=1, m=4, r=-1, b=1, n=1, s=-2) parms(ar4) <- c(a=2, m=1, r=-3, b=2, n=1, s=-3) ar1 <- sim(ar1); plot(ar1) ar2 <- sim(ar2); plot(ar2) ar3 <- sim(ar3); plot(ar3) ar4 <- sim(ar4); plot(ar4)