[R-sig-ME] Spatial correlation in glmmTMB
bbo|ker @end|ng |rom gm@||@com
Thu Jul 18 16:07:32 CEST 2019
For glmmTMB, if your locations aren't otherwise grouped (e.g. into
distinct sites), then you should use factor(rep(1,62)). As Alan Zuur
suggests, 62 might be a fairly small sample for estimating spatial
autocorrelation. If you give us more information about your model (e.g.
post the results of summary(), it might help us diagnose and/or fix your
convergence problems ...
The mgcv package will also let you fit negative binomial/spatial
models (with a Matérn structure, see ?smooth.construct.gp.smooth.spec;
for the random effect, see ?smooth.construct.re.smooth.spec).
On 2019-07-18 6:33 a.m., Highland Statistics Ltd wrote:
> I suggest trying INLA.
> I hope that you have more than 62 observations in total?
> Kind regards,
> I would like to ask for help on how to account for spatial correlation in
> glmmTMB package.
> According to the help page (
> I need to create a numFactor object grouping coordinates and a dummy
> grouping factor.
> mydata$pos <- numFactor(mydata$easting, mydata$northing)## spatial
> mydata$group <- factor(rep(1, nrow(mydata)))## dummy factor
> Regarding to the dummy variable, I have 62 locations in my dataframe. The
> dummy variable should be 1 for all observations, or go from 1 to 62?
> (Actually I have tried both possibilities. First one give me convergence
> problems, second one cracks my R).
> I have been trying to run the following negative binomial mixed model:
> m1 = glmmTMB(density ~ wave_exposure + (1|location) exp(pos + 0|group),
> data= mydata, family= nbinom1, ziformula= ~0) ##
> I also tried different covariance structures (gau and mat), but no success
> so far.
> Any ideas or suggestions here?
> Thank you in advance!
More information about the R-sig-mixed-models