Methods for class localsrq
methods_localsrq.Rd
The plot()
function allows the user to plot significant observations.
The print()
function is used to print the number of runs in each localization. Additional information of
expected values and standard deviation, z-value ans p-value is prited for each observation.
Arguments
- x
a
localsrq
object created byQ.test
.- ...
further arguments passed to or from other methods.
- sf
optional argument for
plot()
method to include a sf object (default = NULL)- coor
optional argument for
plot()
method to include coordinates of points (default = NULL)- sig
significant level for each observation in
plot()
method. Defaultsig = 0.05
References
Ruiz, M., López, F., and Páez, A. (2021). A test for global and local homogeneity of categorical data based on spatial runs. working paper.
Author
Fernando López | fernando.lopez@upct.es |
Román Mínguez | roman.minguez@uclm.es |
Antonio Páez | paezha@gmail.com |
Manuel Ruiz | manuel.ruiz@upct.es |
Examples
# Example 1: Local spatial runs test based on knn
library(lwgeom)
N <- 100
cx <- runif(N)
cy <- runif(N)
x <- cbind(cx,cy)
listw <- spdep::knearneigh(cbind(cx,cy), k = 10)
p <- c(1/6,3/6,2/6)
rho <- 0.5
fx <- dgp.spq(p = p, listw = listw, rho = rho)
# Asymtotic version
lsrq <- local.sp.runs.test(fx = fx, listw = listw, alternative = "less")
print(lsrq)
#> runs.i E.i Std.i z.value p.value
#> 1 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 2 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 3 8 7.183838 1.59988 0.5101392 0.6950230217
#> 4 9 7.183838 1.59988 1.1351860 0.8718512930
#> 5 9 7.183838 1.59988 1.1351860 0.8718512930
#> 6 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 7 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 8 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 9 10 7.183838 1.59988 1.7602327 0.9608158220
#> 10 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 11 10 7.183838 1.59988 1.7602327 0.9608158220
#> 12 8 7.183838 1.59988 0.5101392 0.6950230217
#> 13 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 14 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 15 9 7.183838 1.59988 1.1351860 0.8718512930
#> 16 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 17 10 7.183838 1.59988 1.7602327 0.9608158220
#> 18 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 19 10 7.183838 1.59988 1.7602327 0.9608158220
#> 20 10 7.183838 1.59988 1.7602327 0.9608158220
#> 21 3 7.183838 1.59988 -2.6150947 0.0044601364
#> 22 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 23 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 24 4 7.183838 1.59988 -1.9900479 0.0232928297
#> 25 9 7.183838 1.59988 1.1351860 0.8718512930
#> 26 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 27 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 28 9 7.183838 1.59988 1.1351860 0.8718512930
#> 29 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 30 8 7.183838 1.59988 0.5101392 0.6950230217
#> 31 9 7.183838 1.59988 1.1351860 0.8718512930
#> 32 8 7.183838 1.59988 0.5101392 0.6950230217
#> 33 8 7.183838 1.59988 0.5101392 0.6950230217
#> 34 10 7.183838 1.59988 1.7602327 0.9608158220
#> 35 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 36 10 7.183838 1.59988 1.7602327 0.9608158220
#> 37 8 7.183838 1.59988 0.5101392 0.6950230217
#> 38 9 7.183838 1.59988 1.1351860 0.8718512930
#> 39 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 40 4 7.183838 1.59988 -1.9900479 0.0232928297
#> 41 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 42 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 43 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 44 8 7.183838 1.59988 0.5101392 0.6950230217
#> 45 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 46 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 47 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 48 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 49 10 7.183838 1.59988 1.7602327 0.9608158220
#> 50 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 51 8 7.183838 1.59988 0.5101392 0.6950230217
#> 52 8 7.183838 1.59988 0.5101392 0.6950230217
#> 53 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 54 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 55 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 56 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 57 11 7.183838 1.59988 2.3852795 0.9914669250
#> 58 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 59 8 7.183838 1.59988 0.5101392 0.6950230217
#> 60 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 61 3 7.183838 1.59988 -2.6150947 0.0044601364
#> 62 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 63 10 7.183838 1.59988 1.7602327 0.9608158220
#> 64 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 65 8 7.183838 1.59988 0.5101392 0.6950230217
#> 66 9 7.183838 1.59988 1.1351860 0.8718512930
#> 67 4 7.183838 1.59988 -1.9900479 0.0232928297
#> 68 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 69 8 7.183838 1.59988 0.5101392 0.6950230217
#> 70 8 7.183838 1.59988 0.5101392 0.6950230217
#> 71 9 7.183838 1.59988 1.1351860 0.8718512930
#> 72 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 73 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 74 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 75 8 7.183838 1.59988 0.5101392 0.6950230217
#> 76 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 77 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 78 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 79 4 7.183838 1.59988 -1.9900479 0.0232928297
#> 80 9 7.183838 1.59988 1.1351860 0.8718512930
#> 81 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 82 2 7.183838 1.59988 -3.2401414 0.0005973521
#> 83 8 7.183838 1.59988 0.5101392 0.6950230217
#> 84 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 85 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 86 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 87 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 88 4 7.183838 1.59988 -1.9900479 0.0232928297
#> 89 9 7.183838 1.59988 1.1351860 0.8718512930
#> 90 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 91 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 92 8 7.183838 1.59988 0.5101392 0.6950230217
#> 93 4 7.183838 1.59988 -1.9900479 0.0232928297
#> 94 4 7.183838 1.59988 -1.9900479 0.0232928297
#> 95 7 7.183838 1.59988 -0.1149076 0.4542591853
#> 96 10 7.183838 1.59988 1.7602327 0.9608158220
#> 97 5 7.183838 1.59988 -1.3650011 0.0861263477
#> 98 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 99 6 7.183838 1.59988 -0.7399544 0.2296638446
#> 100 7 7.183838 1.59988 -0.1149076 0.4542591853
plot(lsrq, sig = 0.05)