R/lmFilter.R
, R/methods.R
lmFilter.Rd
This function implements the eigenvector-based semiparametric spatial filtering approach in a linear regression framework using ordinary least squares (OLS). 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.
lmFilter(
y,
x = NULL,
W,
objfn = "MI",
MX = NULL,
sig = 0.05,
bonferroni = TRUE,
positive = TRUE,
ideal.setsize = FALSE,
alpha = 0.25,
tol = 0.1,
boot.MI = NULL,
na.rm = TRUE
)
# S3 method for spfilter
summary(object, EV = FALSE, ...)
response variable
vector/ matrix of regressors (default = NULL)
spatial connectivity matrix
the objective function to be used for eigenvector selection. Possible criteria are: the maximization of the adjusted R-squared ('R2'), 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')
covariates used to construct the projection matrix (default = NULL) - see Details
significance level to be used for eigenvector selection
if objfn = 'p'
or objfn = 'pMI'
Bonferroni adjustment for the significance level
(TRUE/ FALSE) if objfn = 'p'
. Set to FALSE if objfn = 'pMI'
-
see Details
restrict search to eigenvectors associated with positive levels of spatial autocorrelation (TRUE/ FALSE)
if positive = TRUE
, uses the formula proposed by
Chun et al. (2016) to determine the ideal size of the candidate set
(TRUE/ FALSE)
a value in (0,1] indicating the range of candidate eigenvectors according to their associated level of spatial autocorrelation, see e.g., Griffith (2003)
if objfn = 'MI'
, determines the amount of remaining residual
autocorrelation at which the eigenvector selection terminates
number of iterations used to estimate the variance of Moran's I.
If boot.MI = NULL
(default), analytical results will be used
remove observations with missing values (TRUE/ FALSE)
an object of class spfilter
display summary statistics for selected eigenvectors (TRUE/ FALSE)
additional arguments
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
sel_id
ID of selected eigenvectors
sf
vector representing the spatial filter
sfMI
Moran coefficient of the spatial filter
model
type of the fitted 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
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'
).
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.
Chun, Yongwan, Daniel A. Griffith, Monghyeon Lee, Parmanand Sinha (2016): Eigenvector selection with stepwise regression techniques to construct eigenvector spatial filters. Journal of Geographical Systems, 18, pp. 67 – 85.
Le Gallo, Julie and Antonio Páez (2013): Using synthetic variables in instrumental variable estimation of spatial series models. Environment and Planning A: Economy and Space, 45 (9): pp. 2227 - 2242.
Tiefelsdorf, Michael and Barry Boots (1995): The Exact Distribution of Moran's I. Environment and Planning A: Economy and Space, 27 (6): pp. 985 - 999.
data(fakedata)
y <- fakedataset$x1
X <- cbind(fakedataset$x2, fakedataset$x3, fakedataset$x4)
res <- lmFilter(y = y, x = X, W = W, objfn = 'MI', positive = FALSE)
print(res)
#> 10 out of 31 candidate eigenvectors selected
summary(res, EV = TRUE)
#>
#> - Spatial Filtering with Eigenvectors (Linear Model) -
#>
#> Coefficients (OLS):
#> Estimate SE p-value
#> (Intercept) 9.124104289 0.66507612 1.799107e-23 ***
#> beta_1 1.005931015 0.07952583 2.038804e-21 ***
#> beta_2 0.004370487 0.05354359 9.351325e-01
#>
#> Adjusted R-squared:
#> Initial Filtered
#> 0.4620807 0.7374539
#>
#> Filtered for positive spatial autocorrelation
#> 10 out of 31 candidate eigenvectors selected
#> Objective Function: "MI"
#>
#> Summary of selected eigenvectors:
#> Estimate SE p-value partialR2 VIF MI
#> ev_13 -9.603639 1.419980 1.485195e-09 0.23201418 1.010147 0.6302019 ***
#> ev_10 -5.530371 1.450140 2.552893e-04 0.08005190 1.052256 0.7303271 ***
#> ev_2 4.846595 1.428638 1.044281e-03 0.06270986 1.021395 1.0004147 **
#> ev_4 -3.184166 1.457302 3.157895e-02 0.02963330 1.059905 0.9257835 *
#> ev_5 -2.902051 1.436375 4.641769e-02 0.02023369 1.031162 0.8968632 *
#> ev_9 3.302924 1.439372 2.415752e-02 0.02741295 1.036276 0.7638378 *
#> ev_21 -3.386843 1.423180 1.950863e-02 0.02803836 1.014155 0.4539879 *
#> ev_19 3.793853 1.414326 8.745591e-03 0.03715301 1.003177 0.4615722 **
#> ev_26 -3.558030 1.414902 1.375282e-02 0.03243658 1.004043 0.3113456 *
#> ev_20 2.971558 1.425260 4.000702e-02 0.02352405 1.017381 0.4539879 *
#>
#> Moran's I (Residuals):
#> Observed Expected Variance z p-value
#> Initial 0.35062455 -0.01222386 0.01219947 3.28514585 0.000509648 ***
#> Filtered -0.06296148 -0.08768656 0.07854341 0.08822323 0.464849627
E <- res$selvecs
(ols <- coef(lm(y ~ X + E)))
#> (Intercept) X1 X2 Eevec_13 Eevec_10 Eevec_2
#> 9.124104289 1.005931015 0.004370487 -9.603638643 -5.530370597 4.846595193
#> Eevec_4 Eevec_5 Eevec_9 Eevec_21 Eevec_19 Eevec_26
#> -3.184166128 -2.902051446 3.302923858 -3.386843060 3.793852899 -3.558029960
#> Eevec_20
#> 2.971557958
coef(res)
#> (Intercept) beta_1 beta_2
#> 9.124104289 1.005931015 0.004370487