GWPR: Geographically Weighted Panel Regression Model

View source: R/GWPR.R

GWPRR Documentation

Geographically Weighted Panel Regression Model

Description

This function implements GWPR

Usage

GWPR(formula, data, index, SDF, bw = NULL, adaptive = FALSE, p = 2,
            effect = "individual", model = c("pooling", "within", "random"),
            random.method = "swar", kernel = "bisquare", longlat = FALSE)

Arguments

formula

The regression formula: : Y ~ X1 + ... + Xk

data

A data.frame for the Panel data

index

A vector of the two indexes: (c("ID", "Time"))

SDF

Spatial*DataFrame on which is based the data, with the "ID" in the index

bw

The optimal bandwidth, either adaptive or fixed distance

adaptive

If TRUE, adaptive distance bandwidth is used, otherwise, fixed distance bandwidth.

p

The power of the Minkowski distance, default is 2, i.e. the Euclidean distance

effect

The effects introduced in the model, one of "individual" (default) , "time", "twoways", or "nested"

model

Panel model transformation: (c("within", "random", "pooling"))

random.method

Method of estimation for the variance components in the random effects model, one of "swar" (default), "amemiya", "walhus", or "nerlove"

kernel

bisquare: wgt = (1-(vdist/bw)^2)^2 if vdist < bw, wgt=0 otherwise (default); gaussian: wgt = exp(-.5*(vdist/bw)^2); exponential: wgt = exp(-vdist/bw); tricube: wgt = (1-(vdist/bw)^3)^3 if vdist < bw, wgt=0 otherwise; boxcar: wgt=1 if dist < bw, wgt=0 otherwise

longlat

If TRUE, great circle distances will be calculated

Value

A list of result:

GW.arguments

a list class object including the model fitting parameters for generating the report file

R2

global r2

index

the index used in the result, Note: in order to avoid mistakes, we forced a rename of the individuals'ID as id.

plm.result

an object of class inheriting from plm, see plm

raw.data

the data.frame used in the regression

GWPR.residuals

the data.frame includes Y, Y hat, and residuals from GWPR

SDF

a Spatial*DataFrame (either Points or Polygons, see sp) integrated with fit.points,GWPR coefficient estimates,coefficient standard errors and t-values in its data slot.

Author(s)

Chao Li <chaoli0394@gmail.com> Shunsuke Managi

References

Fotheringham, A. Stewart, Chris Brunsdon, and Martin Charlton. Geographically weighted regression: the analysis of spatially varying relationships. John Wiley & Sons, 2003.

Examples

data(TransAirPolCalif)
data(California)
formula.GWPR <- pm25 ~ co2_mean + Developed_Open_Space_perc + Developed_Low_Intensity_perc +
   Developed_Medium_Intensity_perc + Developed_High_Intensity_perc +
   Open_Water_perc + Woody_Wetlands_perc + Emergent_Herbaceous_Wetlands_perc +
   Deciduous_Forest_perc + Evergreen_Forest_perc + Mixed_Forest_perc +
   Shrub_perc + Grassland_perc + Pasture_perc + Cultivated_Crops_perc +
   pop_density + summer_tmmx + winter_tmmx + summer_rmax + winter_rmax

#precomputed bandwidth
bw.AIC.Fix <- 1.5

result.F.AIC <- GWPR(bw = bw.AIC.Fix, formula = formula.GWPR, data = TransAirPolCalif,
                     index = c("GEOID", "year"), SDF = California, adaptive = FALSE,
                     p = 2, effect = "individual", model = "within",
                     kernel = "bisquare", longlat = FALSE)
summary(result.F.AIC$SDF$Local_R2)
library(tmap)
tm_shape(result.F.AIC$SDF) +
tm_polygons(col = "Local_R2", pal = "Reds",auto.palette.mapping = FALSE,
            style = 'cont')

GWPR.light documentation built on June 21, 2022, 5:05 p.m.