sdmTMB icon indicating copy to clipboard operation
sdmTMB copied to clipboard

Fix coef() to work with delta models

Open ericward-noaa opened this issue 8 months ago • 0 comments

I think the solution here is just modifying coef()to take model as an argument

library(dplyr)
library(tidyr)
library(sdmTMB)

set.seed(1)

# Build a mesh to implement the SPDE approach:
mesh <- make_mesh(pcod_2011, c("X", "Y"), cutoff = 20)

# Quick mesh plot:
plot(mesh)


# Fit a Tweedie spatial random field GLMM with a smoother for depth:
fit <- sdmTMB(
  density ~ s(depth),
  data = pcod_2011, mesh = mesh,
  family = delta_gamma()
)

coef(fit)
#> (Intercept) 
#>  -0.7903428

Created on 2024-06-14 with reprex v2.1.0

ericward-noaa avatar Jun 14 '24 23:06 ericward-noaa