| Golden {gwzinbr} | R Documentation | 
Golden Section Search
Description
Runs a Golden Section Search (GSS) algorithm for determining the optimum bandwidth for the geographically weighted zero inflated negative binomial regression and other spatial regression models.
Usage
Golden(
  data,
  formula,
  xvarinf = NULL,
  weight = NULL,
  lat,
  long,
  globalmin = TRUE,
  method,
  model = "zinb",
  bandwidth = "cv",
  offset = NULL,
  force = FALSE,
  maxg = 100,
  distancekm = FALSE
)
Arguments
| data | name of the dataset. | 
| formula | regression model formula as in  | 
| xvarinf | name of the covariates for the zero inflated part of the model, default value is  | 
| weight | name of the variable containing the sample weights, default value is  | 
| lat | name of the variable containing the latitudes in the dataset. | 
| long | name of the variable containing the longitudes in the dataset. | 
| globalmin | logical value indicating whether to find a global minimum in the optimization process, default value is  | 
| method | indicates the method to be used for the bandwidth calculation ( | 
| model | indicates the model to be used for the regression ( | 
| bandwidth | indicates the criterion to be used for the bandwidth calculation ( | 
| offset | name of the variable containing the offset values, if null then is set to a vector of zeros, default value is  | 
| force | logical value indicating whether to force the indicated model even if it is not the best fit for the data, default value is  | 
| maxg | integer indicating the maximum number of iterations for the zero inflated part of the model, default value is  | 
| distancekm | logical value indicating whether to calculate the distances in km, default value is  | 
Value
A list that contains:
-  h_values- Initial values tested for the bandwidth.
-  iterations- All bandwidth values tested and respective cv/aic results for each Golden Section Search executed.
-  gss_results- Optimum bandwidth found and respective cv/aic.
-  min_bandwidth- Optimum bandwidth.
Examples
## Data
data(southkorea_covid19)
## GSS algorithm
gss <- Golden(data = southkorea_covid19[1:122, ],
formula = n_covid1~diff_sd,
xvarinf = NULL, weight = NULL, lat = "y", long = "x",
offset = NULL, model = "poisson", method = "fixed_g",
bandwidth = "cv", globalmin = FALSE, distancekm = FALSE,
force=FALSE)
## Bandwidth
gss$min_bandwidth
## Iterations
gss$iterations