Open xiacong2019 opened 2 weeks ago
And I also want to ask if there is any other means to fit a spatial glmm with overdispersion in sdmTMB?
Can you provide a reproducible example? Perhaps upload the data somewhere or save a small version with dput() and paste it here or simulate some data?
Regarding other possible approaches: you could use a binomial family with a random intercept level for each row of data to account for additional dispersion. Make a column that is a factor with levels from 1 to the number of rows of data and add that column as a random intercept.
Yeah, sure! I share the data with you via Google Drive. Please download from this link: https://drive.google.com/drive/folders/1lP9yxlpa8cyiWxz0HPHTTuBR7Tp1GqEe?usp=drive_link And thanks for your suggestion about using random intercept to account for dispersion! I will also have a try!
Hi, when I tried to run this code,
data <- readRDS("./sample.rds") weights <- data$weights mesh <- make_mesh(data, c("x", "y"), cutoff = 10000) model_new <- sdmTMB( response ~ predictor + (1 | country ), mesh = mesh, data = data, family = Beta(), spatial = "on", weights = weights)
It reported this error: Error in stats::nlminb(start = tmb_obj$par, objective = tmb_obj$fn, gradient = tmb_obj$gr, : NA/NaN gradient evaluation
I have reinstalled the Matrix, TMB, and sdmTMB packages from source but no use. I would appreciate it if you could help me for fixing this error.