Closed guiblanchet closed 4 months ago
Please see #135 and https://github.com/r-spatial/discuss/issues/62 for ongoing discussions. Maybe try the development version by installing from github, if you do, please report back.
With the github version:
> col005.w.mat <- nb2mat(col005, zero.policy=TRUE)
> col005.w.b <- mat2listw(col005.w.mat)
Warning messages:
1: In mat2listw(col005.w.mat) :
style is M (missing); style should be set to a valid value
2: In mat2listw(col005.w.mat) :
no-neighbour observations found, set zero.policy to TRUE;
this warning will soon become an error
> ?nb2mat
> col005.w.mat <- nb2mat(col005, style="W", zero.policy=TRUE)
> col005.w.b <- mat2listw(col005.w.mat, style="W", zero.policy=TRUE)
> col005.w.b
Characteristics of weights list object:
Neighbour list object:
Number of regions: 49
Number of nonzero links: 170
Percentage nonzero weights: 7.080383
Average number of links: 3.469388
4 regions with no links:
1005 1006 1008 1043
8 disjoint connected subgraphs
Weights style: W
Weights constants summary:
n nn S0 S1 S2
W 45 2025 45 36.82596 187.3873
This is a slightly tricky problem because, if I run the example code of the function :
There are no error. However, when calling the object
col005.w.b
, there is the following error message :Error in print.listw(x) : regions with no neighbours found, use zero.policy=TRUE
Which is odd given that
col005.w.mat
was built withzero.policy=TRUE
.Note also that two warning messages show up when running
col005.w.b <- mat2listw(col005.w.mat)
:Warning messages: 1: In mat2listw(col005.w.mat) : style is M (missing); style should be set to a valid value 2: In mat2listw(col005.w.mat) : no-neighbour observations found, set zero.policy to TRUE; this warning will soon become an error
The first seems to be fine while the second may hint to where the problems may be in the mat2listw function.