Skip to content

Is there a way to get confidence intervals for time-varying effects? #205

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

You must be logged in to vote

Yes, sorry, those aren't in tidy() yet. Random intercepts are, but not time-varying random effects. I posted an issue here: #206

Here's an example of grabbing them yourself. The format of b_rw_t may vary a bit depending on your model configuration. There's also the "ar1" and "rw0" time_varying_type, which start with a mean of zero. In that case you'd likely include main effects and then the time-varying effect would represent deviations starting from the main effect.

library(sdmTMB)
fit <- sdmTMB(
  density ~ 0, 
  time_varying = ~ 1 + depth_scaled, 
  time_varying_type = "rw",
  data = pcod_2011, 
  time = "year", 
  spatial = "off", 
  spatiotemporal = "off",
  family = tweedie()
)

est <-

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sschooler
Comment options

Answer selected by sschooler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants