bw.avg: A function for bandwidth selection to calibrate a GWPR model,...

Description Usage Arguments Value Examples

View source: R/bw_avg.R

Description

A function for bandwidth selection to calibrate a GWPR model, based on the mean over time of the data. The formula for calculating the CV value for Panel is based on the study of: YU, Danlin. 2010. Exploring spatiotemporally varying regressed relationships: the geographically weighted panel regression analysis. In : Proceedings of the Joint International Conference on Theory, data Handling and modeling in GeoSpatial Information Science. p. 134-

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
bw.avg(
  formula,
  data,
  SDF,
  index,
  approach = c("CV", "AICc"),
  kernel = "bisquare",
  adaptive = FALSE,
  p = 2,
  longlat = FALSEALSE,
  dMat
)

Arguments

formula

Regression model formula : Y ~ X1 + ... + Xk

data

dataFrame for the Panel data

SDF

large SpatialPolygonsdataFrame on which is based the data

index

List for the indexes : (c(" ID, Time"))

approach

score used to optimize the bandwidth (see GWmodel::bw.gwr)

kernel

gaussian, exponential, bisquare, tricube, boxcar (see GWmodel::gw.weight)

adaptive

TRUE or FALSE (see GWmodel::gw.weight)

p

the power of the Minkowski distance, default is 2, i.e. the Euclidean distance (see GWmodel::bw.gwr)

longlat

if TRUE, great circle distances will be calculated (see GWmodel::bw.gwr)

dMat

a distance matrix or vector (Optional parameter, see GWmodel::gw.weight)

Value

double

Examples

1
2
3
4
5
6
data(USStates)
USStates@data$id <- c(1:length(unique(USStates@data[,"state"])))
data <- merge(USStates@data, Produc, by="state", all=True)
dMat <- GWmodel::gw.dist(sp::coordinates(USStates), p=2, longlat=FALSE)
Equation <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
bwAVG.A <- bw.avg(formula=Equation, data=data, SDF=USStates, index=c("id","year"), approach="AICc", kernel="bisquare", adaptive=T, p=2, longlat=FALSE, dMat=dMat)

LAEQ/gwpr documentation built on June 28, 2020, 8:23 p.m.