#PACKAGE YANG DIPERLUKAN UNTUK SPASIAL
library(tmap)
library(raster)
## Loading required package: sp
library(spdep)
## Loading required package: spData
## To access larger datasets in this package, install the spDataLarge
## package with: `install.packages('spDataLarge',
## repos='https://nowosad.github.io/drat/', type='source')`
## Loading required package: sf
## Linking to GEOS 3.13.0, GDAL 3.10.1, PROJ 9.5.1; sf_use_s2() is TRUE
library(spatialreg)
## Loading required package: Matrix
##
## Attaching package: 'spatialreg'
## The following objects are masked from 'package:spdep':
##
## get.ClusterOption, get.coresOption, get.mcOption,
## get.VerboseOption, get.ZeroPolicyOption, set.ClusterOption,
## set.coresOption, set.mcOption, set.VerboseOption,
## set.ZeroPolicyOption
library(rgdax)
## Loading required package: digest
## Loading required package: jsonlite
## Loading required package: RCurl
## Loading required package: httr
## Loading required package: plyr
#PACKAGE TAMBAHAN UNTUK ASUMSI DAN MEMBACA EXCEL
library(readxl)
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'lmtest'
## The following object is masked from 'package:RCurl':
##
## reset
library(tseries)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(car)
## Loading required package: carData
library(sf)
library(readr)
#INPUT SHP FILE
setwd("C:/Users/anand/Downloads/SEMESTER VI/ADS/Pertemuan 7")
spJatim <- st_read("3SK3_PADS07_03_Ananda_petajatimkab.shp")
## Reading layer `3SK3_PADS07_03_Ananda_petajatimkab' from data source
## `C:\Users\anand\Downloads\SEMESTER VI\ADS\Pertemuan 7\3SK3_PADS07_03_Ananda_petajatimkab.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 38 features and 26 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 110.8984 ymin: -8.780764 xmax: 116.2634 ymax: -5.527337
## CRS: NA
names(spJatim)
## [1] "KODE_KAB" "POLY_ID" "NAMA_KAB" "KODE_PROP" "NAMA_PROP"
## [6] "AKI" "AKBn" "AKB" "BBLR" "PERSALINAN"
## [11] "FE1" "FE13" "PHBS" "JAMBA_EHAT" "AIRLAYAK"
## [16] "RUMAHSEHAT" "MISKIN" "IPM" "AHH" "RLS"
## [21] "PENDUDUK" "LUAS" "KEPADATAN" "KORX" "KORY"
## [26] "CATEGORIES" "geometry"
#Menampilkan Peta Jawa
tm_shape(spJatim) + tm_polygons()

#MATRIKS PEMBOBOT
queen.nb=poly2nb(spJatim) #Pembobot queen
## Warning in poly2nb(spJatim): neighbour object has 2 sub-graphs;
## if this sub-graph count seems unexpected, try increasing the snap argument.
queen.jatim=nb2listw(queen.nb,style="W",zero.policy=TRUE)
#Menyimpan Matriks Pembobot
bobot.queen = listw2mat(queen.jatim) #convert listw to matrix
write.csv(bobot.queen, "3SK3_PADS07_03_Ananda_Matriks Bobot Queen Jatim.csv")
#Memanggil bobot queen yang dimodifikasi
bobot=read_excel("C:/Users/anand/Downloads/SEMESTER VI/ADS/Pertemuan 7/3SK3_PADS07_03_Ananda_Matriks Bobot Queen Jatim_Baru.xlsx")
head(bobot)
## # A tibble: 6 × 38
## V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0 0.5 0.5 0 0 0 0 0 0 0 0 0 0
## 2 0.167 0 0.167 0.167 0 0 0 0 0 0 0 0 0
## 3 0.333 0.333 0 0.333 0 0 0 0 0 0 0 0 0
## 4 0 0.2 0.2 0 0.2 0.2 0 0 0 0 0 0 0
## 5 0 0 0 0.25 0 0.25 0.25 0 0 0 0 0 0
## 6 0 0 0 0.167 0.167 0 0.167 0 0 0 0 0 0
## # ℹ 25 more variables: V14 <dbl>, V15 <dbl>, V16 <dbl>, V17 <dbl>, V18 <dbl>,
## # V19 <dbl>, V20 <dbl>, V21 <dbl>, V22 <dbl>, V23 <dbl>, V24 <dbl>,
## # V25 <dbl>, V26 <dbl>, V27 <dbl>, V28 <dbl>, V29 <dbl>, V30 <dbl>,
## # V31 <dbl>, V32 <dbl>, V33 <dbl>, V34 <dbl>, V35 <dbl>, V36 <dbl>,
## # V37 <dbl>, V38 <dbl>
bobot_modif=as.matrix(bobot)
modif_bobot=mat2listw(bobot_modif,style="W",)
#MORAN TEST: PEMBOBOT QUEEN
moran.test(spJatim$AKI,modif_bobot,randomisation=FALSE, zero.policy = TRUE)
##
## Moran I test under normality
##
## data: spJatim$AKI
## weights: modif_bobot
##
## Moran I statistic standard deviate = -0.3734, p-value = 0.6456
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic Expectation Variance
## -0.07447108 -0.02702703 0.01614416
moran.plot(spJatim$AKI,modif_bobot)

