[R-sig-Geo] GWR with some parameters held constant

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 7 18:56:41 CET 2013


On Thu, 7 Mar 2013, Corey Sparks wrote:

> Dear List,
> This is more of a conceptual question. Let's say I have a regression model
> with a gaussian outcome and two continuous predictors and the model shows
> evidence of nonstationarity in one of the beta parameters for the
> predictors, but not the other. In this case I may be interested in using GWR
> to model the nonstationarity in the first parameter, while holding the
> second constant at its OLS estimate. I've used GWR in the past with great
> effect, but I think this is an interesting scenario.  I would really like to
> hear what everyone thinks about this, and if it would be possible to hack
> the gwr() code to make this model possible.
>
> it would be like this:
> library(spgwr)
> data(columbus)
>
> col.lm <- lm(crime ~ income + housing, data=columbus)
> summary(col.lm)
> #gives beta (housing) = -0.27
>
> #Let's say that this is assumed stationary, I basically want to keep this
> constant in the model, would a quick and dirty way to do this just be:
> #this doesn't work of course
>
> col.bw <- gwr.sel(crime ~ income + -(.27*housing), data=columbus,
>                  coords=cbind(columbus$x, columbus$y))
> col.gauss <- gwr(crime ~ income + -(.27*housing), data=columbus,
>                 coords=cbind(columbus$x, columbus$y), bandwidth=col.bw)

Either of:

col.lm <- lm(crime ~ housing, data=columbus)
columbus$pred_crime <- predict(col.lm)
col.bw <- gwr.sel(pred_crime ~ income, data=columbus,
   coords=cbind(columbus$x, columbus$y))
col.gauss <- gwr(pred_crime ~ income, data=columbus,
   coords=cbind(columbus$x, columbus$y), bandwidth=col.bw)

col.lm <- lm(crime ~ income + housing, data=columbus)
columbus$h27 <- coef(col.lm)[3]*columbus$housing
col.bw <- gwr.sel(crime ~ income + offset(h27), data=columbus,
   coords=cbind(columbus$x, columbus$y))
col.gauss <- gwr(crime ~ income + offset(h27), data=columbus,
   coords=cbind(columbus$x, columbus$y), bandwidth=col.bw)

do something, the first one includes an intercept twice, the second 
relies on the offset term being handled correctly, which unfortunately it 
isn't. Given the doubts about GWR in Paez et al. 2011, I haven't thought 
it worth the trouble to use more time on the package. I don't think the 
gwrr package offers this variant.

Roger

>
> #And I would want to get the GWR estimates for the location specific effect
> of income, while holding the effect of housing constant.
>
> Thanks all for any ideas
> Corey Sparks
>
>
>
>
>
> -----
> Corey Sparks
> Assistant professor
> Department of Demography
> The University of Texas at San Antonio
> 501 West Cesar E Chavez Blvd
> San Antonio TX 78207
> Corey.sparks 'at' utsa.edu
> 210 458 3166 <tel:210%20458%203166>
> Latitude: 29.423614  /  Longitude: -98.504282
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/GWR-with-some-parameters-held-constant-tp7583002.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list