[R-sig-Geo] Doubt
Pietro Andre Telatin Paschoalino
p|etro_te|@to @end|ng |rom hotm@||@com
Wed Jul 29 19:59:10 CEST 2020
Professor, thank you very much for the answers.
First issue resolved. Step1c = T means that ρ is estimated via 2SLS instead of GS2SLS, in this case the default of spreg = GS2SLS.
Second: As you can see most of my problems arising due to the estimation of impacts.
As I reported, I was not able to estimate them, because I was having the same error that you discussed here (however, my estimation is done via spreg and not gstslshet):
https://stat.ethz.ch/pipermail/r-sig-geo/2019-January/027068.html
On my last attempt I upgraded to the package under development on R-Forge 1.7-6.
In this case, follow the pattern below that I used to estimate the impacts:
W <- as (as_dgRMatrix_listw (k2.listw), "CsparseMatrix")
trMatc <- trW (W, type = "mult")
effects <- summary (impacts (obj, tr = trMatc, R = 10000), zstats = TRUE, short = TRUE)
effects
Following this structure, in the development version, I can advance a little.
When I estimate a SAC (SARAR) model (with an option for heteroskedacticity) the results seem to be correct, and my results are built through the GSTSLS covariance matrix (practically all significant).
However when I try to verify the same issue for a SAR model, I have the error:
Error in UseMethod ("impacts", obj): no applicable method for 'impacts' applied to an object of class "c ('sphet', 'stsls_sphet')".
One way to estimate was by specifying the spatial package
effects <- summary (spatialreg :: impacts (SARrobust, tr = trMatc, R = 10000), zstats = TRUE, short = TRUE)
however, as I said, for some reason, it is using an IV HAC variance matrix (I don't assign this in my model - which caused me the confusion about the possibility of HAC being applied in all SAR cases):
Another attempt was to use spatialreg::impacts.stsls
I am not sure if it is the way to estimate the impacts, but, again, the matrix used was IV HAC and in this specific case everything becomes insignificant.
Follow my sessionInfo()
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sphet_1.7-6 plm_2.2-3 tseries_0.10-47 lmtest_0.9-37 zoo_1.8-8 car_3.0-8 carData_3.0-4 spdep_1.1-5
[9] sf_0.9-5 maptools_1.0-1 xlsx_0.6.3 rgeos_0.5-3 rgdal_1.5-10 sp_1.4-2 shape_1.4.4 maps_3.3.0
[17] spDataLarge_0.4.1 spatialreg_1.1-5 Matrix_1.2-18 spData_0.3.8
loaded via a namespace (and not attached):
[1] splines_3.6.2 gtools_3.8.2 Formula_1.2-3 Rdpack_0.11-1 expm_0.999-4 TTR_0.23-6 xlsxjars_0.6.1
[8] cellranger_1.1.0 LearnBayes_2.15.1 pillar_1.4.4 lattice_0.20-41 glue_1.4.1 quadprog_1.5-8 digest_0.6.25
[15] sandwich_2.5-1 pkgconfig_2.0.3 bibtex_0.4.2.2 raster_3.3-7 haven_2.3.1 gmodels_2.18.1 purrr_0.3.4
[22] gdata_2.18.0 openxlsx_4.1.5 rio_0.5.16 tibble_3.0.1 generics_0.0.2 ellipsis_0.3.1 maxLik_1.3-8
[29] quantmod_0.4.17 magrittr_1.5 crayon_1.3.4 readxl_1.3.1 deldir_0.1-25 nlme_3.1-142 MASS_7.3-51.4
[36] forcats_0.5.0 xts_0.12-0 foreign_0.8-72 class_7.3-15 tools_3.6.2 data.table_1.12.8 hms_0.5.3
[43] gbRd_0.4-11 lifecycle_0.2.0 stringr_1.4.0 zip_2.0.4 compiler_3.6.2 e1071_1.7-3 rlang_0.4.7
[50] classInt_0.4-3 units_0.6-7 grid_3.6.2 miscTools_0.6-26 rstudioapi_0.11 boot_1.3-23 codetools_0.2-16
[57] abind_1.4-5 DBI_1.1.0 curl_4.3 R6_2.4.1 bdsmatrix_1.3-4 dplyr_1.0.0 KernSmooth_2.23-16
[64] rJava_0.9-12 stringi_1.4.6 Rcpp_1.0.5 vctrs_0.3.1 tidyselect_1.1.0 coda_0.19-3
Thank you.
Pietro Andre Telatin Paschoalino
Doutorando em Ciências Econômicas da Universidade Estadual de Maringá - PCE.
________________________________
De: Roger Bivand <Roger.Bivand using nhh.no>
Enviado: quarta-feira, 29 de julho de 2020 12:16
Para: Pietro Andre Telatin Paschoalino <Pietro_telato using hotmail.com>
Cc: r-sig-geo using r-project.org <r-sig-geo using r-project.org>
Assunto: Re: [R-sig-Geo] Doubt
On Wed, 29 Jul 2020, Pietro Andre Telatin Paschoalino wrote:
> Hello everyone on the list.
>
> I am a PhD student in Brazil and I have some doubts in the area of
> spatial econometrics, if anyone knows and can answer me I would be very
> grateful.
>
> I'm using the spreg function from the sphet package. Sorry if I'm asking
> you an obvious question, but I couldn't solve it simply by looking in
> forums / reading the articles of the area.
>
> Follow:
>
> 1- One of the arguments of the spreg function is called step1c, in this
> case, if I say TRUE, would I be using the efficient estimator of ρ,
> if false, would it just be the consistent estimator? I verified that
> step1c = T, brings me the same result as the gstslshet function.
Please see the section on GMM, subsection spatial error model of:
https://www.jstatsoft.org/article/view/v063i18
>
> 2- I am having problems estimating impact after spreg, depending on the
> versions of my packages, or I have an error (evalue not informed),
> not performing the estimation, or when I can perform it, a HAC
> correction is applied to my standard errors (even if I don't put the
> HAC option on my code) and all my p-values become insignificant
> (which is very strange since my estimators by lmsar or gstsls have
> significant impacts). Would you know to inform me if there is an
> alternative way to calculate the impacts?
Without knowing your current versions, nobody knows. Report the output of
sessionInfo(), preferably for the minimal set of packages needed for a
reproducible example (without tidyverse, which loads 50+ packages that are
not relevant here).
>
> As the HAC was applied to the impacts, I was also in doubt as to whether
> all the correction for heteroscedasticity is being done via HAC, even
> though I did not select this option in the models.
>
Please provide a reproducible example using a built-in data set, posting
in plain text to make copying from your message easier than from HTML,
which often gets garbled.
Roger
> Thank you very much.
>
> Pietro Andre Telatin Paschoalino
>
>
> [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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
[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