#MENGHITUNG MORAN.MC
moran_mc <- moran.mc(spJatim$AKI,modif_bobot,nsim = 999,zero.policy =
TRUE)
#HISTOGRAM
hist(moran_mc$res,
breaks=30,
col="darkred",
min="",
xlab="",
border="white")
## Warning in plot.window(xlim, ylim, "", ...): "min" is not a graphical parameter
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...): "min"
## is not a graphical parameter
## Warning in axis(1, ...): "min" is not a graphical parameter
## Warning in axis(2, at = yt, ...): "min" is not a graphical parameter
abline(v = moran_mc$statistic,col="green",lwd=2) #garis nilai Moran I Aktual
abline(v = mean(moran_mc$res),col="white",lwd=2)
#NILAI-NILAI STATISTIK
I_obs <- round(moran_mc$statistic,4)
E_I <- round(mean(moran_mc$res),4)
mean_sim <- round(mean(moran_mc$res),4)
sd_sim <- round(sd(moran_mc$res),4)
z_val <- round((I_obs - mean_sim)/sd_sim,4)
#TAMBAH KE GRAFIK HISTOGRAM
mtext(paste0("I: ",I_obs,
" E[I]: ",E_I,
" mean: ",mean_sim,
" sd: ",sd_sim,
" z-value: ",z_val),
side = 1,line = 4,cex = 0.9)

