Pengantar Regresi Spasial

Regresi spasial adalah metode regresi yang digunakan untuk tipe data spasial atau data yang memiliki efek spasial (spatial effect). Efek lokasi (spatial effect) dapat terdiri dari dua jenis yaitu dependensi spasial dan heterogenitas spasial. Dependensi spasial dapat diartikan bahwa pengamatan pada lokasi i bergantung pada pengamatan lain di lokasi j, untuk j≠i. Sedangkan heterogenitas spasial terjadi akibat adanya efek lokasi random, yaitu perbedaan antara satu lokasi dengan lokasi yang lainnya. Dasar berkembangnya metode regresi spasial adalah metode regresi linier klasik (regresi linier berganda). Pengembangan itu berdasarkan adanya pengaruh tempat atau spasial pada data yang dianalisis. Menurut Tobler pada tahun 1979 mengungkapkan di dalam Hukum Geografi pertama, bahwa segala sesuatu saling berhubungan satu dengan yang lainnya, tetapi sesuatu yang dekat lebih mempunyai pengaruh daripada sesuatu yang jauh (Anselin, 1988).

Model regresi linear dalam bentuk matriks: \[ \mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon} \]

dengan: \[ \mathbf{y} = \begin{bmatrix} y_1 \\ y_2 \\ \vdots \\ y_n \end{bmatrix}, \quad \mathbf{X} = \begin{bmatrix} 1 & x_{11} & x_{12} & \cdots & x_{1p} \\ 1 & x_{21} & x_{22} & \cdots & x_{2p} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & x_{n1} & x_{n2} & \cdots & x_{np} \end{bmatrix}, \quad \boldsymbol{\beta} = \begin{bmatrix} \beta_0 \\ \beta_1 \\ \vdots \\ \beta_p \end{bmatrix} \] Bentuk Umum Model Regresi Spasial adalah: Menurut LeSage (1999) menjelaskan bahwa model umum regresi spasial dapat dituliskan sebagai berikut:

\[ \mathbf{y} = \rho \mathbf{W} \mathbf{y} + \mathbf{X} \boldsymbol{\beta} + \mathbf{u}, \qquad \mathbf{u} = \lambda \mathbf{W} \mathbf{u} + \boldsymbol{\epsilon}, \qquad \boldsymbol{\epsilon} \sim N(0, \sigma_\epsilon^2 I_n) \]

dengan:

\[ \begin{aligned} \mathbf{y} & = \text{vektor variabel respon berukuran } n \times 1 \\ \rho & = \text{koefisien parameter spasial lag dari variabel respon} \\ \mathbf{W} & = \text{matriks pembobot spasial berukuran } n \times n \\ \mathbf{X} & = \text{matriks variabel prediktor berukuran } n \times (p+1) \\ \boldsymbol{\beta} & = \text{vektor koefisien regresi berukuran } (p+1) \times 1 \\ \lambda & = \text{koefisien parameter spasial error} \\ \mathbf{u} & = \text{vektor error yang mempunyai efek spasial} \end{aligned} \]

Aktifkan Library

library yang digunakan antara lain tmap, raster, stats, spdep, dan spatialreg

library(tmap)
library(raster)
library(stats)
library(spdep)
library(spatialreg) #Regresi Spasial
library(rgdal)
library(spData) #data columbus

Load Peta dan Data

Import data peta dengan tipe shp dan tabel data pendukung dengan tipe .csv.

#Input Shp File
#data(columbus) # menggunakan data columbus yang berada di package spData
spColumbus <- st_read(system.file("shapes/columbus.shp",
                                  package="spData"), quiet=TRUE)

plot(st_geometry(spColumbus), border="black",col='gray', sub="Peta Columbus")

