gwzinbr: Geographically Weighted Zero Inflated Negative Binomial...

View source: R/gwzinbr.R

gwzinbrR Documentation

Geographically Weighted Zero Inflated Negative Binomial Regression

Description

Fits a geographically weighted regression model using zero inflated probability distributions. Has the zero inflated negative binomial distribution (zinb) as default, but also accepts the zero inflated Poisson (zip), negative binomial (negbin) and Poisson distributions. Can also fit the global versions of each regression model.

Usage

gwzinbr(
  data,
  formula,
  xvarinf = NULL,
  weight = NULL,
  lat,
  long,
  grid = NULL,
  method,
  model = "zinb",
  offset = NULL,
  distancekm = FALSE,
  force = FALSE,
  int_inf = TRUE,
  maxg = 100,
  h = NULL
)

Arguments

data

name of the dataset.

formula

regression model formula as in lm.

xvarinf

name of the covariates for the zero inflated part of the model, default value is NULL.

weight

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

lat

name of the variable containing the latitudes in the dataset.

long

name of the variable containing the longitudes in the dataset.

grid

name of the dataset containing the coordinates for the model locations, default value is NULL.

method

indicates the method to be used for the bandwidth calculation (adaptive_bsq or fixed_g).

model

indicates the model to be used for the regression (zinb, zip, negbin, poisson), default value is"zinb".

offset

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

distancekm

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

force

logical value indicating whether to force the indicated model even if it is not the best fit for the data, default value is FALSE.

int_inf

logical value indicating whether to include an intercept in the zero inflated part of the model, default value is TRUE.

maxg

integer indicating the maximum number of iterations for the zero inflated part of the model, default value is 100.

h

integer indicating the bandwidth value (obtained from golden()), default value is NULL.

Value

A list that contains:

  • bandwidth - Bandwidth value.

  • measures - Goodness of fit statistics and other measures.

  • qntls_gwr_param_estimates - Quantiles of GWR parameter estimates.

  • descript_stats_gwr_param_estimates - Descriptive statistics of GWR parameter estimates.

  • t_test_gwr_param_estimates - Results for the parameters significance t tests.

  • qntls_gwr_se - Quantiles of GWR standard errors.

  • descript_stats_gwr_se - Descriptive statistics of GWR standard errors.

  • qntls_gwr_zero_infl_param_estimates - Quantiles of GWR zero inflated parameter estimates.

  • descript_stats_gwr_zero_infl_param_estimates - Descriptive statistics of GWR zero inflated parameter estimates.

  • t_test_gwr_zero_infl_param_estimates - Results for the zero inflated parameters significance t tests.

  • qntls_gwr_zero_infl_se - Quantiles of GWR zero inflated standard errors.

  • descript_stats_gwr_zero_infl_se - Descriptive statistics of GWR zero inflated standard errors.

  • non_stationary_test - Results for the Non-Stationary Test for GWR parameter estimates.

  • non_stationary_test_zero_infl - Results for the Non-Stationary Test for GWR zero inflated parameter estimates.

  • global_param_estimates - Parameter estimates for the global model.

  • analysis_max_like_zero_infl_param_estimated - Analysis of Maximum Likelihood Zero Inflation Parameter Estimates.

  • analysis_max_like_gof_measures - Goodness of fit measures for the Analysis of Maximum Likelihood Zero Inflation Parameter Estimates.

  • variance_covariance_matrix - Variance-covariance matrix.

  • residuals - Model residuals.

  • param_estimates_grid - GWR parameter estimates using grid dataset.

  • alpha_estimates - Estimates for the alpha parameter (for zinb and negbin).

  • gwr_param_estimates - GWR parameter estimates.

Examples

## Data


data(southkorea_covid19)


## Model

mod <- gwzinbr(data = southkorea_covid19,
formula = n_covid1~Morbidity+high_sch_p+Healthcare_access+
diff_sd+Crowding+Migration+Health_behavior,
lat = "x", long = "y", offset = "ln_total", method = "adaptive_bsq",
model = "negbin", distancekm = TRUE, h=230, force=TRUE)

## Bandwidth
mod$bandwidth

## Goodness of fit measures
mod$measures


gwzinbr documentation built on June 22, 2024, 11 a.m.

Related to gwzinbr in gwzinbr...