Also, this paper has some example R code (in Ecological Archives) to simulate a track from bivariate random walk.
@ARTICLE{patterson2010using, author = {Patterson, T.A. and McConnell, B.J. and Fedak, M.A. and Bravington, M.V. and Hindell, M.A.}, title = {{Using GPS data to evaluate the accuracy of state-space methods for correction of Argos satellite telemetry error}}, journal = {Ecology}, year = {2010}, volume = {91}, pages = {273--285}, number = {1}, publisher = {Eco Soc America} } I'm not sure if the supplement is availalbe publicly, but if not and you don't have access you could perhaps email the author: http://www.esapubs.org/archive/ecol/E091/020/suppl-1.htm#anchorFilelist Cheers, Mike. On Sat, Oct 2, 2010 at 12:44 PM, Michael Sumner <mdsum...@gmail.com> wrote: > There's an example in the trip package function filter.penSS that might be > of interest, provided by my supervisor Simon Wotherspoon. You could adjust > the values to get 30 min intervals. > > ## Fake some data > > ## Brownian motion tethered at each end > brownian.bridge <- function(n, r) { > x <- cumsum(rnorm(n, 0, 1)) > x <- x - (x[1] + seq(0, 1, length = n) * (x[n] - x[1])) > r * x > } > > ## Number of days and number of obs > days <- 50 > n <- 200 > > ## Make separation between obs gamma distributed > x <- rgamma(n, 3) > x <- cumsum(x) > x <- x/x[n] > > ## Track is lissajous + brownian bridge > b.scale <- 0.6 > r.scale <- sample(c(0.1, 2, 10.2), n, replace = TRUE, prob = c(0.8, > 0.18, 0.02)) > set.seed(44) > > tms <- ISOdate(2001, 1, 1) + trunc(days * 24 * 60 * 60 *x) > lon <- 120 + 20 * sin(2 * pi * x) + brownian.bridge(n, b.scale) + > rnorm(n, 0, r.scale) > lat <- -40 + 10 *(sin(3 * 2 * pi * x) + cos(2 * pi * x) - 1) + > brownian.bridge(n, b.scale) + rnorm(n, 0, r.scale) > > tr <- new("trip", SpatialPointsDataFrame(cbind(lon, lat), > data.frame(gmt = tms, id = "lbb")), TimeOrderedRecords(c("gmt", "id"))) > > On Sat, Oct 2, 2010 at 7:30 AM, Andy Bunn <andy.b...@wwu.edu> wrote: > >> > -----Original Message----- >> > From: r-sig-geo-boun...@stat.math.ethz.ch [mailto:r-sig-geo- >> > boun...@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@stat.math.ethz.ch >> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> >> _______________________________________________ >> R-sig-Geo mailing list >> R-sig-Geo@stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> > > > > -- > Michael Sumner > Institute for Marine and Antarctic Studies, University of Tasmania > Hobart, Australia > e-mail: mdsum...@gmail.com > -- Michael Sumner Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia e-mail: mdsum...@gmail.com [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo