Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check poisson-link delta models #186

Closed
seananderson opened this issue Mar 2, 2023 · 1 comment
Closed

Check poisson-link delta models #186

seananderson opened this issue Mar 2, 2023 · 1 comment

Comments

@seananderson
Copy link
Member

Check against VAST. Check for anything that could still be causing under/overflows. Models frequently fall into optimization problems and are slower than I'd expect.

@seananderson
Copy link
Member Author

These are now robust and match VAST exactly (local tests for future reference). We should probably add a vignette because the connection between the linear predictors and inverse-linked predictors is unique. At the very least, these need more explanation in the model description vignette.

library(sdmTMB)
fit <- sdmTMB(
  density ~ 1,
  data = pcod, 
  mesh = make_mesh(pcod, c("X", "Y"), cutoff = 10),
  family = delta_poisson_link_gamma(), 
)
summary(fit)
#> Spatial model fit by ML ['sdmTMB']
#> Formula: density ~ 1
#> Mesh: make_mesh(pcod, c("X", "Y"), cutoff = 10) (isotropic covariance)
#> Data: pcod
#> Family: delta_poisson_link_gamma(link1 = 'log', link2 = 'log')
#> 
#> Delta/hurdle model 1: -----------------------------------
#> Family: binomial(link = 'log') 
#>             coef.est coef.se
#> (Intercept)     -0.6    0.29
#> 
#> Matérn range: 32.44
#> Spatial SD: 1.48
#> 
#> Delta/hurdle model 2: -----------------------------------
#> Family: Gamma(link = 'log') 
#>             coef.est coef.se
#> (Intercept)     3.69    0.11
#> 
#> Dispersion parameter: 0.75
#> Matérn range: 8.72
#> Spatial SD: 1.58
#> 
#> ML criterion at convergence: 6381.834
#> 
#> See ?tidy.sdmTMB to extract these values as a data frame.

fit <- sdmTMB(
  density ~ 1,
  data = pcod, 
  mesh = make_mesh(pcod, c("X", "Y"), cutoff = 10),
  family = delta_poisson_link_lognormal(), 
)
summary(fit)
#> Spatial model fit by ML ['sdmTMB']
#> Formula: density ~ 1
#> Mesh: make_mesh(pcod, c("X", "Y"), cutoff = 10) (isotropic covariance)
#> Data: pcod
#> Family: delta_poisson_link_lognormal(link1 = 'log', link2 = 'log')
#> 
#> Delta/hurdle model 1: -----------------------------------
#> Family: binomial(link = 'log') 
#>             coef.est coef.se
#> (Intercept)    -0.59     0.3
#> 
#> Matérn range: 33.11
#> Spatial SD: 1.51
#> 
#> Delta/hurdle model 2: -----------------------------------
#> Family: lognormal(link = 'log') 
#>             coef.est coef.se
#> (Intercept)     3.74    0.12
#> 
#> Dispersion parameter: 1.33
#> Matérn range: 31.56
#> Spatial SD: 0.47
#> 
#> ML criterion at convergence: 6265.205
#> 
#> See ?tidy.sdmTMB to extract these values as a data frame.

Created on 2023-08-15 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant