Spatial modelling of both estimate and dispersion? #355
-
I've come across ContextI plan to model spatial activity of carnivores based on latrine use (counts GoalIn addition to estimating Questions
What I triedI supposed that a simple intercept model with a spatial random fields would capture the spatial variations of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Yes
This is possible. The fastest way to compute this is with draws from the joint parameter covariance matrix (actually the inverse: the precision matrix). Functionally, this is with the On the other hand, if you what you mean by this:
is that you want covariates that model the degree of observation error, that's not currently in the main branch. You're right that there's a branch with that functionality. Adding it to model fitting is simple, but I never finished making sure things like the print function worked with the output. If there's interest, I could prioritize bringing that over to the main branch (or at least updating that branch with the main branch). I have never tried putting a GMRF into the dispersion linear predictor. Theoretically that should be possible. It would be a lot more book keeping though because of all the added parameters. I guess my first question would be whether there's strong evidence that you need an explicit dispersion formula let alone a latent random field in the dispersion formula. Counts are often modelled with a negative binomial (usually NB2) or a Poisson with additional lognormal dispersion (functionally, an observation level random intercept). An NB2 is quite flexible and given the zeros and l large counts that can be allowed with a sufficiently large dispersion, I imagine modelling covariates on that dispersion would be challenging—especially with "only" ~100 locations. To summarize, just in case this isn't clear:
|
Beta Was this translation helpful? Give feedback.
-
I think you get this from looking at the code, but just be clear (because it's a frequent point of confusion), predictions (i.e., estimates or expected values) will not be distributed like the original 'data' (where data usually means observations), but simulated values (i.e. predictions + observation error) should be. Predictions should be distributed similarly to some underlying true mean if you're simulating data though (as you are). There are some subtleties though like needing a single draw from the random effects as if they were observed vs. the "empirical Bayes" estimates that are typically used in prediction (what is done in Looking at that example (with some very pretty visuals!), I just want to be sure you're not conflating the standard error on the prediction (SD of the samples with While the observation variance is constant with the mean in a GLM with an identity link and Gaussian error, it grows with the mean according to the given mean-variance relationship for other families. E.g., with a log link and the NB2, the variance grows quadratically with the mean. Usually, this is sufficient to represent the data. Checking this spatially would be tricky. One route would be to calculate randomized quantile residuals and look at their variance after binning them by some appropriately coarse grid. Just looking at the raw residuals or looking at the data wouldn't be enough because you have to account for the mean. |
Beta Was this translation helpful? Give feedback.
Yes
This is possible. The fastest way to compute this is with draws from the joint parameter covariance matrix (actually the inverse: the precision matrix). Functionally, this is with the
nsim
argument in?predict.sdmTMB
. There's currently an example in the package readme. Theoretically you can get this frompredict.sdmTMB()
withse_fit = TRUE
, but in practice this can be very slow when including the random field values.On the other hand, …