6

I am modelling fish depth in a river based on acoustic tag detections (meaning the data are not exactly a perfectly spaced continuous time series). I predict that depth will differ based on spatial location in the river because different areas have different depths available, time of day because depth responds to light, day of year for the same reason, and differ among individuals. The basic model is then

depth ~ s(lon, lat) + s(hour) + s(yday) + s(ID, bs="re")

There are a few million detections so the model is a bam, so

bam(depth ~ s(lon, lat) + s(hour) + s(yday) + s(ID, bs="re")

The depth for each individual should be autocorrelated to the previous recording (of course this depends how recently it was last registered, but I don't know quite how to account for the discrete spacing in time).

I understand the rho parameter is used in bam as a sort of corAR1 function, which I guess can account for the autocorrelation. I also considered including lag(depth, by=ID) as a predictor and it performed quite well but I wasn't sure of the validity of this approach.

I followed several breadcrumbs to find that rho can be estimated from a model without a correlation structure rho<-acf(resid(m1), plot=FALSE)$acf2-

For each individual I added an ARSTART variable to call AR.start = df$ARSTART to account for time series differing among individuals- so my model is

m2<-bam(depth~s(lon, lat)+s(yday)+s(hour, bs="cc")+s(fID, bs="re"), AR.start=df$ARSTART, discrete=T, rho=rho, data=df) 

Everything works swimmingly, the model with the autocorrelation structure fits better (way better) according to AIC, but the posterior estimates of effects are wildly inaccurate (or badly scaled). The spatial effects according to the lon, lat smoother become extreme (and homogenous) compared to the model without the structure, in which the spatial smoother seems to capture the spatial variance quite effectively, showing that they are predicted to be deeper in the deeper areas and shallower in the shallower areas.

Figure 1. posterior spatial estimates of depth use for model without autocorrelation structure, but obviously not accounting for reality that depth and lag depth will be correlated (nested by ID).. note z values make sense adjusting posterior estimates within range of raw values (most detections are 0-4 m deep)

Figure 2. posterior spatial estimates of depth use when model includes rho parameter to account for temporal autocorrelation.. note the huge scale of z, which is well beyond what we measured and not interpretable at all

I can provide example code if desired, but the question is, essentially, does it make any sense that the autocorrelation structure would change the values of the posterior estimates so dramatically compared to the model, and is the temporal autocorrelation structure absorbing all the variance that is otherwise associated with the spatial effects (which appear to be negated in the model with the autocorrelation structure)?

Some ideas- I cannot figure out what is best:

  1. blindly follow the AIC without really understanding why the posterior estimates are so odd (huge) or why the spatial effects disappear despite clearly being important based on biological knowledge of the system
  2. report that we fit an autocorrelation structure to the data, it fit well, but didn't change the shape of the relationships and therefore we present results of the model without the structure
  3. model without the autocorrelation structure but with an s(lagDepth) variable as a fixed effect
  4. model change in depth rather than depth, which seems to eliminate some of the autocorrelation.

All help greatly appreciated- thanks so much

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.