Closed swaheera closed 1 year ago
You need to use zero.policy = TRUE
every time you use a probably defective neighbour or spatial weights object. You can also set an option for the current session, set.ZeroPolicyOption
, https://r-spatial.github.io/spdep/reference/set.spChkOption.html, if you really intend to proceed with no-neighbour observations, then all functions will act as if the argument zero.policy = TRUE
has been used (default FALSE). Tests in spdep
do by default adjust n
for the consequences of no-neighbour observations, but other implementations vary in how they handle this poorly-studied problem.
@rsbivand : thank you so much for your reply!
In my example, can you please recommend how to use this option? For example
set.ZeroPolicyOption(nb)
Is this correct?
Thanks!
set.ZeroPolicyOption(TRUE)
sets the arguments to TRUE for all functions.
Hi R> library("spdep") R> W.nb <- poly2nb(WBSF, row.names = WBSF$ID_B)
When I run the above mention code for spatio-temporal models (trying to create neighbourhood matrix W), the following error is occurred:
Error in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, : Loop 0 is not valid: Edge 3680 has duplicate vertex with edge 3683
How to resolve the problem? Thanks!
Do not join an irrelant issue, start another if, having read https://r-spatial.github.io/spdep/reference/poly2nb.html#note-1, you cannot solve this yourself (your input geometry in in ellipsoidal coordinates, see also https://r-spatial.org/book/04-Spherical.html). If still stuck, create a new issue with a minimal reproducible example.
Bonsoir, j ai eu un probleme apres executé le code suivant: nb <- poly2nb(Carte, row.names = SMR.av$CODE) , list.nb <- nb2listw(nb, style = "B", zero.policy = TRUE)
print(list.nb) Error in print.listw(list.nb) : regions with no neighbours found, use zero.policy=TRUE
comment dois je resoudre ce probleme?
Bonsoir, j'ai exécuté le code suivant: list.nb <- nb2listw(nb, style = "B", zero.policy = TRUE) et le message suivant s'affiche: print(list.nb) Error in print.listw(list.nb) : regions with no neighbours found, use zero.policy=TRUE. Aidez moi, svp a resoudre ce probleme. Merci
See #128 #129
Hello!
I am running the following code:
lw <- nb2listw(nb, style="W", zero.policy=TRUE)
But I am getting this error:
However, I have already specified zero.policy = TRUE?
Am I doing something wrong?
Thanks!