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:


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 lm.

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 (adaptive_bsq, fixed_bsq, fixed_g).

band_criterion

indicates the criterion to be used for the bandwidth calculation (cv, aic), default value is "cv".

distribution

indicates the probability distribution to be used for the regression (gaussian, poisson, negbin, logistic), default value is"negbin".

globalmin

logical value indicating whether to find a global minimum in the optimization process, default value is TRUE.

multiscale

logical value indicating if multiscale should be used (TRUE, FALSE), default value is TRUE.

distancekm

logical value indicating whether to calculate the distances in km, default value is FALSE.

weight

name of the variable containing the sample weights, default value is NULL.

offset

name of the variable containing the offset values, if null then is set to a vector of zeros, default value is NULL.

id

name of the variable containing the unique identifier of the observations in the dataset, default value is NULL.

h

integer indicating a predetermined bandwidth value, default value is NULL.

max_int

integer indicating the number of iterations, default value is 50.

tol

numeric value indicating the tolerance for small determinants not being considered zero when calculating inverse matrices throughout the model execution, default value is 10^-307.

Value

A list that contains:

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 mgwnbr_model.

...

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 summary.mgwnbr_model.

...

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 mgwnbr_model.

...

Additional arguments passed to other methods.

Value

An object of class summary.mgwnbr_model.