First-Difference Correlated Random Walk for "Animal Movement"

145 views
Skip to first unread message

Nick Freymueller

unread,
May 30, 2024, 12:52:43 AM5/30/24
to R-inla discussion group
Hi INLA team,

I'm trying to set up a 2-dimensional (longitude/latitude) state-space model that runs a first-difference correlated random walk that's commonly applied in animal movement studies (example paper: https://esajournals.onlinelibrary.wiley.com/doi/full/10.1890/04-1852 ) in the INLA framework.

This is for marine "animals" that cannot move across land, but it's not clear to me how I would implement the barrier meshes in this situation. I'm hopefully trying to reconstruct accurate daily positions of these "animals". Many of the coordinates of observations also have different levels of uncertainty (exact longitude coordinates are often missing and/or are much more uncertain that latitude coordinates are). The time variable is also expected to have some measurement error (probably gaussian and on the scale of hours). I also have strong prior beliefs that the process and observation models are very similar between different individuals, and therefore should be indexed hierarchically. This would especially be helpful for individuals where the number of observations/data quality is low.

There are helpful frequentist TMB-based packages for doing this type of modeling (see below), but these fit models independently for each individual, and can't handle missing longitude data or uncertainty in the time variable. 

How easy (if at all) would it be to cast these models into the INLA framework? Would a "rw2" model be close enough to a first-difference-correlated random walk to be useful? I've gone through the Ravishanker et al. "Dynamic time series models using R_INLA" book, but this doesn't seem to have quite what I'm looking for.


Kind regards,
Nick Freymueller

Helpdesk (Haavard Rue)

unread,
May 31, 2024, 6:23:08 AM5/31/24
to Nick Freymueller, R-inla discussion group


If you thinking of doing eq 2-4, you have to do that in rgeneric/cgeneric (use rgeneric for testing...), as the precision matrix will just be a simple band-matrix. 

please see the vignette

browseVignettes(package="INLA")


(due to an error, some recent versions does not include it, so I attach the file). Its there now, in the testing version with R-4.4

H


--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.

-- 
Håvard Rue
he...@r-inla.org
rgeneric.pdf

Helpdesk (Haavard Rue)

unread,
May 31, 2024, 6:27:10 AM5/31/24
to Nick Freymueller, R-inla discussion group

The structure you'll get in the same as for the continous RW discussed at the
end of chapter 3 in the GMRF book

On Fri, 2024-05-31 at 13:22 +0300, Helpdesk (Haavard Rue) wrote:
>
>
> If you thinking of doing eq 2-4, you have to do that in rgeneric/cgeneric (use
> rgeneric for testing...), as the precision matrix will just be a simple band-
> matrix. 
>
> please see the vignette
>
> browseVignettes(package="INLA")
>
>
> (due to an error, some recent versions does not include it, so I attach the
> file). Its there now, in the testing version with R-4.4
>
> H
>
>
>
>
>
>
>
>

Nick Freymueller

unread,
Jun 3, 2024, 12:40:20 PM6/3/24
to R-inla discussion group
Thanks for your recommendations, Håvard. 

I've gotten some of the way through what a DCRW model would look like given the vignette you sent, the GMRF book, and the online gitbook. However, there are a few points for what I'd specify for the inla.rgeneric.define model that I'm still a bit confused on. I'm not sure how to specify the bivariate nature of mu or how to specify the auto-regressive parts of this. Additionally, I'm not sure exactly what I'd specify for the precision matrix and normalizing constants. I get where the non-zero elements in the precision matrix are supposed to be given the structure of the model, but I'm lost as to how exactly to populate these non-zero elements. 

I've attached what I have been working on so far. Any and all help/suggestions/recommendations would be much appreciated. I'd eventually like to get to a place where I can specify the data similar to that shown here with specified error terms where available (https://ianjonsen.github.io/aniMotum/articles/Overview.html#light-level-geolocation-data) and run multiple individuals that are indexed hierarchically.

Kind regards,
Nick

DCRW_INLA_Freymueller.R

Helpdesk (Haavard Rue)

unread,
Jun 5, 2024, 5:43:16 AM6/5/24
to Nick Freymueller, R-inla discussion group

You have 4 hyperparameter, the correlation, two variances and the angle.

given these, then eq~2 gives the dynamics for the location. note the implicite
singularity as 'd' is two locations, but the current location at time t, is the
previous location at time t-1.

this dynamics gives a block diagonal precision matrix which you have to add in
rgeneric.

I would suggest to start with a simpler example, like a simple RW1 and code
that, then move to this dynamics, when Sigma = diagonal matrix, and then when
its general.

Nick Freymueller

unread,
Jun 6, 2024, 9:47:20 PM6/6/24
to R-inla discussion group
Okay. I get that it's parameterizing the precision matrix with a band format, but I'm at a loss as to how exactly to do that.

For the precision matrix, I get that the diagonals and positions off the diagonals up to distance 2 will be non-zero, but it's not clear to me exactly what I put there. Following the ar1 example in the vignette, would substituting rho with gamma*T be accurate (or at least a step in the right direction; see attached photo)? I'm not sure how I'd add the d_(t-1) part. Is there a way to easily insert the observation equation simultaneously (eq. 6 in the Jonsen et al. paper)? 

Apologies if these are very basic questions for you. It's admittedly been several years since I've done anything related to matrix algebra.

Kind regards,
Nick

PossiblePrecisionMatrixDCRW.png
Reply all
Reply to author
Forward
0 new messages