[R-sig-ME] Spatial correlation in glmmTMB
André Pardal
@ndre@p@rd@|@@ouz@ @end|ng |rom gm@||@com
Wed Jul 17 19:15:39 CEST 2019
Hello,
I would like to ask for help on how to account for spatial correlation in
glmmTMB package.
According to the help page (
https://cran.r-project.org/web/packages/glmmTMB/vignettes/covstruct.html),
I need to create a numFactor object grouping coordinates and a dummy
grouping factor.
mydata$pos <- numFactor(mydata$easting, mydata$northing)## spatial
coordinates
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!
Andre.
--
Visiting PhD student
School of Ocean Sciences
Bangor University
Menai Bridge, Anglesey, UK
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list