[R-sig-Geo] Doubt

Pietro Andre Telatin Paschoalino P|etro_te|@to @end|ng |rom hotm@||@com
Mon Aug 3 18:28:24 CEST 2020


Hello everyone, follow my doubts about the sphet package, related to direct and indirect impacts, and simulation of standard errors.

I will be very grateful if anyone can help me.

follow my code using built-in columbus data.

library(rgdal)
library(sp)
library(raster)
library(rgeos)
library(maptools)
library(spdep)
library (splm)
library(sphet)

data(columbus, package="spdep")
listw <- spdep::nb2listw(col.gal.nb)

attach(columbus)

#i'm going direct to regression by sphet

#SAC (SARAR MODEL)

SAC.robust <- spreg(INC ~ HOVAL+DISCBD+CP, data=columbus, listw, model="sarar", het=TRUE)

#LAG MODEL

SARrobust <- spreg(INC ~ HOVAL+DISCBD+CP, data=columbus, listw, model="lag", het=TRUE)

#going to my questions about the impacts function

#FOR SAC MODEL

> W <- as(as_dgRMatrix_listw(listw), "CsparseMatrix")
Warning message:

Function as_dgRMatrix_listw moved to the spatialreg package

> trMatc <- trW(W, type="mult")

Warning message:
Function trW moved to the spatialreg package

> effects<- summary(impacts(SAC.robust, tr=trMatc, R=10000), zstats=TRUE, short=TRUE)
> effects

========================================================
Simulation results (GSTSLS variance matrix):
========================================================

 #FOR SAR MODEL
>
> effects<- summary(impacts(SARrobust, tr=trMatc, R=10000), zstats=TRUE, short=TRUE)

that gives me:

Error in UseMethod("impacts", obj) :
  no applicable method for 'impacts' applied to an object of class "c('sphet', 'stsls_sphet')"

#how i said the impacts is not computable.

#One way to compute the impacts is by:

effects<- summary(spatialreg::impacts(SARrobust, tr=trMatc, R=10000), zstats=TRUE, short=TRUE)
effects

Impact measures (lag, trace):
========================================================
Simulation results (IV HAC variance matrix):
========================================================

 the simulation of standard errors and p-values is done by IV HAC. (which left me confused because I did not specify such an
#attribute in my regression, leaving me in doubt if the standard errors of the regression had also been corrected with HAC.)

#another option is:

effects<- summary(spatialreg::impacts.stsls(SARrobust, tr=trMatc, R=10000), zstats=TRUE, short=TRUE)
effects

#again simulated through the HAC variance matrix.
#Note: In this case, generally, all p-values were not significant, but using my database, by spatialreg :: impacts, the impacts are
#statistically significant and using spatialreg :: impacts. stsls, they become insignificant.

#follow my sessionInfo (), how i Said, i'm using the version of sphet by R-forge.
>
> sessionInfo ()

R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] sphet_1.7-6    splm_1.4-11    spdep_1.1-5    sf_0.9-5       spData_0.3.8   maptools_1.0-1 rgeos_0.5-3    raster_3.3-7   rgdal_1.5-10
[10] sp_1.4-2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5         bdsmatrix_1.3-4    lattice_0.20-41    deldir_0.1-25      class_7.3-15       zoo_1.8-8          gtools_3.8.2
 [8] digest_0.6.25      lmtest_0.9-37      spDataLarge_0.4.1  R6_2.4.1           coda_0.19-3        e1071_1.7-3        spam_2.5-1
[15] pillar_1.4.4       Rdpack_0.11-1      miscTools_0.6-26   rlang_0.4.7        rstudioapi_0.11    gdata_2.18.0       gmodels_2.18.1
[22] Matrix_1.2-18      splines_3.6.2      stringr_1.4.0      foreign_0.8-72     compiler_3.6.2     pkgconfig_2.0.3    maxLik_1.3-8
[29] tidyselect_1.1.0   tibble_3.0.1       expm_0.999-4       codetools_0.2-16   crayon_1.3.4       dplyr_1.0.0        MASS_7.3-51.4
[36] spatialreg_1.1-5   grid_3.6.2         nlme_3.1-142       lifecycle_0.2.0    DBI_1.1.0          magrittr_1.5       units_0.6-7
[43] ibdreg_0.2.5       bibtex_0.4.2.2     KernSmooth_2.23-16 stringi_1.4.6      plm_2.2-3          LearnBayes_2.15.1  ellipsis_0.3.1
[50] generics_0.0.2     vctrs_0.3.1        boot_1.3-23        sandwich_2.5-1     Formula_1.2-3      tools_3.6.2        glue_1.4.1
[57] purrr_0.3.4        parallel_3.6.2     classInt_0.4-3     gbRd_0.4-11        dotCall64_1.0-0

Thank you.

Pietro Andre Telatin Paschoalino
Doutorando em Ci�ncias Econ�micas da Universidade Estadual de Maring� - PCE.

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>    Virus-free. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list