#REGRESI OLS
reg1=lm(spJatim$AKI~spJatim$AHH+spJatim$PERSALINAN+spJatim$FE13+spJatim$
RLS)
summary(reg1)
##
## Call:
## lm(formula = spJatim$AKI ~ spJatim$AHH + spJatim$PERSALINAN +
## spJatim$FE13 + spJatim$RLS)
##
## Residuals:
## Min 1Q Median 3Q Max
## -46.260 -24.421 -8.053 12.755 122.707
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1423.364 349.532 4.072 0.000274 ***
## spJatim$AHH -11.178 4.392 -2.545 0.015790 *
## spJatim$PERSALINAN -5.130 2.202 -2.330 0.026082 *
## spJatim$FE13 -1.060 1.549 -0.684 0.498496
## spJatim$RLS 7.207 5.693 1.266 0.214387
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 37.15 on 33 degrees of freedom
## Multiple R-squared: 0.329, Adjusted R-squared: 0.2476
## F-statistic: 4.045 on 4 and 33 DF, p-value: 0.008897
AIC_reg1 = AIC(reg1) #melihat nilai AIC
AIC_reg1
## [1] 389.2217
#UJI ASUMSI MODEL
#NORMALITAS
res <- reg1$residuals
jarque.bera.test(res)
##
## Jarque Bera Test
##
## data: res
## X-squared = 19.032, df = 2, p-value = 7.365e-05
#HOMOSKEDASTISITAS
bptest(reg1)
##
## studentized Breusch-Pagan test
##
## data: reg1
## BP = 4.955, df = 4, p-value = 0.2919
#NON-MULTIKOLINEARITAS
vif(reg1)
## spJatim$AHH spJatim$PERSALINAN spJatim$FE13 spJatim$RLS
## 2.195182 1.255353 1.494786 2.523349
#IDENTIFIKASI MODEL SPASIAL
uji_lm=lm.LMtests(reg1,modif_bobot,test = "all",zero.policy = T)
## Please update scripts to use lm.RStests in place of lm.LMtests
summary(uji_lm)
## Rao's score (a.k.a Lagrange multiplier) diagnostics for spatial
## dependence
## data:
## model: lm(formula = spJatim$AKI ~ spJatim$AHH + spJatim$PERSALINAN +
## spJatim$FE13 + spJatim$RLS)
## test weights: listw
##
## statistic parameter p.value
## RSerr 4.8330 1 0.02792 *
## RSlag 1.3216 1 0.25031
## adjRSerr 6.2472 1 0.01244 *
## adjRSlag 2.7357 1 0.09813 .
## SARMA 7.5687 2 0.02272 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#SAR
sar <- lagsarlm(spJatim$AKI~spJatim$AHH+spJatim$PERSALINAN+spJatim$FE13+spJatim
$RLS,spJatim,modif_bobot)
summary(sar,Nagelkerke=TRUE)
##
## Call:lagsarlm(formula = spJatim$AKI ~ spJatim$AHH + spJatim$PERSALINAN +
## spJatim$FE13 + spJatim$RLS, data = spJatim, listw = modif_bobot)
##
## Residuals:
## Min 1Q Median 3Q Max
## -42.5086 -22.9357 -7.2721 10.9375 117.5502
##
## Type: lag
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1506.5287 314.7750 4.7860 1.701e-06
## spJatim$AHH -12.1498 3.9716 -3.0592 0.00222
## spJatim$PERSALINAN -4.9299 1.9859 -2.4824 0.01305
## spJatim$FE13 -1.0853 1.3937 -0.7788 0.43611
## spJatim$RLS 6.9722 5.1152 1.3630 0.17287
##
## Rho: -0.29373, LR test value: 1.9941, p-value: 0.15791
## Asymptotic standard error: 0.1683
## z-value: -1.7453, p-value: 0.080938
## Wald statistic: 3.046, p-value: 0.080938
##
## Log likelihood: -187.6138 for lag model
## ML residual variance (sigma squared): 1112, (sigma: 33.346)
## Nagelkerke pseudo-R-squared: 0.36328
## Number of observations: 38
## Number of parameters estimated: 7
## AIC: 389.23, (AIC for lm: 389.22)
## LM test for residual autocorrelation
## test value: 6.9852, p-value: 0.0082187
#UJI HOMOSKEDASTISITAS MODEL TERBAIK
bptest.Sarlm(sar)
##
## studentized Breusch-Pagan test
##
## data:
## BP = 5.3212, df = 4, p-value = 0.2559
#SEM
sem <- errorsarlm(spJatim$AKI~spJatim$AHH+spJatim$PERSALINAN+spJatim$FE13+spJatim$RLS,spJatim,modif_bobot)
summary(sem,Nagelkerke=TRUE)
##
## Call:errorsarlm(formula = spJatim$AKI ~ spJatim$AHH + spJatim$PERSALINAN +
## spJatim$FE13 + spJatim$RLS, data = spJatim, listw = modif_bobot)
##
## Residuals:
## Min 1Q Median 3Q Max
## -43.9282 -19.0980 -3.7339 17.8265 87.2656
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1661.0564 218.9027 7.5881 3.242e-14
## spJatim$AHH -11.8774 2.3827 -4.9849 6.199e-07
## spJatim$PERSALINAN -5.5701 1.3711 -4.0626 4.854e-05
## spJatim$FE13 -2.8076 1.0753 -2.6110 0.009027
## spJatim$RLS 9.0319 3.8446 2.3492 0.018813
##
## Lambda: -0.8194, LR test value: 11.495, p-value: 0.00069799
## Asymptotic standard error: 0.12368
## z-value: -6.6249, p-value: 3.4744e-11
## Wald statistic: 43.89, p-value: 3.4744e-11
##
## Log likelihood: -182.8636 for error model
## ML residual variance (sigma squared): 726.63, (sigma: 26.956)
## Nagelkerke pseudo-R-squared: 0.50413
## Number of observations: 38
## Number of parameters estimated: 7
## AIC: 379.73, (AIC for lm: 389.22)
#UJI HOMOSKEDASTISITAS MODEL TERBAIK
bptest.Sarlm(sem)
##
## studentized Breusch-Pagan test
##
## data:
## BP = 8.5182, df = 4, p-value = 0.07434
#SAC
sac <- sacsarlm(spJatim$AKI~spJatim$AHH+spJatim$PERSALINAN+spJatim$FE13+spJatim$RLS,spJatim,modif_bobot)
summary(sac, Nagelkerke=TRUE)
##
## Call:sacsarlm(formula = spJatim$AKI ~ spJatim$AHH + spJatim$PERSALINAN +
## spJatim$FE13 + spJatim$RLS, data = spJatim, listw = modif_bobot)
##
## Residuals:
## Min 1Q Median 3Q Max
## -38.3508 -19.1480 -4.6708 16.1811 83.2744
##
## Type: sac
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1449.0489 263.0812 5.5080 3.63e-08
## spJatim$AHH -10.0439 2.5992 -3.8643 0.0001114
## spJatim$PERSALINAN -4.8388 1.4124 -3.4259 0.0006127
## spJatim$FE13 -2.8640 1.0100 -2.8357 0.0045730
## spJatim$RLS 8.2539 3.6212 2.2793 0.0226466
##
## Rho: 0.23812
## Asymptotic standard error: 0.18793
## z-value: 1.2671, p-value: 0.20513
## Lambda: -0.90673
## Asymptotic standard error: 0.11106
## z-value: -8.1644, p-value: 2.2204e-16
##
## LR test value: 12.825, p-value: 0.0016412
##
## Log likelihood: -182.1986 for sac model
## ML residual variance (sigma squared): 651.06, (sigma: 25.516)
## Nagelkerke pseudo-R-squared: 0.52119
## Number of observations: 38
## Number of parameters estimated: 8
## AIC: 380.4, (AIC for lm: 389.22)
#UJI HOMOSKEDASTISITAS MODEL TERBAIK
bptest.Sarlm(sac)
##
## studentized Breusch-Pagan test
##
## data:
## BP = 7.9486, df = 4, p-value = 0.09348
#MEMBANDINGKAN MODEL
LR.Sarlm(sem, sac)
##
## Likelihood ratio for spatial linear models
##
## data:
## Likelihood ratio = -1.33, df = 1, p-value = 0.2488
## sample estimates:
## Log likelihood of sem Log likelihood of sac
## -182.8636 -182.1986
Penugasan
#INPUT SHP FILE
setwd("C:/Users/anand/Downloads/SEMESTER VI/ADS/Pertemuan 7")
spJawa <- st_read("3SK3_PADS07_03_Ananda_petajawa.shp")
## Reading layer `3SK3_PADS07_03_Ananda_petajawa' from data source
## `C:\Users\anand\Downloads\SEMESTER VI\ADS\Pertemuan 7\3SK3_PADS07_03_Ananda_petajawa.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 118 features and 25 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 105.0999 ymin: -8.780223 xmax: 116.2702 ymax: -5.042965
## CRS: NA
names(spJawa)
## [1] "zkepadatan" "kepadatan" "kabkota" "kodekab" "Luas"
## [6] "HLS_2021" "IPG_2021" "IDG_2021" "RLS_2021" "UHH_2021"
## [11] "Perkapita_" "IPM_2021" "Laki" "Perempuan" "Penduduk"
## [16] "Persen2021" "Persen2022" "Jumlah2021" "Jumlah2022" "Lat_Pusat"
## [21] "Long_Pusat" "Lat_cntrd" "Long_cntrd" "MORAN_STD" "MORAN_LAG"
## [26] "geometry"
#Menampilkan Peta Jawa
tm_shape(spJawa) + tm_polygons()

