Skip to content

Getting delta_st values from a random walk random field model #180

Answered by seananderson
seananderson asked this question in Q&A
Discussion options

You must be logged in to vote

You'd have to difference each year's values from the previous ones to get the MVN draws. Using predictions on a grid:

library(ggplot2)
library(dplyr)
library(sdmTMB)
theme_set(theme_light())

mesh <- make_mesh(pcod, c("X", "Y"), cutoff = 20)
fit <- sdmTMB(
  density ~ s(depth),
  data = pcod, mesh = mesh,
  spatiotemporal = "rw", spatial = "off",
  time = "year",
  family = tweedie(link = "log")
)
#> Detected irregular time spacing with an AR(1) or random walk process.
#> Consider filling in the missing time slices with `extra_time`.
#> `extra_time = c(2006, 2008, 2010, 2012, 2014, 2016)`

grid <- replicate_df(qcs_grid, "year", unique(pcod$year))
predictions <- predict(fit, newdata = grid)…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by seananderson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant