bw.GWPR: Bandwidth selection for basic GWPR

View source: R/bw_GWPR.R

bw.GWPRR Documentation

Bandwidth selection for basic GWPR

Description

A function for automatic bandwidth selection to calibrate a GWPR model

Usage

bw.GWPR(formula, data, index, SDF, adaptive = FALSE, p = 2, bigdata = FALSE,
               upperratio = 0.25, effect = "individual",
               model = c("pooling", "within", "random"),
               random.method = "swar", approach = c("CV","AIC"), kernel = "bisquare",
               longlat = FALSE, doParallel = FALSE, cluster.number = 2,
               human.set.range = FALSE, h.upper = NULL, h.lower = NULL,
               gradientIncrement = FALSE, GI.step = NULL, GI.upper = NULL,
               GI.lower = NULL)

Arguments

formula

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

data

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

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

bigdata

TRUE or FALSE, if the dataset exceeds 40,000, we strongly recommend set it TRUE

upperratio

Set the ratio between upper boundary of potential bandwidth range and the forthest distance of SDF, if bigdata = T. (default value: 0.25)

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"

approach

Score used to optimize the bandwidth, c("CV", "AIC")

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

doParallel

If TRUE, "cluster": multi-process technique with the parallel package would be used.

cluster.number

The number of the clusters that user wants to use

human.set.range

If TRUE, the range of bandwidth selection for golden selection could be set by the user

h.upper

The upper boundary of the potential bandwidth range for golden selection.

h.lower

The lower boundary of the potential bandwidth range for golden selection.

gradientIncrement

The bandwidth selection become gradient increment, if TRUE

GI.step

The step length of the increment.

GI.upper

The upper boundary of the gradient increment selection.

GI.lower

The lower boundary of the gradient increment selection.

Value

The optimal bandwidth

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

bw.CV.Fix <- bw.GWPR(formula = formula.GWPR, data = TransAirPolCalif,
                     index = c("GEOID", "year"),
                     SDF = California, adaptive = FALSE, p = 2, bigdata = FALSE,
                     effect = "individual", model = "within", approach = "CV",
                     kernel = "bisquare", longlat = FALSE,
                     gradientIncrement = TRUE, GI.step = 0.5, GI.upper = 5,
                     GI.lower = 1.5)

bw.CV.Fix

bw.AIC.Fix <- bw.GWPR(formula = formula.GWPR, data = TransAirPolCalif,
                      index = c("GEOID", "year"),
                      SDF = California, adaptive = FALSE, p = 2, bigdata = FALSE,
                      effect = "individual", model = "within", approach = "AIC",
                      kernel = "bisquare", longlat = FALSE, doParallel = FALSE)
bw.AIC.Fix


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