names(spColumbus)
##  [1] "AREA"       "PERIMETER"  "COLUMBUS_"  "COLUMBUS_I" "POLYID"    
##  [6] "NEIG"       "HOVAL"      "INC"        "CRIME"      "OPEN"      
## [11] "PLUMB"      "DISCBD"     "X"          "Y"          "NSA"       
## [16] "NSB"        "EW"         "CP"         "THOUS"      "NEIGNO"    
## [21] "geometry"
head(spColumbus)
## Simple feature collection with 6 features and 20 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 7.950089 ymin: 12.86109 xmax: 10.1806 ymax: 14.74245
## CRS:           NA
##       AREA PERIMETER COLUMBUS_ COLUMBUS_I POLYID NEIG  HOVAL    INC    CRIME
## 1 0.309441  2.440629         2          5      1    5 80.467 19.531 15.72598
## 2 0.259329  2.236939         3          1      2    1 44.567 21.232 18.80175
## 3 0.192468  2.187547         4          6      3    6 26.350 15.956 30.62678
## 4 0.083841  1.427635         5          2      4    2 33.200  4.477 32.38776
## 5 0.488888  2.997133         6          7      5    7 23.225 11.252 50.73151
## 6 0.283079  2.335634         7          8      6    8 28.750 16.029 26.06666
##       OPEN    PLUMB DISCBD     X     Y NSA NSB EW CP THOUS NEIGNO
## 1 2.850747 0.217155   5.03 38.80 44.07   1   1  1  0  1000   1005
## 2 5.296720 0.320581   4.27 35.62 42.38   1   1  0  0  1000   1001
## 3 4.534649 0.374404   3.89 39.82 41.18   1   1  1  0  1000   1006
## 4 0.394427 1.186944   3.70 36.50 40.52   1   1  0  0  1000   1002
## 5 0.405664 0.624596   2.83 40.01 38.00   1   1  1  0  1000   1007
## 6 0.563075 0.254130   3.78 43.75 39.28   1   1  1  0  1000   1008
##                         geometry
## 1 POLYGON ((8.624129 14.23698...
## 2 POLYGON ((8.25279 14.23694,...
## 3 POLYGON ((8.653305 14.00809...
## 4 POLYGON ((8.459499 13.82035...
## 5 POLYGON ((8.685274 13.63952...
## 6 POLYGON ((9.401384 13.5504,...

Membuat Matriks Pembobot

Matriks Pembobot pada model Regresi Spasial disusun berdasarkan persinggungan antar wilayah.

#MATRIKS PEMBOBOT QUEEN
queen.nb <- poly2nb(as(spColumbus, "Spatial"), queen = TRUE) #create nb
queen.listw=nb2listw(queen.nb) #convert nb to listw type
queen.columbus= queen.listw
summary(queen.columbus)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 49 
## Number of nonzero links: 236 
## Percentage nonzero weights: 9.829238 
## Average number of links: 4.816327 
## Link number distribution:
## 
##  2  3  4  5  6  7  8  9 10 
##  5  9 12  5  9  3  4  1  1 
## 5 least connected regions:
## 1 6 42 46 47 with 2 links
## 1 most connected region:
## 20 with 10 links
## 
## Weights style: W 
## Weights constants summary:
##    n   nn S0       S1       S2
## W 49 2401 49 22.75119 203.7091
#Ilustrasi Matriks Pembobot
plot(st_geometry(spColumbus), border="white",col='gray', sub="Pembobot Queen Pada Peta Columbus")
coords <- st_coordinates(st_centroid(st_geometry(spColumbus)))
plot(queen.columbus, coords, add = TRUE, col = "red")

Uji Dependensi Spasial

Salah satu cara untuk mengetahui adanya dependensi spasial antar lokasi adalah dengan melakukan uji autokorelasi spasial dengan menggunakan statistik Moran’s I. Autokorelasi spasial adalah taksiran dari korelasi antar nilai amatan yang berkaitan dengan lokasi pada variabel yang sama (Yasin dan Saputra, 2013). Jika terdapat pola sistematik dalam penyebaran sebuah variabel, maka terdapat autokorelasi spasial. Menurut Goodchild (1986), untuk mengetahui apakah ada autokorelasi spasial antar lokasi dapat dilakukan uji autokorelasi spasial dengan menggunakan Moran’s I.

