Moran's I and LISA cluster map for an interpolated variable
Source:R/diagnostics-spatial.R
plot_moran.RdComputes global Moran's I and optionally maps Local Indicators of Spatial Association (LISA) clusters for an interpolated variable.
Usage
plot_moran(
result,
variable = NULL,
type = c("lisa", "moran"),
quantity = "pct_tract",
significance = 0.05,
nsim = 999L,
...
)Arguments
- result
An
interpElections_resultobject.- variable
Variable to analyze. Accepts column name, ballot number, candidate name, or party abbreviation.
- type
Character.
"moran"for the Moran scatterplot, or"lisa"for the LISA cluster map. Default:"lisa".- quantity
Quantity to analyze:
"pct_tract"(default),"absolute","pct_muni","pct_valid","pct_eligible","density". The default"pct_tract"divides raw vote counts by tract turnout, revealing political preference patterns rather than population density patterns. Matches the default ofplot.interpElections_result().- significance
Significance level for LISA. Default: 0.05.
- nsim
Number of permutations for LISA significance testing (conditional permutation test via
spdep::localmoran_perm()). Default: 999. Only used whentype = "lisa".- ...
Ignored.