#MATRIKS PEMBOBOT
queen.nb=poly2nb(spJawa) #Pembobot queen
## Warning in poly2nb(spJawa): neighbour object has 2 sub-graphs;
## if this sub-graph count seems unexpected, try increasing the snap argument.
queen.jawa=nb2listw(queen.nb,style="W",zero.policy=TRUE)
#Menyimpan Matriks Pembobot
bobot.queen = listw2mat(queen.jawa) #convert listw to matrix
write.csv(bobot.queen, "3SK3_PADS07_03_Ananda_Matriks Bobot Queen Jawa.csv")
#Memanggil bobot queen yang dimodifikasi
bobot=read_excel("C:/Users/anand/Downloads/SEMESTER VI/ADS/Pertemuan 7/3SK3_PADS07_03_Ananda_Matriks Bobot Queen Jawa_Baru.xlsx")
head(bobot)
## # A tibble: 6 × 118
## V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0 0.143 0 0 0 0 0 0 0 0 0 0 0
## 2 0.167 0 0 0 0 0 0 0 0 0 0 0 0
## 3 0 0 0 0 0 0 0 0 0 0 0 0 0
## 4 0 0 0 0 0 0.167 0 0.167 0 0 0 0 0
## 5 0 0 0 0 0 0 0 0 0 0 0 0 0
## 6 0 0 0 0.143 0 0 0 0 0 0 0 0 0
## # ℹ 105 more variables: V14 <dbl>, V15 <dbl>, V16 <dbl>, V17 <dbl>, V18 <dbl>,
## # V19 <dbl>, V20 <dbl>, V21 <dbl>, V22 <dbl>, V23 <dbl>, V24 <dbl>,
## # V25 <dbl>, V26 <dbl>, V27 <dbl>, V28 <dbl>, V29 <dbl>, V30 <dbl>,
## # V31 <dbl>, V32 <dbl>, V33 <dbl>, V34 <dbl>, V35 <dbl>, V36 <dbl>,
## # V37 <dbl>, V38 <dbl>, V39 <dbl>, V40 <dbl>, V41 <dbl>, V42 <dbl>,
## # V43 <dbl>, V44 <dbl>, V45 <dbl>, V46 <dbl>, V47 <dbl>, V48 <dbl>,
## # V49 <dbl>, V50 <dbl>, V51 <dbl>, V52 <dbl>, V53 <dbl>, V54 <dbl>, …
bobot_modif=as.matrix(bobot)
modif_bobot=mat2listw(bobot_modif,style="W",)
#MORAN TEST: PEMBOBOT QUEEN
moran.test(spJawa$Persen2021,modif_bobot,randomisation=FALSE,
zero.policy = TRUE)
##
## Moran I test under normality
##
## data: spJawa$Persen2021
## weights: modif_bobot
##
## Moran I statistic standard deviate = 6.7894, p-value = 5.632e-12
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic Expectation Variance
## 0.447298816 -0.008547009 0.004507950
moran.plot(spJawa$Persen2021,modif_bobot)