#Moran Test: Pembobot Queen
#Variabel Respon CRIME
moran.test(spColumbus$CRIME,queen.columbus,randomisation=FALSE)
## 
##  Moran I test under normality
## 
## data:  spColumbus$CRIME  
## weights: queen.columbus    
## 
## Moran I statistic standard deviate = 5.6303, p-value = 8.994e-09
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       0.500188557      -0.020833333       0.008563413
moran.plot(spColumbus$CRIME,queen.columbus)

#Variabel Prediktor HOVAL 
moran.test(spColumbus$HOVAL,queen.columbus,randomisation=FALSE)
## 
##  Moran I test under normality
## 
## data:  spColumbus$HOVAL  
## weights: queen.columbus    
## 
## Moran I statistic standard deviate = 2.1713, p-value = 0.01496
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       0.180093114      -0.020833333       0.008563413
moran.plot(spColumbus$HOVAL,queen.columbus)

#Variabel Respon INC
moran.test(spColumbus$INC,queen.columbus,randomisation=FALSE)
## 
##  Moran I test under normality
## 
## data:  spColumbus$INC  
## weights: queen.columbus    
## 
## Moran I statistic standard deviate = 4.7165, p-value = 1.199e-06
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       0.415628778      -0.020833333       0.008563413
moran.plot(spColumbus$INC,queen.columbus)

Pemodelan Regresi Spasial

Model Regresi Linier Berganda

Persamaan: \[ \mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon} \]

#PERSAMAAN REGRESI
reg.eq = CRIME ~ INC + HOVAL
#OLS
reg.OLS=lm(reg.eq,data=spColumbus)
summary(reg.OLS)
## 
## Call:
## lm(formula = reg.eq, data = spColumbus)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -34.418  -6.388  -1.580   9.052  28.649 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  68.6190     4.7355  14.490  < 2e-16 ***
## INC          -1.5973     0.3341  -4.780 1.83e-05 ***
## HOVAL        -0.2739     0.1032  -2.654   0.0109 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11.43 on 46 degrees of freedom
## Multiple R-squared:  0.5524, Adjusted R-squared:  0.5329 
## F-statistic: 28.39 on 2 and 46 DF,  p-value: 9.341e-09
AIC(reg.OLS)
## [1] 382.7545

Uji LM Test

LM Test digunakan untuk deteksi awal efek spasial.

lm.LMtests(reg.OLS,queen.columbus,test=c("LMlag", "LMerr",  "RLMlag", "RLMerr", "SARMA"))
## 
##  Lagrange multiplier diagnostics for spatial dependence
## 
## data:  
## model: lm(formula = reg.eq, data = spColumbus)
## weights: queen.columbus
## 
## LMlag = 8.898, df = 1, p-value = 0.002855
## 
## 
##  Lagrange multiplier diagnostics for spatial dependence
## 
## data:  
## model: lm(formula = reg.eq, data = spColumbus)
## weights: queen.columbus
## 
## LMerr = 5.2062, df = 1, p-value = 0.02251
## 
## 
##  Lagrange multiplier diagnostics for spatial dependence
## 
## data:  
## model: lm(formula = reg.eq, data = spColumbus)
## weights: queen.columbus
## 
## RLMlag = 3.7357, df = 1, p-value = 0.05326
## 
## 
##  Lagrange multiplier diagnostics for spatial dependence
## 
## data:  
## model: lm(formula = reg.eq, data = spColumbus)
## weights: queen.columbus
## 
## RLMerr = 0.043906, df = 1, p-value = 0.834
## 
## 
##  Lagrange multiplier diagnostics for spatial dependence
## 
## data:  
## model: lm(formula = reg.eq, data = spColumbus)
## weights: queen.columbus
## 
## SARMA = 8.9419, df = 2, p-value = 0.01144

Model SCR

Spatial Cross Regressive (SCR) merupakan model regresi spasial, dimana efek spasial melekat pada variabel independen (). Menurut LeSage & Pace (2009) dalam hal pemodelan, variabel lag spasial dari prediktor () dapat berperan langsung dalam menentukan nilai dari variabel dependen ().

