Type: | Package |
Title: | Multiscale Geographically Weighted Negative Binomial Regression |
Version: | 0.3.0 |
Maintainer: | Juliana Rosa <julianamrosa00@gmail.com> |
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. Hanchen Yu (2024). "Exploring Multiscale Geographically Weighted Negative Binomial Regression", Annals of the American Association of Geographers <doi:10.1080/24694452.2023.2289986>. Fotheringham AS, Yang W, Kang W (2017). "Multiscale Geographically Weighted Regression (MGWR)", Annals of the American Association of Geographers <doi:10.1080/24694452.2017.1352480>. Da Silva AR, Rodrigues TCV (2014). "Geographically Weighted Negative Binomial Regression - incorporating overdispersion", Statistics and Computing <doi:10.1007/s11222-013-9401-9>. |
License: | GPL-3 |
Encoding: | UTF-8 |
Imports: | sp |
RoxygenNote: | 7.3.3 |
LazyData: | true |
NeedsCompilation: | no |
Packaged: | 2025-10-01 19:33:59 UTC; Juliana Rosa |
Author: | Juliana Rosa [aut, cre], Jéssica Vasconcelos [aut], Alan da Silva [aut] |
Depends: | R (≥ 3.5.0) |
Repository: | CRAN |
Date/Publication: | 2025-10-01 19:50:02 UTC |
Georgia dataset
Description
The Georgia census data set from Fotheringham et al. (2002) in dataframe format.
Usage
data(georgia)
Format
A data frame with with 159 observations on the following 13 variables:
-
AreaKey
- an identification number for each county -
Latitude
- the latitude of the county centroid -
Longitud
- the longitude of the county centroid -
TotPop90
- population of the county in 1990 -
PctRural
- percentage of the county population defined as rural -
PctBach
- percentage of the county population with a bachelors degree -
PctEld
- percentage of the county population aged 65 or over -
PctFB
- percentage of the county population born outside the US -
PctPov
- percentage of the county population living below the poverty line -
PctBlack
- percentage of the county population who are black -
ID
- a numeric vector of IDs -
X
- a numeric vector of x coordinates -
Y
- a numeric vector of y coordinates
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,
long,
lat,
band_method,
band_criterion = "cv",
distribution = "negbin",
globalmin = TRUE,
multiscale = TRUE,
distancekm = FALSE,
weight = NULL,
offset = NULL,
id = NULL,
h = NULL,
max_int = 50,
tol = 10^-307
)
Arguments
data |
name of the dataset. |
formula |
regression model formula as in |
long |
name of the variable containing the longitudes in the dataset. |
lat |
name of the variable containing the latitudes in the dataset. |
band_method |
indicates the method to be used for the bandwidth calculation ( |
band_criterion |
indicates the criterion to be used for the bandwidth calculation ( |
distribution |
indicates the probability distribution to be used for the regression ( |
globalmin |
logical value indicating whether to find a global minimum in the optimization process, default value is |
multiscale |
logical value indicating if multiscale should be used ( |
distancekm |
logical value indicating whether to calculate the distances in km, default value is |
weight |
name of the variable containing the sample weights, default value is |
offset |
name of the variable containing the offset values, if null then is set to a vector of zeros, default value is |
id |
name of the variable containing the unique identifier of the observations in the dataset, default value is |
h |
integer indicating a predetermined bandwidth value, default value is |
max_int |
integer indicating the number of iterations, default value is |
tol |
numeric value indicating the tolerance for small determinants not being considered zero when calculating inverse matrices throughout the model execution, default value is |
Value
A list that contains:
-
band
- Bandwidth values for each covariate. -
fitted_values
- MGWR fitted values. -
mgwr_param_estimates
- MGWR parameter estimates. -
mgwr_se
- MGWR standard errors. -
general_bandwidth
- General bandwidth value. -
measures
- Goodness of fit statistics. -
ENP
- Effective number of parameters. -
alpha_level_5_pct
- significance levels for the t tests on parameter significance. -
t_critical
- Critical values for the t tests on parameter significance. -
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)
## MGWR Model
mod <- mgwnbr(data=georgia, formula=PctBach~PctBlack+PctFB,
lat="Y", long="X", globalmin=FALSE, band_method="adaptive_bsq", band_criterion="cv",
distribution="gaussian", multiscale=TRUE, h=100)
## Bandwidths
mod$general_bandwidth
## Goodness of fit measures
mod$measures
## GWNBR Model
## Not run:
mod <- mgwnbr(data=georgia, formula=PctBach~PctBlack+PctFB,
lat="Y", long="X", globalmin=FALSE, band_method="adaptive_bsq", band_criterion="cv",
distribution="negbin", multiscale=FALSE)
## End(Not run)
## GWPR Model
## Not run:
mod <- mgwnbr(data=georgia, formula=PctBach~PctBlack+PctFB,
lat="Y", long="X", globalmin=FALSE, band_method="adaptive_bsq", band_criterion="cv",
distribution="poisson", multiscale=FALSE)
## End(Not run)
Print method for mgwnbr_model objects
Description
Print method for mgwnbr_model objects
Usage
## S3 method for class 'mgwnbr_model'
print(x, ...)
Arguments
x |
An object of class |
... |
Additional arguments passed to other methods. |
Value
The object (invisibly).
Print method for summary.myclass objects
Description
Print method for summary.myclass objects
Usage
## S3 method for class 'summary.mgwnbr_model'
print(x, ...)
Arguments
x |
An object of class |
... |
Further arguments passed to print. |
Value
The object (invisibly).
Summary method for mgwnbr_model objects
Description
Summary method for mgwnbr_model objects
Usage
## S3 method for class 'mgwnbr_model'
summary(object, ...)
Arguments
object |
An object of class |
... |
Additional arguments passed to other methods. |
Value
An object of class summary.mgwnbr_model
.