# [R-sig-Geo] stepwise algorithm for GWR

Marco Helbich marco.helbich at gmx.at
Wed May 13 17:54:23 CEST 2009

```Dear Danlin and Joshua,

first of all thank you for your replies! Here some further notes for clarification: I have already estimated a global ols model (based on stepwise model selection) and because of some spatial effects I recalculated it as simultaneous autoregressive model. After that I tested this model for non-stationarity... and voilà there is one. Now I want to compare this one with the one offering the lowest aic.

All the best
Marco

-------- Original-Nachricht --------
> Datum: Wed, 13 May 2009 10:04:22 -0400
> Von: Danlin Yu <yud at mail.montclair.edu>
> An: Marco Helbich <marco.helbich at gmx.at>
> CC: r-sig-geo at stat.math.ethz.ch
> Betreff: Re: [R-sig-Geo] stepwise algorithm for GWR

> Dear Marco:
>
> Before doing so, you'll have to ask yourself that whether all those AICs
> are comparable among different model specifications. As a matter of
> fact, I believe it might be more plausible if you stepwise it first as a
> global model (OLS, after all, global models are an "averaged" view of
> the local models), and then work with the selected specification.
>
> Hope this helps,
>
> Danlin
>
> Marco Helbich ??:
> > Dear list!
> >
> > I am doing some geographically weighted regression and I am intersted in
> the most suitable model (the one with the lowest AIC). Because there is no
> stepwise algorithm, I am trying to write a "brute force" function, which
> uses all possible variable combination, applies the gwr and returns the AIC
> value with the used variable combination in a dataframe.
> > For instance the model below: gwr1: crime ~ income, gwr2: crime ~
> housing, gwr3: crime ~ var1, gwr4: crime ~ income + housing, ...
> >
> > I hope my problem is clear and appreciate every hint! Thank you!
> >
> > All the best
> > Marco
> >
> > library(spgwr)
> > data(columbus)
> > columbus[,"var1"] <- rnorm(length(columbus[,1]))
> >
> > col.bw <- gwr.sel(crime ~ income + housing + var1, data=columbus,
> >   coords=cbind(columbus\$x, columbus\$y))
> > col.gauss <- gwr(crime ~ income + housing + var1, data=columbus,
> >   coords=cbind(columbus\$x, columbus\$y), bandwidth=col.bw,
> hatmatrix=TRUE)
> > col.gauss
> > --
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> --
> ___________________________________________
> Danlin Yu, Ph.D.
> Assistant Professor of GIS and Urban Geography
> Department of Earth & Environmental Studies
> Montclair State University
> Montclair, NJ, 07043
> Tel: 973-655-4313
> Fax: 973-655-4072
> email: yud at mail.montclair.edu
> webpage: csam.montclair.edu/~yu

--

```