Persamaan Model SCR: \[ \mathbf{y} = \mathbf{X} \boldsymbol{\beta} + \mathbf{W} \mathbf{X} \boldsymbol{\gamma} + \mathbf{\epsilon} \]

#SLX (SCR)
reg.SLX=lmSLX(reg.eq,data=spColumbus, queen.columbus)
summary(reg.SLX)
## 
## Call:
## lm(formula = formula(paste("y ~ ", paste(colnames(x)[-1], collapse = "+"))), 
##     data = as.data.frame(x), weights = weights)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -36.342  -7.662  -0.013   7.978  25.572 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  74.5534     6.7156  11.101 2.42e-14 ***
## INC          -1.0974     0.3738  -2.936  0.00528 ** 
## HOVAL        -0.2944     0.1017  -2.896  0.00587 ** 
## lag.INC      -1.3987     0.5601  -2.497  0.01633 *  
## lag.HOVAL     0.2148     0.2079   1.033  0.30712    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.91 on 44 degrees of freedom
## Multiple R-squared:  0.6105, Adjusted R-squared:  0.5751 
## F-statistic: 17.24 on 4 and 44 DF,  p-value: 1.413e-08
#Perhitungan AIC
AIC(reg.SLX)
## [1] 379.9412
AIC(reg.OLS)
## [1] 382.7545
#Perbandingan Model dengan OLS
LR.Sarlm(reg.SLX,reg.OLS) # OLS vs SCR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 6.8133, df = 2, p-value = 0.03315
## sample estimates:
## Log likelihood of reg.SLX Log likelihood of reg.OLS 
##                 -183.9706                 -187.3772

Model SAR

Spatial Autoregressive Model (SAR) disebut juga Spatial Lag Model (SLM) adalah salah satu model spasial dengan pendekatan area dengan memperhitungkan pengaruh spasial lag pada variabel dependen saja. Model ini dinamakan juga Mixed Regressive-Autoregressive karena mengkombinasikan model regresi biasa dengan model regresi spasial lag pada variabel dependen (Anselin, 1988). Persamaan Model SAR: \[ \mathbf{y} = \rho \mathbf{W} \mathbf{y} + \mathbf{X} \boldsymbol{\beta} + \mathbf{\epsilon} \]

#SAR
reg.SAR=lagsarlm(reg.eq,data=spColumbus, queen.columbus)
summary(reg.SAR)
## 
## Call:lagsarlm(formula = reg.eq, data = spColumbus, listw = queen.columbus)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -37.652017  -5.334611   0.071473   6.107196  23.302617 
## 
## Type: lag 
## Coefficients: (asymptotic standard errors) 
##              Estimate Std. Error z value  Pr(>|z|)
## (Intercept) 45.603248   7.257404  6.2837 3.306e-10
## INC         -1.048728   0.307406 -3.4115  0.000646
## HOVAL       -0.266335   0.089096 -2.9893  0.002796
## 
## Rho: 0.42333, LR test value: 9.4065, p-value: 0.0021621
## Asymptotic standard error: 0.11951
##     z-value: 3.5422, p-value: 0.00039686
## Wald statistic: 12.547, p-value: 0.00039686
## 
## Log likelihood: -182.674 for lag model
## ML residual variance (sigma squared): 96.857, (sigma: 9.8416)
## Number of observations: 49 
## Number of parameters estimated: 5 
## AIC: 375.35, (AIC for lm: 382.75)
## LM test for residual autocorrelation
## test value: 0.24703, p-value: 0.61917
#Perhitungan AIC
AIC(reg.SAR)
## [1] 375.3479
AIC(reg.OLS)
## [1] 382.7545
#Perbandingan Model dengan OLS
LR.Sarlm(reg.SAR,reg.OLS) # OLS vs SAR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 9.4065, df = 1, p-value = 0.002162
## sample estimates:
## Log likelihood of reg.SAR Log likelihood of reg.OLS 
##                 -182.6740                 -187.3772

Model SEM

