An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101001/712dd90c/attachment.pl>
Random Movement Generator
5 messages · Roberto Badilla Fuentes, Andy Bunn, Michael Sumner +1 more
-----Original Message----- From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo- bounces at stat.math.ethz.ch] On Behalf Of Roberto Badilla Fuentes Sent: Friday, October 01, 2010 12:42 PM To: r-sig-geo Subject: [R-sig-Geo] Random Movement Generator Hi All, Is there a functionality in R that allows for the creation of random path or trajectory? Probably Brownian Motion can help but I'd like to output the data points and be able to have the points separated, say every 30 minutes.
I've used like this before in class to teach about random walks. Maybe this will get you going? HTH, Andy
require(sp)
xinit <- 0
yinit <- 0
d2move <- 1
nsteps <- 99
x <- c(xinit,rep(NA,nsteps))
y <- c(yinit,rep(NA,nsteps))
for(i in 2:(nsteps+1)){
theta <- runif(1,pi/180,360*pi/180)
xi <- d2move * cos(theta)
yi <- d2move * sin(theta)
x[i] <- x[i-1] + xi
y[i] <- y[i-1] + yi
}
plot(x,y,type='b')
xy <- SpatialPoints(cbind(x,y))
str(xy)
I also tried BM{sde}. Is there a way plot the points generated?
Thanks in advance
Roberto
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101002/f10ff458/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101002/92193f61/attachment.pl>
Hi Roberto, Did you have a look at the package adehabitat, and especially the simm.* functions (Brownian bridge motion, Bivariate Brownian Motion, Correlated Random Walk, Levy Walk, Arithmetic Brownian Motion, Bivariate Ornstein-Uhlenbeck Process)? This might be particularly helpful. Hope this helps, Mathieu. Le 01/10/2010 15:42, Roberto Badilla Fuentes a ?crit :
Hi All,
Is there a functionality in R that allows for the creation of random path or
trajectory? Probably Brownian Motion can help but I'd like to output the
data points and be able to have the points separated, say every 30 minutes.
I also tried BM{sde}. Is there a way plot the points generated?
Thanks in advance
Roberto
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
~$ whoami Mathieu Basille, Post-Doc ~$ locate Laboratoire d'?cologie Comportementale et de Conservation de la Faune + Centre d'?tude de la For?t D?partement de Biologie Universit? Laval, Qu?bec ~$ info http://ase-research.org/basille ~$ fortune ``If you can't win by reason, go for volume.'' Calvin, by Bill Watterson.