gwr                  package:spgwr                  R Documentation

_G_e_o_g_r_a_p_h_i_c_a_l_l_y _w_e_i_g_h_t_e_d _r_e_g_r_e_s_s_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     The function implements the basic geographically weighted
     regression approach to exploring spatial non-stationarity for
     given global bandwidth and chosen weighting scheme.

_U_s_a_g_e:

     gwr(formula, data=list(), coords, bandwidth, gweight=gwr.gauss, 
             adapt=NULL, hatmatrix = FALSE, fit.points, 
             longlat=FALSE)
     print.gwr(x, ...)

_A_r_g_u_m_e_n_t_s:

 formula: regression model formula as in 'lm'

    data: model data frame, or SpatialPointsDataFrame or
          SpatialPolygonsDataFrame as defined in package 'sp'

  coords: matrix of coordinates of points representing the spatial
          positions of the observations; may be omitted if the object
          passed through the data argument is from package 'sp'

bandwidth: bandwidth used in the weighting function, possibly
          calculated by 'gwr.sel'

 gweight: geographical weighting function, at present only
          'gwr.gauss()' or 'gwr.bisquare()'

   adapt: either NULL (default) or a proportion between 0 and 1 of
          observations to include in weighting scheme (k-nearest
          neighbours)

hatmatrix: if TRUE, return the hatmatrix as a component of the result

fit.points: an object containing the coordinates of fit points; often
          an object from package 'sp'; if missing, the coordinates
          given through the data argument object, or the coords
          argument are used

 longlat: if TRUE, use distances on an ellipse with WGS84 parameters

       x: an object of class "gwr" returned by the 'gwr' function

     ...: arguments to be passed to other functions

_D_e_t_a_i_l_s:

     The function applies the weighting function in turn to each of the
      observations, or fit points if given, calculating a weighted
     regression  for each point. The results may be explored to see if
     coefficient values vary over space.

_V_a_l_u_e:

     SDF: a SpatialPointsDataFrame (may be gridded) or
          SpatialPolygonsDataFrame object (see package "sp") with
          fit.points, weights, GWR coefficient estimates, R-squared,
          and coefficient standard errors in its "data" slot.

    lhat: Leung et al. L matrix

      lm: Ordinary least squares global regression on the same model
          formula.

bandwidth: the bandwidth used.

this.call: the function call used.

_A_u_t_h_o_r(_s):

     Roger Bivand Roger.Bivand@nhh.no

_R_e_f_e_r_e_n_c_e_s:

     Fotheringham, A.S., Brunsdon, C., and Charlton, M.E., 2002,
     Geographically Weighted Regression, Chichester: Wiley; <URL:
     http://www.nuim.ie/ncg/GWR/index.htm>

_S_e_e _A_l_s_o:

     'gwr.sel', 'gwr.gauss', 'gwr.bisquare'

_E_x_a_m_p_l_e_s:

     data(columbus)
     col.lm <- lm(crime ~ income + housing, data=columbus)
     summary(col.lm)
     col.bw <- gwr.sel(crime ~ income + housing, data=columbus,
       coords=cbind(columbus$x, columbus$y))
     col.gauss <- gwr(crime ~ income + housing, data=columbus,
       coords=cbind(columbus$x, columbus$y), bandwidth=col.bw, hatmatrix=TRUE)
     col.gauss
     col.d <- gwr.sel(crime ~ income + housing, data=columbus,
       coords=cbind(columbus$x, columbus$y), gweight=gwr.bisquare)
     col.bisq <- gwr(crime ~ income + housing, data=columbus,
       coords=cbind(columbus$x, columbus$y), bandwidth=col.d, 
       gweight=gwr.bisquare, hatmatrix=TRUE)
     col.bisq
     data(georgia)
     g.adapt.gauss <- gwr.sel(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF, adapt=TRUE)
     res.adpt <- gwr(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF, adapt=g.adapt.gauss)
     res.adpt
     pairs(as(res.adpt$SDF, "data.frame")[,c(17,18, 1:9)], pch=".")
     brks <- c(-0.25, 0, 0.01, 0.025, 0.075)
     cols <- grey(5:2/6)
     plot(res.adpt$SDF, col=cols[findInterval(res.adpt$SDF$PctBlack, brks, all.inside=TRUE)])
     g.bw.gauss <- gwr.sel(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF)
     res.bw <- gwr(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF, bandwidth=g.bw.gauss)
     res.bw
     pairs(as(res.bw$SDF, "data.frame")[,c(17,18, 1:9)], pch=".")
     plot(res.bw$SDF, col=cols[findInterval(res.bw$SDF$PctBlack, brks, all.inside=TRUE)])
     g.bw.gauss <- gwr.sel(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF, longlat=TRUE)
     if (require(spgpc)) {
       gSR <- as(gSRDF, "SpatialPolygons")
       length(getSpPpolygonsSlot(gSR))
       gSRouter <- unionSpatialPolygons(gSR, IDs=rep("Georgia", 159))
       gGrid <- sample.Polygons(getSpPpolygonsSlot(gSRouter)[[1]], 5000,
         type="regular")
       gridded(gGrid) <- TRUE
       summary(gGrid)
       res.bw <- gwr(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + PctBlack, data=gSRDF, bandwidth=g.bw.gauss, fit.points=gGrid, longlat=TRUE)
       res.bw
       spplot(res.bw$SDF, "PctBlack")
     }