Spatial Error Model (SEM) dapat digunakan saat nilai error pada suatu lokasi berkorelasi dengan nilai error dengan lokasi sekitarnya atau dengan kata lain terdapat korelasi spasial antar error. Pada model SEM, bentuk error pada lokasi i merupakan fungsi dari error pada lokasi j dimana j merupakan suatu lokasi yang terletak disekitar lokasi i. Persamaan model SEM: \[ \mathbf{y} = \mathbf{X} \boldsymbol{\beta} + \mathbf{u}, \qquad \mathbf{u} = \lambda \mathbf{W} \mathbf{u} + \boldsymbol{\epsilon} \]

#SEM
reg.SEM=errorsarlm(reg.eq,data=spColumbus, queen.columbus)
summary(reg.SEM)
## 
## Call:errorsarlm(formula = reg.eq, data = spColumbus, listw = queen.columbus)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -34.65998  -6.16943  -0.70623   7.75392  23.43878 
## 
## Type: error 
## Coefficients: (asymptotic standard errors) 
##              Estimate Std. Error z value  Pr(>|z|)
## (Intercept) 60.279470   5.365594 11.2344 < 2.2e-16
## INC         -0.957305   0.334231 -2.8642 0.0041806
## HOVAL       -0.304559   0.092047 -3.3087 0.0009372
## 
## Lambda: 0.54675, LR test value: 7.2556, p-value: 0.0070679
## Asymptotic standard error: 0.13805
##     z-value: 3.9605, p-value: 7.4786e-05
## Wald statistic: 15.686, p-value: 7.4786e-05
## 
## Log likelihood: -183.7494 for error model
## ML residual variance (sigma squared): 97.674, (sigma: 9.883)
## Number of observations: 49 
## Number of parameters estimated: 5 
## AIC: NA (not available for weighted model), (AIC for lm: 382.75)
#Perhitungan AIC
AIC(reg.SEM)
## [1] 377.4989
AIC(reg.OLS)
## [1] 382.7545
#Perbandingan Model dengan OLS
LR.Sarlm(reg.SEM,reg.OLS) # SEM vs OLS
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 7.2556, df = 1, p-value = 0.007068
## sample estimates:
## Log likelihood of reg.SEM Log likelihood of reg.OLS 
##                 -183.7494                 -187.3772

Model SDM

Spatial Durbin Model (SDM) merupakan model regresi spasial yang memiliki bentuk seperti Spatial Autoregressive Model (SAR) yang memiliki spasial lag pada variabel respon (y). Hanya saja, SDM memiliki ciri khas adanya spasial lag pada variabel prediktor (X) (Anselin, 1988).

Persamaan Model SDM: \[ \mathbf{y} = \rho \mathbf{W} \mathbf{y} + \mathbf{X} \boldsymbol{\beta} + \mathbf{W} \mathbf{X} \boldsymbol{\gamma} + \mathbf{\epsilon} \]

