This function helps choosing the optimal bandwidth for the Geographically Weighted Zero Inflated Poisson Regression (GWZIPR).
gw.zi.bw(formula, family, dframe, coords, kernel, algorithm="exhaustive",
optim.method="Nelder-Mead", b.min=NULL, b.max=NULL, step=NULL)
The optimal bandwidth (fixed or adaptive)
The corresponding Cross Validation score for the optimal bandwidth
Available only in the case of the exhaustive
algorithm. This is a numeric matrix in which the first column refers to the bandwidth in test and the second to the corresponding CV score.
the local model to be fitted using the same syntax used in the zeroinfl function of the R package pscl
. This is a sting (a symbolic description of the model) that is passed to the sub-models' zeroinfl
function. For more details look at the details of the zeroinfl
function.
a specification of the count model family to be used in the local model as in the zeroinfl
function. Currently the only option tested is "poisson".
a numeric data frame of at least two suitable variables (one dependent and one independent)
a numeric matrix or data frame of two columns giving the X,Y coordinates of the observations
the kernel to be used in the regression. Options are "adaptive" or "fixed". The weighting scheme used here is defined by the bi-square function (weight = (1-(ndist/H)^2)^2
for distances less than or equal to H
, 0
otherwise)
a character argument that specifies whether the function will use an exhaustive
or a heuristic
algorithm. In the first case all possible bandwidths within a range are being tested. In the second case the optim
function is being used allowing for the choice of various optimisation methods (such as Brent
or BFGS
) that may find a global or local optimum. The default algorithm is "exhaustive"
the optimisation method to be used. A detailed discussion is available at the 'Details' section of the function optim (stats)
. Example methods are "Nelder-Mead"
, "Brent"
, "BFGS"
, "CG"
and "L-BFGS-B"
. The default method is "Nelder-Mead"
.
the minimum bandwidth. This is important for both algorithms. In the case of the exhaustive
algorithm it sets the lower boundary for the range in which the function will compute the CV score for each possible bandwidth. In the case of the heuristic
algorithm it provides the initial value for the bandwidth to be optimised which is very important. In the latter case b.min and b.max should be provided if the optimisation method "L-BFGS-B"
or "Brent"
has been selected.
the maximum bandwidth. This is important for both algorithms. In the case of the exhaustive
algorithm it sets the upper boundary for the range in which the function will compute the CV score for each possible bandwidth. In the case of the heuristic
algorithm b.max and b.min should be provided if the optimisation method "L-BFGS-B"
or "Brent"
has been selected.
this numeric argument is used only in the case of a fixed
kernel indicating the increment of the sequence of bandwidths in between the b.min
and the b.max
. In the case of the adaptive
kernel the increment is 1 neighbour.
Stamatis Kalogirou <stamatis.science@gmail.com>
Large datasets increase the processing time.
Please carefully read the function optim(stats)
when using a heuristic
algorithm.
Kalogirou, S. (2016) Destination Choice of Athenians: an application of geographically weighted versions of standard and zero inflated Poisson spatial interaction models, Geographical Analysis, 48(2),pp. 191-230. DOI: 10.1111/gean.12092 https://onlinelibrary.wiley.com/doi/abs/10.1111/gean.12092
gwr
RDF <- random.test.data(9,9,3,"zip")
gw.zip.bw <- gw.zi.bw(dep ~ X1 + X2, "poisson", RDF, cbind(RDF$X,RDF$Y),
kernel = 'adaptive', b.min = 54, b.max=55)
Run the code above in your browser using DataLab