# eWalk, an R function to simulate two-dimensional evolutionary walks

**long time ago...**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

*eMotion*function in order implement this kind of movement models:

*from*

**eWalk**(*evolutiveWalk…*).

*eWalk*is similar to other movement-simulation functions in

*adehabitatLT*package (Calenge, 2006). However, you can use

*eWalk*to simulate a variety of processes as Brownian motion, OU processes or Lèvy flights (see below).

eWalk 15){ # Levy jump probability threshold l=15 # length of the jump x= lon + (l * (sigma * rnorm(1))) + (alpha_x * ( theta_x - lon)) # Brownian or OU process for longitude y= lat + (l * (sigma * rnorm(1))) + (alpha_y * ( theta_y - lat)) # Brownian or OU process for latitude loc=cbind(x,y) route[generation,]

*eMotion*, but taking into account that now you have two variables (latitude/longitude, for example) at the same time.

In addition, I have added a complement to simulate Lèvy flights, a non-gaussian process similar to Brownian motion but allowing for jumps during the motion. Lévy flights pattern has been found in searchingmovements of predators (Bartumeus et al., 2005), or have been used to simulatepunctuated equilibrium in traitsevolution (Gould and Eldredge, 1977; Landis et al., 2013). To perform Lèvy flight, eWalk selects a random number from Cauchy distribution and if it is higher than a threshold (15 by default), Brownian motion term is multiplied by a constant representing a jump (also 15 by default). Although this is not the formal expression of a Lèvy process, this is a simple way to simulate a negative exponential rate in for the length of each step.

par(mfrow=c(2,2)) a=eWalk(0.15,0,0,1000, 0, 0, 0, 0, color="blue", levy=FALSE, plot=FALSE) plot(a,type="n", main="Brownian motion") lines(a,lwd=3, col="blue") points(a, cex=.3, col="black", pch=21) a=eWalk(0.15,0,0,1000, 0, 0, 0, 0, color="red", levy=TRUE, plot=FALSE) plot(a,type="n", main="Lêvy flight") lines(a,lwd=3, col="red") points(a, cex=.3, col="black", pch=21) a=eWalk(0.15,0,0,1000, 0.01, 20, 0, 0, color="orange", levy=FALSE, plot=FALSE) plot(a,type="n", main="OU one optimum") lines(a,lwd=3, col="orange") abline(v=20, col="red", lwd="2") points(a, cex=.3, col="black", pch=21) a=eWalk(0.15,0,0,1000, 0.01, 20, 0.01, 20, color="green", levy=FALSE, plot=FALSE) plot(a,type="n", main="OU two optimum") lines(a,lwd=3, col="green") points(a, cex=.3, col="black", pch=21) abline(v=20, col="red", lwd="2") abline(h=20, col="red", lwd="2")

**References**

*Ecology*,

*86*(11), 3078-3087.

*Ecological modelling*,

*197*(3), 516-519.

*Paleobiology*,

*3*(02), 115-151.

*Systematic biology*,

*62*(2), 193-204.

**leave a comment**for the author, please follow the link and comment on their blog:

**long time ago...**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.