#SDM
reg.SDM=lagsarlm(reg.eq,data=spColumbus, queen.columbus,type="mixed")
summary(reg.SDM)
## 
## Call:lagsarlm(formula = reg.eq, data = spColumbus, listw = queen.columbus, 
##     type = "mixed")
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -37.31199  -6.49556  -0.22971   6.17872  22.74795 
## 
## Type: mixed 
## Coefficients: (asymptotic standard errors) 
##              Estimate Std. Error z value  Pr(>|z|)
## (Intercept) 44.320003  13.045474  3.3973 0.0006804
## INC         -0.919906   0.334742 -2.7481 0.0059941
## HOVAL       -0.297129   0.090416 -3.2863 0.0010153
## lag.INC     -0.583913   0.574224 -1.0169 0.3092140
## lag.HOVAL    0.257684   0.187235  1.3763 0.1687404
## 
## Rho: 0.40346, LR test value: 4.6627, p-value: 0.030825
## Asymptotic standard error: 0.16133
##     z-value: 2.5008, p-value: 0.012392
## Wald statistic: 6.254, p-value: 0.012392
## 
## Log likelihood: -181.6393 for mixed model
## ML residual variance (sigma squared): 93.272, (sigma: 9.6578)
## Number of observations: 49 
## Number of parameters estimated: 7 
## AIC: 377.28, (AIC for lm: 379.94)
## LM test for residual autocorrelation
## test value: 0.36258, p-value: 0.54708
#Perhitungan AIC
AIC(reg.SDM)
## [1] 377.2785
AIC(reg.SAR)
## [1] 375.3479
AIC(reg.SLX)
## [1] 379.9412
AIC(reg.OLS)
## [1] 382.7545
#Perbandingan Model dengan OLS
LR.Sarlm(reg.SDM,reg.OLS) # SDM vs OLS
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 11.476, df = 3, p-value = 0.009412
## sample estimates:
## Log likelihood of reg.SDM Log likelihood of reg.OLS 
##                 -181.6393                 -187.3772
LR.Sarlm(reg.SDM,reg.SAR) # SDM vs SAR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 2.0694, df = 2, p-value = 0.3553
## sample estimates:
## Log likelihood of reg.SDM Log likelihood of reg.SAR 
##                 -181.6393                 -182.6740
LR.Sarlm(reg.SDM,reg.SLX) # SDM vs SCR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 4.6627, df = 1, p-value = 0.03082
## sample estimates:
## Log likelihood of reg.SDM Log likelihood of reg.SLX 
##                 -181.6393                 -183.9706

Model SDEM

Spatial Durbin Error Model (SDEM) merupakan model regresi spasial yang memiliki bentuk seperti Spatial Error Model (SEM) yang memiliki spasial lag pada variabel error (ε). Hanya saja, SDEM memiliki ciri khas adanya spasial lag pada variabel prediktor (X).

Persamaan Model SDEM: \[ \mathbf{y} = \mathbf{X} \boldsymbol{\beta} + \mathbf{W} \mathbf{X} \boldsymbol{\gamma} + \mathbf{u}, \qquad \mathbf{u} = \lambda \mathbf{W} \mathbf{u} + \boldsymbol{\epsilon} \]

#SDEM
reg.SDEM=errorsarlm(reg.eq,data=spColumbus, queen.columbus,etype="emixed")
summary(reg.SDEM)
## 
## Call:errorsarlm(formula = reg.eq, data = spColumbus, listw = queen.columbus, 
##     etype = "emixed")
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -37.180636  -6.588766  -0.091176   6.387284  23.180560 
## 
## Type: error 
## Coefficients: (asymptotic standard errors) 
##              Estimate Std. Error z value  Pr(>|z|)
## (Intercept) 73.645083   8.723875  8.4418 < 2.2e-16
## INC         -1.052258   0.321279 -3.2752  0.001056
## HOVAL       -0.278174   0.091142 -3.0521  0.002272
## lag.INC     -1.204876   0.573642 -2.1004  0.035694
## lag.HOVAL    0.131245   0.207245  0.6333  0.526548
## 
## Lambda: 0.40358, LR test value: 4.3832, p-value: 0.036295
## Asymptotic standard error: 0.16352
##     z-value: 2.4681, p-value: 0.013584
## Wald statistic: 6.0914, p-value: 0.013584
## 
## Log likelihood: -181.779 for error model
## ML residual variance (sigma squared): 93.803, (sigma: 9.6852)
## Number of observations: 49 
## Number of parameters estimated: 7 
## AIC: NA (not available for weighted model), (AIC for lm: 379.94)
#Perhitungan AIC
AIC(reg.SDEM)
## [1] 377.558
AIC(reg.SEM)
## [1] 377.4989
AIC(reg.SLX)
## [1] 379.9412
AIC(reg.OLS)
## [1] 382.7545
#Perbandingan Model dengan OLS
LR.Sarlm(reg.SDEM,reg.OLS) # SDEM vs OLS
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 11.196, df = 3, p-value = 0.01071
## sample estimates:
## Log likelihood of reg.SDEM  Log likelihood of reg.OLS 
##                  -181.7790                  -187.3772
LR.Sarlm(reg.SDEM,reg.SEM) # SDEM vs SAR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 3.9409, df = 2, p-value = 0.1394
## sample estimates:
## Log likelihood of reg.SDEM  Log likelihood of reg.SEM 
##                  -181.7790                  -183.7494
LR.Sarlm(reg.SDEM,reg.SLX) # SDEM vs SCR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 4.3832, df = 1, p-value = 0.03629
## sample estimates:
## Log likelihood of reg.SDEM  Log likelihood of reg.SLX 
##                  -181.7790                  -183.9706

