You should post on r-sig-geo, the list devoted to spatial data analysis, rather than here.
Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Jun 4, 2020 at 12:17 PM Lena Fehlhaber <sturmiec...@gmail.com> wrote: > I did a regression analysis with categorical data with a glm model > approach, which worked fine. I have longitude and latitude coordinates for > each observation and I want to add their geographic spillover effect to the > model. > > My sample data is structured: > > Index DV IVI IVII IVIII IVIV Long Lat > 1 0 2 1 3 -12 -17.8 12 > 2 0 1 1 6 112 11 -122 > 3 1 3 6 1 91 57 53 > > with regression eq. DV ~ IVI + IVII + IVIII + IVIV > > That mentioned, I assume that the nearer regions are, the more it may > influence my dependant variable. I found several approaches for spatial > regression models, but not for categorical data. I tried to use existing > libraries and functions, such as spdep's lagsarlm, glmmfields, spatialreg, > gstat, geoRglm and many more (I used this list as a reference: > https://cran.r-project.org/web/views/Spatial.html ). For numeric values, I > am able to do spatial regression, but for categorical values, I struggle. > The data structure is the following: > > library(dplyr) > data <- data %>% > mutate( > DV = as.factor(DV), > IVI = as.factor(IVI), > IVII = as.factor(IVII), > IVIII = as.factor(IVIII), > IVIV = as.numeric(IVIV), > longitude = as.numeric(longitude), > latitude = as.numeric(latitude) > ) > > My dependant variable (0|1) as well as my independant variables are > categorical and it would be no use to transform them, of course. I want to > have an other glm model in the end, but with spatial spillover effects > included. The libraries I tested so far can't handle categorical data. Any > leads/ideas would be greatly appreciated. > > Thanks a lot. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.