mgwnbr {mgwnbr} | R Documentation |
Multiscale Geographically Weighted Negative Binomial Regression
Description
Fits a geographically weighted regression model with different scales for each covariate. Uses the negative binomial distribution as default, but also accepts the normal, Poisson, or logistic distributions. Can fit the global versions of each regression and also the geographically weighted alternatives with only one scale, since they are all particular cases of the multiscale approach.
Usage
mgwnbr(
data,
formula,
weight = NULL,
lat,
long,
globalmin = TRUE,
method,
model = "negbin",
mgwr = TRUE,
bandwidth = "cv",
offset = NULL,
distancekm = FALSE,
int = 50,
h = NULL
)
Arguments
data |
name of the dataset. |
formula |
regression model formula as in |
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 ( |
mgwr |
logical value indicating if multiscale should be used ( |
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 |
distancekm |
logical value indicating whether to calculate the distances in km, default value is |
int |
integer indicating the number of iterations, default value is |
h |
integer indicating a predetermined bandwidth value, default value is |
Value
A list that contains:
-
general_bandwidth
- General bandwidth value. -
band
- Bandwidth values for each covariate. -
measures
- Goodness of fit statistics. -
ENP
- Effective number of parameters. -
mgwr_param_estimates
- MGWR parameter estimates. -
qntls_mgwr_param_estimates
- Quantiles of MGWR parameter estimates. -
descript_stats_mgwr_param_estimates
- Descriptive statistics of MGWR parameter estimates. -
p_values
- P-values for the t tests on parameter significance. -
t_critical
- Critical values for the t tests on parameter significance. -
mgwr_se
- MGWR standard errors. -
qntls_mgwr_se
- Quantiles of MGWR standard errors. -
descript_stats_se
- Descriptive statistics of MGWR standard errors. -
global_param_estimates
- Parameter estimates for the global model. -
t_test_dfs
- Denominator degrees of freedom for the t tests. -
global_measures
- Goodness of fit statistics for the global model.
Examples
## Data
data(georgia)
for (var in c("PctFB", "PctBlack")){
georgia[, var] <- as.data.frame(scale(georgia[, var]))
}
## Model
mod <- mgwnbr(data=georgia, formula=PctBach~PctBlack+PctFB,
lat="Y", long="X", globalmin=FALSE, method="adaptive_bsq", bandwidth="cv",
model="gaussian", mgwr=FALSE, h=136)
## Bandwidths
mod$general_bandwidth
## Goodness of fit measures
mod$measures