Model SAC atau SARAR

Model SARAR merupakan kombinasi dari model SAR dan SEM.

Persamaan Model SAC: \[ \mathbf{y} = \rho \mathbf{W} \mathbf{y} + \mathbf{X} \boldsymbol{\beta} + \mathbf{u}, \qquad \mathbf{u} = \lambda \mathbf{W} \mathbf{u} + \boldsymbol{\epsilon} \]

#SAC atau SARAR
reg.SAC=sacsarlm(reg.eq,data=spColumbus, queen.columbus, type="sac")
summary(reg.SAC)
## 
## Call:sacsarlm(formula = reg.eq, data = spColumbus, listw = queen.columbus, 
##     type = "sac")
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -37.35601  -5.04457  -0.18999   6.71177  23.28400 
## 
## Type: sac 
## Coefficients: (asymptotic standard errors) 
##              Estimate Std. Error z value  Pr(>|z|)
## (Intercept) 47.915359   9.985548  4.7985 1.599e-06
## INC         -1.042749   0.328628 -3.1730  0.001509
## HOVAL       -0.279841   0.090699 -3.0854  0.002033
## 
## Rho: 0.36937
## Asymptotic standard error: 0.19625
##     z-value: 1.8821, p-value: 0.059817
## Lambda: 0.14642
## Asymptotic standard error: 0.30102
##     z-value: 0.4864, p-value: 0.62668
## 
## LR test value: 9.6444, p-value: 0.0080489
## 
## Log likelihood: -182.555 for sac model
## ML residual variance (sigma squared): 97.043, (sigma: 9.8511)
## Number of observations: 49 
## Number of parameters estimated: 6 
## AIC: 377.11, (AIC for lm: 382.75)
#Perhitungan AIC
AIC(reg.SAC)
## [1] 377.11
AIC(reg.SEM)
## [1] 377.4989
AIC(reg.SAR)
## [1] 375.3479
AIC(reg.OLS)
## [1] 382.7545
#Perbandingan Model dengan OLS
LR.Sarlm(reg.SAC,reg.OLS) # SAC vs OLS
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 9.6444, df = 2, p-value = 0.008049
## sample estimates:
## Log likelihood of reg.SAC Log likelihood of reg.OLS 
##                 -182.5550                 -187.3772
LR.Sarlm(reg.SAC,reg.SEM) # SAC vs SEM
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 2.3888, df = 1, p-value = 0.1222
## sample estimates:
## Log likelihood of reg.SAC Log likelihood of reg.SEM 
##                 -182.5550                 -183.7494
LR.Sarlm(reg.SAC,reg.SAR) # SAC vs SAR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 0.2379, df = 1, p-value = 0.6257
## sample estimates:
## Log likelihood of reg.SAC Log likelihood of reg.SAR 
##                  -182.555                  -182.674

Model Manski

Model ini merupakan model Regresi Spasial paling lengkap. Model ini memuat semua efek spasial pada seluruh komponen model regresi.

Persamaan Model Manski: \[ \mathbf{y} = \rho \mathbf{W} \mathbf{y} + \mathbf{X} \boldsymbol{\beta} + \mathbf{W} \mathbf{X} \boldsymbol{\gamma} + \mathbf{u}, \qquad \mathbf{u} = \lambda \mathbf{W} \mathbf{u} + \boldsymbol{\epsilon} \]

