# esf: Spatial regression with eigenvector spatial filtering In spmoran: Moran Eigenvector-Based Spatial Additive Mixed Models

## Description

This function estimates the linear eigenvector spatial filtering (ESF) model. The eigenvectors are selected by a forward stepwise method.

## Usage

 `1` ```esf( y, x = NULL, vif = NULL, meig, fn = "r2" ) ```

## Arguments

 `y` Vector of explained variables (N x 1) `x` Matrix of explanatory variables (N x K). Default is NULL `vif` Maximum acceptable value of the variance inflation factor (VIF) (scalar). For example, if vif = 10, eigenvectors are selected so that the maximum VIF value among explanatory variables and eigenvectors is equal to or less than 10. Default is NULL `meig` Moran eigenvectors and eigenvalues. Output from `meigen` or `meigen_f` `fn` Objective function for the stepwise eigenvector selection. The adjusted R2 ("r2"), AIC ("aic"), or BIC ("bic") are available. Alternatively, all the eigenvectors in meig are use if fn = "all". This is acceptable for large samples (see Murakami and Griffith, 2019). Default is "r2"

## Value

 `b` Matrix with columns for the estimated coefficients on x, their standard errors, t-values, and p-values (K x 4) `s` Vector of statistics for the estimated spatial component (2 x 1). The first element is the standard error and the second element is the Moran's I value of the estimated spatially dependent component. The Moran's I value is scaled to take a value between 0 (no spatial dependence) and 1 (the maximum possible spatial dependence). Based on Griffith (2003), the scaled Moran'I value is interpretable as follows: 0.25-0.50:weak; 0.50-0.70:moderate; 0.70-0.90:strong; 0.90-1.00:marked `r` Matrix with columns for the estimated coefficients on Moran's eigenvectors, their standard errors, t-values, and p-values (L x 4) `vif` Vector of variance inflation factors of the explanatory variables (N x 1) `e` Vector whose elements are residual standard error (resid_SE), adjusted R2 (adjR2), log-likelihood (logLik), AIC, and BIC `sf` Vector of estimated spatial dependent component (Eγ) (N x 1) `pred` Vector of predicted values (N x 1) `resid` Vector of residuals (N x 1) `other` List of other outputs, which are internally used

Daisuke Murakami

## References

Griffith, D. A. (2003). Spatial autocorrelation and spatial filtering: gaining understanding through theory and scientific visualization. Springer Science & Business Media.

Tiefelsdorf, M., and Griffith, D. A. (2007). Semiparametric filtering of spatial autocorrelation: the eigenvector approach. Environment and Planning A, 39 (5), 1193-1221.

Murakami, D. and Griffith, D.A. (2019) Eigenvector spatial filtering for large data sets: fixed and random effects approaches. Geographical Analysis, 51 (1), 23-49.

`resf`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ```require(spdep) data(boston) y <- boston.c[, "CMEDV" ] x <- boston.c[,c("CRIM","ZN","INDUS", "CHAS", "NOX","RM", "AGE")] coords <- boston.c[,c("LON", "LAT")] #########Distance-based ESF meig <- meigen(coords=coords) esfD <- esf(y=y,x=x,meig=meig, vif=5) esfD #########Fast approximation meig_f<- meigen_f(coords=coords) esfD <- esf(y=y,x=x,meig=meig_f, vif=10, fn="all") esfD ############################Not run #########Topoligy-based ESF (it is commonly used in regional science) # #cknn <- knearneigh(coordinates(coords), k=4) #4-nearest neighbors #cmat <- nb2mat(knn2nb(cknn), style="B") #meig <- meigen(cmat=cmat, threshold=0.25) #esfT <- esf(y=y,x=x,meig=meig) #esfT ```

### Example output

```Loading required package: spdep
To access larger datasets in this package, install the spDataLarge
package with: `install.packages('spDataLarge',
Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
55/506 eigen-pairs are extracted
5/55 eigenvectors are selected
Call:
esf(y = y, x = x, vif = 5, meig = meig)

----Coefficients------------------------------
Estimate         SE    t_value      p_value
(Intercept) -12.45663563 2.94378676 -4.2315007 2.768756e-05
CRIM         -0.14941382 0.03137106 -4.7627918 2.514496e-06
ZN            0.03298989 0.01311650  2.5151448 1.221531e-02
INDUS        -0.09274531 0.05825247 -1.5921268 1.119972e-01
CHAS          1.53296595 1.00055783  1.5321113 1.261364e-01
NOX          -5.65464609 3.78113534 -1.4954889 1.354267e-01
RM            6.35698935 0.38905606 16.3395202 2.817711e-48
AGE          -0.01075300 0.01336873 -0.8043402 4.215882e-01

----Spatial effects (residuals)---------------
Estimate
SE                   2.9666104
Moran.I/max(Moran.I) 0.4090961

----Error statistics--------------------------
stat
resid_SE     5.2860996
logLik   -1553.9287533
AIC       3135.8575066
BIC       3195.0290199
56/506 eigen-pairs are approximated
51/56 eigenvectors are selected
Call:
esf(y = y, x = x, vif = 10, meig = meig_f, fn = "all")

----Coefficients------------------------------
Estimate         SE    t_value      p_value
(Intercept)  11.07235127 4.48328341  2.4696969 1.389528e-02
CRIM         -0.20251702 0.03419902 -5.9217203 6.358601e-09
ZN            0.01277324 0.01955117  0.6533236 5.138836e-01
INDUS        -0.09581090 0.07638657 -1.2542899 2.103921e-01
CHAS          0.30145473 0.99385969  0.3033172 7.617893e-01
NOX         -38.76075911 5.69221498 -6.8094335 3.170212e-11
RM            6.16579739 0.40190420 15.3414603 5.591248e-43
AGE          -0.06066440 0.01731318 -3.5039432 5.046185e-04

----Spatial effects (residuals)---------------
Estimate
SE                   6.1566502
Moran.I/max(Moran.I) 0.6321422

----Error statistics--------------------------
stat
resid_SE     4.687364