ww_local_getis_ord_g {waywiser} | R Documentation |
Local Getis-Ord G and G* statistic
Description
Calculate the local Getis-Ord G and G* statistic for model residuals.
ww_local_getis_ord_g()
returns the statistic itself, while
ww_local_getis_ord_pvalue()
returns the associated p value.
These functions are meant to help assess model predictions, for instance by
identifying clusters of higher residuals than expected. For statistical
testing and inference applications, use spdep::localG_perm()
instead.
Usage
ww_local_getis_ord_g(data, ...)
ww_local_getis_ord_g_vec(truth, estimate, wt, na_rm = FALSE, ...)
ww_local_getis_ord_g_pvalue(data, ...)
ww_local_getis_ord_g_pvalue_vec(truth, estimate, wt, na_rm = FALSE, ...)
Arguments
data |
A |
... |
Additional arguments passed to |
truth |
The column identifier for the true results
(that is |
estimate |
The column identifier for the predicted
results (that is also |
wt |
A |
na_rm |
A |
Details
These functions can be used for geographic or projected coordinate reference systems and expect 2D data.
Value
A tibble with columns .metric, .estimator, and .estimate and nrow(data)
rows of values.
For _vec()
functions, a numeric vector of length(truth)
(or NA).
References
Ord, J. K. and Getis, A. 1995. Local spatial autocorrelation statistics: distributional issues and an application. Geographical Analysis, 27, 286–306. doi: 10.1111/j.1538-4632.1995.tb00912.x
See Also
Other autocorrelation metrics:
ww_global_geary_c()
,
ww_global_moran_i()
,
ww_local_geary_c()
,
ww_local_moran_i()
Other yardstick metrics:
ww_agreement_coefficient()
,
ww_global_geary_c()
,
ww_global_moran_i()
,
ww_local_geary_c()
,
ww_local_moran_i()
,
ww_willmott_d()
Examples
guerry_model <- guerry
guerry_lm <- lm(Crm_prs ~ Litercy, guerry_model)
guerry_model$predictions <- predict(guerry_lm, guerry_model)
ww_local_getis_ord_g(guerry_model, Crm_prs, predictions)
ww_local_getis_ord_g_pvalue(guerry_model, Crm_prs, predictions)
wt <- ww_build_weights(guerry_model)
ww_local_getis_ord_g_vec(
guerry_model$Crm_prs,
guerry_model$predictions,
wt = wt
)
ww_local_getis_ord_g_pvalue_vec(
guerry_model$Crm_prs,
guerry_model$predictions,
wt = wt
)