#MENGHITUNG MORAN.MC
moran_mc <- moran.mc(spJawa$Persen2021,modif_bobot,nsim = 999,zero.policy = TRUE)
#HISTOGRAM
hist(moran_mc$res,
breaks=30,
col="darkred",
min="",
xlab="",
border="white")
## Warning in plot.window(xlim, ylim, "", ...): "min" is not a graphical parameter
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...): "min"
## is not a graphical parameter
## Warning in axis(1, ...): "min" is not a graphical parameter
## Warning in axis(2, at = yt, ...): "min" is not a graphical parameter
abline(v = moran_mc$statistic,col="green",lwd=2) #garis nilai Moran I Aktual
abline(v = mean(moran_mc$res),col="white",lwd=2)
#NILAI-NILAI STATISTIK
I_obs <- round(moran_mc$statistic,4)
E_I <- round(mean(moran_mc$res),4)
mean_sim <- round(mean(moran_mc$res),4)
sd_sim <- round(sd(moran_mc$res),4)
z_val <- round((I_obs - mean_sim)/sd_sim,4)
#TAMBAH KE GRAFIK HISTOGRAM
mtext(paste0("I: ",I_obs,
" E[I]: ",E_I,
" mean: ",mean_sim,
" sd: ",sd_sim,
" z-value: ",z_val),
side = 1,line = 4,cex = 0.9)

