We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi folks!
I've been thinking about an error in the bivariate moran function and I'd like some help. Below, I replicate it with the guerry shp:
guerry
Ok:
library(rgeoda) library(ggplot2) library(dplyr) library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- sf::st_read(guerry_path) lisa_rgeoda <- rgeoda::queen_weights(guerry) |> rgeoda::local_bimoran(guerry[c("Crm_prp","Wealth")]) mutate( guerry, bv_moran = factor( x = rgeoda::lisa_clusters(lisa_rgeoda), levels = 0:6, labels = rgeoda::lisa_labels(lisa_rgeoda) ) ) |> ggplot() + geom_sf(aes(fill = bv_moran)) + scale_fill_manual(name = "With rgeoda", values = rgeoda::lisa_colors(lisa_rgeoda), drop = F)
Not ok:
set.seed(123) guerry$Crm_prp[sample(1:nrow(guerry), size = 3, replace = T)] <- NA lisa_rgeoda_NA <- rgeoda::queen_weights(guerry) |> rgeoda::local_bimoran(guerry[c("Crm_prp","Wealth")]) mutate( guerry, bv_moran = factor( x = rgeoda::lisa_clusters(lisa_rgeoda_NA), levels = 0:6, labels = rgeoda::lisa_labels(lisa_rgeoda_NA) ) ) |> ggplot() + geom_sf(aes(fill = bv_moran)) + scale_fill_manual(name = "With rgeoda", values = rgeoda::lisa_colors(lisa_rgeoda_NA), drop = F)
Created on 2023-02-19 with reprex v2.0.2
It seems that part of the code is wrong or incomplete, as it does not cover the NAs or the values equal zero (I guess) https://github.com/GeoDaCenter/libgeoda/blob/a9a3d0a3212dfc7cdc63d41f5e8033ba54063693/sa/BiLocalMoran.cpp#L81
Is it wrong if I use na.omit()? Like as: rgeoda::local_bimoran(na.omit(guerry[c("Crm_prp","Wealth")])) like so the map is different.
na.omit()
rgeoda::local_bimoran(na.omit(guerry[c("Crm_prp","Wealth")]))
What I do? thanks
The text was updated successfully, but these errors were encountered:
#31 I think it's the same problem.
Sorry, something went wrong.
No branches or pull requests
Hi folks!
I've been thinking about an error in the bivariate moran function and I'd like some help. Below, I replicate it with the
guerry
shp:Ok:
Not ok:
Created on 2023-02-19 with reprex v2.0.2
It seems that part of the code is wrong or incomplete, as it does not cover the NAs or the values equal zero (I guess)
https://github.com/GeoDaCenter/libgeoda/blob/a9a3d0a3212dfc7cdc63d41f5e8033ba54063693/sa/BiLocalMoran.cpp#L81
Is it wrong if I use
na.omit()
? Like as:rgeoda::local_bimoran(na.omit(guerry[c("Crm_prp","Wealth")]))
like so the map is different.What I do? thanks
The text was updated successfully, but these errors were encountered: