[R-sig-ME] spatial covariance structure in glmmTMB

Mollie Brooks mollieebrooks at gmail.com
Wed Nov 8 11:49:20 CET 2017


Hi Alice,

Kasper recently added a spatial example to vignette("covstruct"). Hopefully, that will solve your problem. To get the vignette, you’ll have to install from github following the instructions here

https://github.com/glmmTMB/glmmTMB <https://github.com/glmmTMB/glmmTMB>

cheers,
Mollie 

> On 11Oct 2017, at 20:37, Alice Domalik <adomalik at sfu.ca> wrote:
> 
> In the end, I was able to run the following model:
> 
> m1<-glmmTMB(count~waterdepth + temperature + chl.conc + (1|individual) + gau(coord + 0| group), family=list(family="truncated_nbinom1", link="log"), data=mydata)
> 
> Where 'coord' are the spatial coordinates (UTM) represented as a factor, and 'group' is a single level.
> 
> group<-factor(rep(1,n))
> 
> However, I get the error:
> 
> Warning message:
> In glmmTMB(count ~ waterdepth + temperature +  :
>   Model convergence problem; non-positive-definite Hessian matrix. See vignette('troubleshooting')
> 
> I didn't have this error when I initially ran my model without a covariance structure.
> Any advice on how I should move forward?
> 
> Thanks!!! Alice
> 
> From: "Ben Bolker" <bbolker at gmail.com>
> To: "Alice Domalik" <adomalik at sfu.ca>
> Cc: "Mollie Brooks" <mollieebrooks at gmail.com>, r-sig-mixed-models at r-project.org, "Kasper Kristensen" <kaskr at dtu.dk>
> Sent: Monday, October 9, 2017 3:05:19 PM
> Subject: Re: [R-sig-ME] spatial covariance structure in glmmTMB
> 
> Did you see the part of the document (sub)titled "Adding coordinate
> information" ?  (The example given in the vignette only does a 1-D
> example, but it gives instructions that should in principle work for
> 2-D ...)
> 
> On Mon, Oct 9, 2017 at 12:05 PM, Alice Domalik <adomalik at sfu.ca> wrote:
> > I did look at the vignette, and the notation wasn't clear to me.
> > If, for example, I wanted to add a spatial gaussian, would I write my model as:
> >
> > m1<-glmmTMB(count~gau(coordinates) + waterdepth + temperature + chl.conc + (1|individual), family=list(family="truncated_nbinom1", link="log"), data=mydata) ?
> >
> > It also isn't clear to me if spatial coordinates need to be in a particular format.
> >
> >
> > From: "Mollie Brooks" <mollieebrooks at gmail.com>
> > To: "Alice Domalik" <adomalik at sfu.ca>
> > Cc: r-sig-mixed-models at r-project.org, "Kasper Kristensen" <kaskr at dtu.dk>
> > Sent: Monday, October 9, 2017 6:42:48 AM
> > Subject: Re: [R-sig-ME] spatial covariance structure in glmmTMB
> >
> > Hi Alice,
> > Have you looked at the vignette on covariance structures? There's a section on spatial correlations.
> >
> > [ https://cran.r-project.org/web/packages/glmmTMB/vignettes/covstruct.html | https://cran.r-project.org/web/packages/glmmTMB/vignettes/covstruct.html ]
> >
> > cheers,
> > Mollie
> >
> > On Mon, Oct 9, 2017 at 3:22 PM, Alice Domalik < [ mailto:adomalik at sfu.ca | adomalik at sfu.ca ] > wrote:
> >
> >
> > Dear list,
> >
> > I am fitting mixed effects models using the package glmmTMB to investigate habitat use.
> > My current model has the form m1<-glmmTMB(count~waterdepth + temperature + chl.conc + (1|individual), family=list(family="truncated_nbinom1", link="log"), data=mydata)
> > I would like to add a spatial covariance structure based on geographic coordinates (mydata$x and mydata$y).
> > However, I do not know how to modify my model formula to include a spatial covariance structure. Does anyone have example code to show how this is done?
> >
> > Any help would be much appreciated!
> >
> >
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > [ mailto:R-sig-mixed-models at r-project.org | R-sig-mixed-models at r-project.org ] mailing list
> > [ https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models | https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models ]
> >
> >
> >
> >
> >
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list