#Manski
reg.Manski=sacsarlm(reg.eq,data=spColumbus, queen.columbus, type="sacmixed") 
summary(reg.Manski)
## 
## Call:sacsarlm(formula = reg.eq, data = spColumbus, listw = queen.columbus, 
##     type = "sacmixed")
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -37.64377  -6.54301  -0.36732   5.95810  22.92013 
## 
## Type: sacmixed 
## Coefficients: (asymptotic standard errors) 
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept) 53.04801   71.85207  0.7383 0.460335
## INC         -0.95880    0.45677 -2.0991 0.035809
## HOVAL       -0.28903    0.10277 -2.8126 0.004915
## lag.INC     -0.77341    1.78153 -0.4341 0.664196
## lag.HOVAL    0.21846    0.29863  0.7316 0.464436
## 
## Rho: 0.28438
## Asymptotic standard error: 0.99595
##     z-value: 0.28553, p-value: 0.77524
## Lambda: 0.16325
## Asymptotic standard error: 1.0908
##     z-value: 0.14966, p-value: 0.88103
## 
## LR test value: 11.594, p-value: 0.020638
## 
## Log likelihood: -181.5801 for sacmixed model
## ML residual variance (sigma squared): 94.485, (sigma: 9.7204)
## Number of observations: 49 
## Number of parameters estimated: 8 
## AIC: 379.16, (AIC for lm: 382.75)

Perbandingan Kinerja Model

Pemilihan model terbaik dapat dilakukan dengan kriteria AIC terkecil.

#Perhitungan AIC
AIC(reg.Manski)
## [1] 379.1603
AIC(reg.SAC)
## [1] 377.11
AIC(reg.SEM)
## [1] 377.4989
AIC(reg.SAR)
## [1] 375.3479
AIC(reg.SDM)
## [1] 377.2785
AIC(reg.SDEM)
## [1] 377.558
AIC(reg.SLX)
## [1] 379.9412
AIC(reg.OLS)
## [1] 382.7545
#Perbandingan dengan Model Regresi Spasial Lainnya
LR.Sarlm(reg.Manski,reg.OLS) # vs OLS
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 11.594, df = 4, p-value = 0.02064
## sample estimates:
## Log likelihood of reg.Manski    Log likelihood of reg.OLS 
##                    -181.5801                    -187.3772
LR.Sarlm(reg.Manski,reg.SEM) # vs SEM
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 4.3386, df = 3, p-value = 0.2271
## sample estimates:
## Log likelihood of reg.Manski    Log likelihood of reg.SEM 
##                    -181.5801                    -183.7494
LR.Sarlm(reg.Manski,reg.SAR) # vs SAR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 2.1877, df = 3, p-value = 0.5344
## sample estimates:
## Log likelihood of reg.Manski    Log likelihood of reg.SAR 
##                    -181.5801                    -182.6740
LR.Sarlm(reg.Manski,reg.SLX) # vs SCR
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 4.7809, df = 2, p-value = 0.09159
## sample estimates:
## Log likelihood of reg.Manski    Log likelihood of reg.SLX 
##                    -181.5801                    -183.9706
LR.Sarlm(reg.Manski,reg.SDM) # vs SDM
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 0.11824, df = 1, p-value = 0.731
## sample estimates:
## Log likelihood of reg.Manski    Log likelihood of reg.SDM 
##                    -181.5801                    -181.6393
LR.Sarlm(reg.Manski,reg.SDEM) # vs SDEM
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 0.39772, df = 1, p-value = 0.5283
## sample estimates:
## Log likelihood of reg.Manski   Log likelihood of reg.SDEM 
##                    -181.5801                    -181.7790
LR.Sarlm(reg.Manski,reg.SAC) # vs SAC
## 
##  Likelihood ratio for spatial linear models
## 
## data:  
## Likelihood ratio = 1.9498, df = 2, p-value = 0.3772
## sample estimates:
## Log likelihood of reg.Manski    Log likelihood of reg.SAC 
##                    -181.5801                    -182.5550

Berdasarkan output dapat disimpulkan bahwa model terbaiknya adalah model SAR karena memiliki nilai AIC terkecil.