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.

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)

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)

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').

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.

Examples

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)
#> 1 out of 31 candidate eigenvectors selected
summary(poisson, EV = FALSE)
#> 
#> 	- Spatial Filtering with Eigenvectors (Poisson Model)  -
#> 
#> Coefficients (ML):
#>             Estimate         SE      p-value    
#> (Intercept) 2.528379 0.02829935 1.032215e-95 ***
#> 
#> Model Fit:
#>          logL      AIC      BIC     
#> Initial  -1688.207 3378.415 3381.02 
#> Filtered -1683.523 3371.047 3376.257
#> 
#> Filtered for positive spatial autocorrelation
#> 1 out of 31 candidate eigenvectors selected
#> Condition Number (Multicollinearity): 1
#> Objective Function: "MI"
#> 
#> Moran's I (PearsonResiduals):
#>           Observed    Expected    Variance        z   p-value  
#> Initial  0.1144870 -0.01010101 0.009277738 1.293466 0.1386139  
#> Filtered 0.1075435 -0.01868546 0.005490931 1.703476 0.1386139  

# 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)
#> 0 out of 31 candidate eigenvectors selected
summary(probit, EV = TRUE)
#> 
#> 	- Spatial Filtering with Eigenvectors (Probit Model)  -
#> 
#> Coefficients (ML):
#>              Estimate        SE    p-value  
#> (Intercept) 0.3054679 0.1274797 0.01844387 *
#> 
#> Model Fit:
#>          logL      AIC      BIC    
#> Initial  -66.40641 134.8128 137.418
#> Filtered -66.40641 134.8128 137.418
#> 
#> Filtered for positive spatial autocorrelation
#> 0 out of 31 candidate eigenvectors selected
#> Objective Function: "p" (significance level = 0.05)
#> Bonferroni correction: TRUE (adjusted significance level = 0.00161)
#> 
#> No eigenvectors selected
#> 
#> Moran's I (PearsonResiduals):
#>              Observed    Expected    Variance         z   p-value  
#> Initial  -0.001603494 -0.01010101 0.005313314 0.1165760 0.4554455  
#> Filtered -0.001603494 -0.01010101 0.005090829 0.1190962 0.5841584  

# 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)
#> 0 out of 31 candidate eigenvectors selected
summary(logit, EV = FALSE)
#> 
#> 	- Spatial Filtering with Eigenvectors (Logit Model)  -
#> 
#> Coefficients (ML):
#>              Estimate        SE    p-value  
#> (Intercept) 0.4895482 0.2060214 0.01941604 *
#> 
#> Model Fit:
#>          logL      AIC      BIC    
#> Initial  -66.40641 134.8128 137.418
#> Filtered -66.40641 134.8128 137.418
#> 
#> Filtered for positive spatial autocorrelation
#> 0 out of 31 candidate eigenvectors selected
#> Objective Function: "AIC"
#> 
#> Moran's I (PearsonResiduals):
#>              Observed    Expected    Variance         z   p-value  
#> Initial  -0.001603471 -0.01010101 0.005213413 0.1176880 0.5346535  
#> Filtered -0.001603471 -0.01010101 0.006622039 0.1044233 0.4950495