Learn R Programming

mgwrsar (version 1.3.1)

multiscale_gwr: Multiscale Geographically Weighted Regression (MGWR)

Description

This function estimates a Multiscale Geographically Weighted Regression (MGWR) model based on the proposition of Fotheringham et al. (2017). Unlike standard GWR where a single bandwidth is used for all covariates, MGWR allows for covariate-specific bandwidths. It uses a backfitting algorithm to iteratively estimate the optimal bandwidth and coefficients for each explanatory variable.

Usage

multiscale_gwr(formula, data, coords, kernels = 'bisq',
                      control_mgwr = list(), control = list())

Value

An object of class mgwrsar containing:

Betav

Matrix of estimated spatially varying coefficients.

H

Vector of final optimal bandwidths for each covariate.

RMSE

Root Mean Square Error of the final model.

residuals

Vector of residuals.

fitted.values

Vector of fitted values.

AICc

Corrected AIC (if get_AIC = TRUE).

R2

R-squared of the model.

Arguments

formula

A formula object specifying the model (e.g., y ~ x1 + x2).

data

A data frame containing the variables in the model.

coords

A matrix or data frame of coordinates (2 columns for spatial, 3 for spatio-temporal).

kernels

A character string specifying the kernel type. Options include 'bisq' (default), 'gauss', 'triangle', 'tricube', 'rectangle'.

control_mgwr

A named list of control parameters specific to the MGWR backfitting algorithm. See 'Details' for available components.

control

A named list of standard control arguments passed to the internal GWR estimation steps. See 'Details' for available components.

Details

Components for control_mgwr:

init

Character. The type of model used for initialization. Options are 'GWR' (default) or 'lm' (OLS).

maxiter

Integer. Maximum number of backfitting iterations. Default is 20.

tolerance

Numeric. Convergence threshold based on the change in RMSE or bandwidths. Default is 1e-6.

nstable

Integer. Number of consecutive iterations where bandwidths must remain stable to declare convergence. Default is 6.

H0

Numeric vector. Optional initial bandwidths for each covariate. If NULL, they are initialized via GWR or global search.

get_AIC

Logical. If TRUE, calculates the corrected Akaike Information Criterion (AICc) at the end. Default is FALSE.

verbose

Logical. If TRUE, prints progress information during backfitting. Default is FALSE.

Components for control:

adaptive

Logical. If TRUE (default), uses an adaptive bandwidth (k-nearest neighbors). If FALSE, uses a fixed distance bandwidth.

Type

Character. The type of spatial weighting. 'GD' (Geographical Distance, default) or 'GDT' (Geo-Temporal).

NN

Integer. Maximum number of neighbors for matrix truncation (speeds up computation). Default is nrow(data).

ncore

Integer. Number of cores to use for parallel computation.

isgcv

Logical. If TRUE, computes Leave-One-Out Cross-Validation scores. Default is FALSE.

References

Fotheringham, A. S., Yang, W., & Kang, W. (2017). Multiscale geographically weighted regression (MGWR). Annals of the American Association of Geographers, 107(6), 1247-1265.

See Also

MGWRSAR, TDS_MGWR, golden_search_bandwidth