bw.CV.A: 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. Arguments of the function

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
bw.CV.A(
  formula,
  data,
  index,
  effect = c("individual", "time", "twoways", "nested"),
  model = c("within", "random", "ht", "between", "pooling", "fd"),
  kernel = "bisquare",
  dMat,
  bws
)

Arguments

formula

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

data

dataFrame for the Panel data

index

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

effect

the effects introduced in the model, one of "individual", "time", or "twoways" (see plm::plm)

model

one of "pooling", "within", "between", "random", "fd", or "ht" (see plm::plm)

kernel

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

dMat

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

bws

bandwidths to be used for calculations of CV-score

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
bwCV.A <-  bw.CV.A(formula=Equation, data=data, index=c("id","year"), effect='individual', model="within", kernel="bisquare", dMat=dMat, bws=c(30:40))

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