glmFilter: Unsupervised Spatial Filtering with Eigenvectors in...

Description Usage Arguments Details Value Note References See Also Examples

View source: R/glmFilter.R

Description

This function implements the eigenvector-based semiparametric spatial filtering approach in a generalized linear regression framework using maximum likelihood estimation (MLE). Eigenvectors are selected by an unsupervised stepwise regression technique. Supported selection criteria are the minimization of residual autocorrelation, maximization of model fit, significance of residual autocorrelation, and the statistical significance of eigenvectors. Alternatively, all eigenvectors in the candidate set can be included as well.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
glmFilter(
  y,
  x = NULL,
  W,
  objfn = "AIC",
  MX = NULL,
  model,
  optim.method = "BFGS",
  sig = 0.05,
  bonferroni = TRUE,
  positive = TRUE,
  ideal.setsize = FALSE,
  min.reduction = 0.05,
  boot.MI = 100,
  resid.type = "pearson",
  alpha = 0.25,
  tol = 0.1,
  na.rm = TRUE
)

Arguments

y

response variable

x

vector/ matrix of regressors (default = NULL)

W

spatial connectivity matrix

objfn

the objective function to be used for eigenvector selection. Possible criteria are: the maximization of model fit ('AIC' or 'BIC'), minimization of residual autocorrelation ('MI'), significance level of candidate eigenvectors ('p'), significance of residual spatial autocorrelation ('pMI'), or all eigenvectors in the candidate set ('all')

MX

covariates used to construct the projection matrix (default = NULL) - see Details

model

a character string indicating the type of model to be estimated. Currently, 'probit', 'logit', and 'poisson' are valid inputs

optim.method

a character specifying the optimization method used by the optim function

sig

significance level to be used for eigenvector selection if objfn = 'p' or objfn = 'pMI'

bonferroni

Bonferroni adjustment for the significance level (TRUE/ FALSE) if objfn = 'p'. Set to FALSE if objfn = 'pMI' - see Details

positive

restrict search to eigenvectors associated with positive levels of spatial autocorrelation (TRUE/ FALSE)

ideal.setsize

if positive = TRUE, uses the formula proposed by Chun et al. (2016) to determine the ideal size of the candidate set (TRUE/ FALSE)

min.reduction

if objfn is either 'AIC' or 'BIC'. A value in the interval [0,1) that determines the minimum reduction in AIC/ BIC (relative to the current AIC/ BIC) a candidate eigenvector need to achieve in order to be selected

boot.MI

number of iterations used to estimate the variance of Moran's I (default = 100). Alternatively, if boot.MI = NULL, analytical results will be used

resid.type

character string specifying the residual type to be used. Options are 'raw', 'deviance', and 'pearson' (default)

alpha

a value in (0,1] indicating the range of candidate eigenvectors according to their associated level of spatial autocorrelation, see e.g., Griffith (2003)

tol

if objfn = 'MI', determines the amount of remaining residual autocorrelation at which the eigenvector selection terminates

na.rm

remove observations with missing values (TRUE/ FALSE)

Details

If W is not symmetric, it gets symmetrized by 1/2 * (W + W') before the decomposition.

If covariates are supplied to MX, the function uses these regressors to construct the following projection matrix:

M = I - X (X'X)^-1X'

Eigenvectors from MWM using this specification of M are not only mutually uncorrelated but also orthogonal to the regressors specified in MX. Alternatively, if MX = NULL, the projection matrix becomes M = I - 11'/n, where 1 is a vector of ones and n represents the number of observations. Griffith and Tiefelsdorf (2007) show how the choice of the appropriate M depends on the underlying process that generates the spatial dependence.

The Bonferroni correction is only possible if eigenvector selection is based on the significance level of the eigenvectors (objfn = 'p'). It is set to FALSE if eigenvectors are added to the model until the residuals exhibit no significant level of spatial autocorrelation (objfn = 'pMI').

Value

An object of class spfilter containing the following information:

estimates

summary statistics of the parameter estimates

varcovar

estimated variance-covariance matrix

EV

a matrix containing the summary statistics of selected eigenvectors

selvecs

vector/ matrix of selected eigenvectors

evMI

Moran coefficient of all eigenvectors

moran

residual autocorrelation in the initial and the filtered model

fit

adjusted R-squared of the initial and the filtered model

residuals

initial and filtered model residuals

other

a list providing supplementary information:

ncandidates

number of candidate eigenvectors considered

nev

number of selected eigenvectors

condnum

condition number to assess the degree of multicollinearity among the eigenvectors induced by the link function, see e.g., Griffith/ Amrhein (1997)

sel_id

ID of selected eigenvectors

sf

vector representing the spatial filter

sfMI

Moran coefficient of the spatial filter

model

type of the regression model

dependence

filtered for positive or negative spatial dependence

objfn

selection criterion specified in the objective function of the stepwise regression procedure

bonferroni

TRUE/ FALSE: Bonferroni-adjusted significance level (if objfn='p')

siglevel

if objfn = 'p' or objfn = 'pMI': actual (unadjusted/ adjusted) significance level

resid.type

residual type ('raw', 'deviance', or 'pearson')

pseudoR2

McFadden's pseudo R-squared (filtered vs. unfiltered model)

Note

If the condition number (condnum) suggests high levels of multicollinearity, eigenvectors can be sequentially removed from selvecs and the model can be re-estimated using the glm function in order to identify and manually remove the problematic eigenvectors. Moreover, if other models that are currently not implemented here need to be estimated (e.g., quasi-binomial models), users can extract eigenvectors using the function getEVs and perform a supervised eigenvector search using the glm function.

In contrast to eigenvector-based spatial filtering in linear regression models, Chun (2014) notes that only a limited number of studies address the problem of measuring spatial autocorrelation in generalized linear model residuals. Consequently, eigenvector selection may be based on an objective function that maximizes model fit rather than minimizes residual spatial autocorrelation.

References

Chun, Yongwan (2014): Analyzing Space-Time Crime Incidents Using Eigenvector Spatial Filtering: An Application to Vehicle Burglary. Geographical Analysis 46 (2): pp. 165 - 184.

Tiefelsdorf, Michael and Daniel A. Griffith (2007): Semiparametric filtering of spatial autocorrelation: the eigenvector approach. Environment and Planning A: Economy and Space, 39 (5): pp. 1193 - 1221.

Griffith, Daniel A. (2003): Spatial Autocorrelation and Spatial Filtering: Gaining Understanding Through Theory and Scientific Visualization. Berlin/ Heidelberg, Springer.

Griffith, Daniel A. and Carl G. Amrhein (1997): Multivariate Statistical Analysis for Geographers. Englewood Cliffs, Prentice Hall.

See Also

lmFilter, getEVs, MI.resid, optim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data(fakedata)

# poisson model
y_pois <- fakedataset$count
poisson <- glmFilter(y = y_pois, x = NULL, W = W, objfn = "MI", positive = FALSE,
model = "poisson", boot.MI = 100)
print(poisson)
summary(poisson, EV = FALSE)

# probit model - summarize EVs
y_prob <- fakedataset$indicator
probit <- glmFilter(y = y_prob, x = NULL, W = W, objfn = "p", positive = FALSE,
model = "probit", boot.MI = 100)
print(probit)
summary(probit, EV = TRUE)

# logit model - AIC objective function
y_logit <- fakedataset$indicator
logit <- glmFilter(y = y_logit, x = NULL, W = W, objfn = "AIC", positive = FALSE,
model = "logit", min.reduction = .05)
print(logit)
summary(logit, EV = FALSE)

spfilteR documentation built on Oct. 5, 2021, 9:10 a.m.