#REGRESI OLS
reg_1=lm(spJawa$Persen2021~spJawa$RLS_2021)
summary(reg_1)
##
## Call:
## lm(formula = spJawa$Persen2021 ~ spJawa$RLS_2021)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.5914 -1.9282 -0.2212 1.6376 9.2085
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 26.5537 1.4050 18.90 <2e-16 ***
## spJawa$RLS_2021 -1.9271 0.1636 -11.78 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.845 on 116 degrees of freedom
## Multiple R-squared: 0.5446, Adjusted R-squared: 0.5406
## F-statistic: 138.7 on 1 and 116 DF, p-value: < 2.2e-16
AIC_reg_1 = AIC(reg_1) #melihat nilai AIC
AIC_reg_1
## [1] 585.6171
#UJI ASUMSI MODEL
#NORMALITAS
res <- reg_1$residuals
jarque.bera.test(res)
##
## Jarque Bera Test
##
## data: res
## X-squared = 6.7634, df = 2, p-value = 0.03399
#HOMOSKEDASTISITAS
bptest(reg_1)
##
## studentized Breusch-Pagan test
##
## data: reg_1
## BP = 6.5841, df = 1, p-value = 0.01029
#IDENTIFIKASI MODEL SPASIAL
uji_lm <- lm.LMtests(reg_1,modif_bobot,test = "all", zero.policy = TRUE)
## Please update scripts to use lm.RStests in place of lm.LMtests
summary(uji_lm)
## Rao's score (a.k.a Lagrange multiplier) diagnostics for spatial
## dependence
## data:
## model: lm(formula = spJawa$Persen2021 ~ spJawa$RLS_2021)
## test weights: listw
##
## statistic parameter p.value
## RSerr 28.55743 1 9.096e-08 ***
## RSlag 15.99188 1 6.361e-05 ***
## adjRSerr 12.72620 1 0.0003606 ***
## adjRSlag 0.16064 1 0.6885702
## SARMA 28.71807 2 5.807e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#SEM
sem <- errorsarlm(spJawa$Persen2021~spJawa$RLS,data=spJawa, modif_bobot, zero.policy = TRUE)
summary(sem,Nagelkerke=TRUE)
##
## Call:errorsarlm(formula = spJawa$Persen2021 ~ spJawa$RLS, data = spJawa,
## listw = modif_bobot, zero.policy = TRUE)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.26637 -1.52394 -0.25458 1.55197 7.76906
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 26.08450 1.58470 16.460 < 2.2e-16
## spJawa$RLS -1.84778 0.17421 -10.607 < 2.2e-16
##
## Lambda: 0.4737, LR test value: 22.926, p-value: 1.6835e-06
## Asymptotic standard error: 0.095851
## z-value: 4.9421, p-value: 7.7305e-07
## Wald statistic: 24.424, p-value: 7.7305e-07
##
## Log likelihood: -278.3455 for error model
## ML residual variance (sigma squared): 6.1865, (sigma: 2.4873)
## Nagelkerke pseudo-R-squared: 0.62498
## Number of observations: 118
## Number of parameters estimated: 4
## AIC: 564.69, (AIC for lm: 585.62)
#UJI HOMOSKEDASTISITAS MODEL TERBAIK
bptest.Sarlm(sem)
##
## studentized Breusch-Pagan test
##
## data:
## BP = 6.678, df = 1, p-value = 0.009761