Hi Dr. Bivand, Thank you for the reply. That makes sense. I was hoping there'd be a way to set an offset like in glm function even though it's Gaussian dependent. But, of course as you've brought up I'm running a Poisson model here. I ended up using CARBayes package for the purpose eventually. Thank you very much again for the prompt reply and the suggestions.
Have a good day! Best, Kaushi On Mon, Nov 23, 2020 at 5:30 AM Roger Bivand <[email protected]> wrote: > On Sun, 22 Nov 2020, Kaushi Kanankege via R-sig-Geo wrote: > > > Dear members of the R-sig-Geo, > > Is there a way to set an 'offset' when running a Poisson regression using > > the spautolm function offered in the Spatialreg package? > > The spautolm function in spatialreg only supports Gaussian dependent > variables. Perhaps the family= argument misled you to think otherwise, it > takes the values c("SAR", "CAR, "SMA"), not distribution names. It was > written as its help page describes to support the spatial regression > chapter in Waller & Gotway (2004). > > For Poisson CAR, see the hglm package, CARBayes, INLA, R2BayesX and many > others (also mgcv gam() with an "mrf" smooth). > > Hope this clarifies, > > Roger > > > > > I have count data of disease at administrative levels and I am trying to > > use CAR model to account for the spatial dependence between the admin > > levels. I would appreciate suggestions of setting the offset (the log of > a > > total number of animals in each admin level) or ways to work around this > > using spautolm function. > > > > Thank you very much. > > > > Kaushi > > > > Further details below: > > > > # Unit of analysis is ‘Districts’ i.e. administrative divisions > > > > # Count_disease = number of animals with the disease > > > > # Var 1 and 2 are selected independent variables > > > > # We have the count of animals per each district and I am trying to set > > this as the ‘offset’ > > > > > > > > # The same model was run as a zero inflated Poisson regression using the > > following > > > > offset = log(Ani_pop) > > > > ZIP.D <- zeroinfl(formula_Red, data = Data, dist = "poisson", EM = TRUE, > > link = "logit", offset = offset) > > > > > > > > #Formula > > > > formula <- Count_disease ~ Variable 1 + Variable2 > > > > # CAR fit > > > > CAR.D <- spautolm(formula_Red, data= Thai.D.shp2, listw=ThaiD.listw, > > family="CAR",zero.policy = TRUE, method="eigen") > > > > > > > > How to set the offset? > > > > Or suggestions to work around this? > > > > > > > > > > -- > Roger Bivand > Department of Economics, Norwegian School of Economics, > Helleveien 30, N-5045 Bergen, Norway. > voice: +47 55 95 93 55; e-mail: [email protected] > https://orcid.org/0000-0003-2392-6140 > https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en -- Kaushi Kanankege (DVM, MS, PhD) Postdoctoral Associate Center for Animal Health and Food Safety University of Minnesota Twin Cities [email protected],;+1 848-480-9250; linkedin.com/in/kaushi-kanankege <https://www.linkedin.com/in/kaushi-kanankege> [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
