[R-sig-ME] Spatial correlation in glmmTMB
Highland Statistics Ltd
h|gh@t@t @end|ng |rom h|gh@t@t@com
Thu Jul 18 12:33:13 CEST 2019
I suggest trying INLA.
http://www.r-inla.org/
I hope that you have more than 62 observations in total?
Kind regards,
Alain
---------------------------------
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]]
***************************************************
--
Dr. Alain F. Zuur
Highland Statistics Ltd.
9 St Clair Wynd
AB41 6DZ Newburgh, UK
Email: highstat using highstat.com
URL: www.highstat.com
And:
NIOZ Royal Netherlands Institute for Sea Research,
Department of Coastal Systems, and Utrecht University,
P.O. Box 59, 1790 AB Den Burg,
Texel, The Netherlands
Author of:
1. Beginner's Guide to Spatial, Temporal and Spatial-Temporal Ecological Data Analysis with R-INLA. (2017).
2. Beginner's Guide to Zero-Inflated Models with R (2016).
3. Beginner's Guide to Data Exploration and Visualisation with R (2015).
4. Beginner's Guide to GAMM with R (2014).
5. Beginner's Guide to GLM and GLMM with R (2013).
6. Beginner's Guide to GAM with R (2012).
7. Zero Inflated Models and GLMM with R (2012).
8. A Beginner's Guide to R (2009).
9. Mixed effects models and extensions in ecology with R (2009).
10. Analysing Ecological Data (2007).
More information about the R-sig-mixed-models
mailing list