Method for class m_surr
methods_m_surr.Rd
A function to plots the m-surrounds give an object of the
class m_surr obtain with the code m.surround
.
The plot()
function allows the user view the configuration of the m-surroundings.
The argument type
select the type o visualization.
The print()
print the matrix of the m-surrounding.
.
The summary
give information about the characteristics of the m-surroundings.
.
Arguments
- object
object of class m_surr. 2 plot W matrix with network
- ...
further arguments passed to or from other methods.
- x
object of class m_surr
- type
numeric. 1 (default) to get the plot with igraph.
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: Obtain m-surroundings with degree of overlapping r
N <- 100
cx <- runif(N)
cy <- runif(N)
x <- cbind(cx,cy)
m = 4
r = 2
msurr_points <- m.surround(x = x, m = m, r = r,control = list(dtmaxabs = 0.5))
#>
#> Threshold distance: 0.5
#> Number of m-surroundings excluded for exceeding
#> the threshold distance: 1
#>
#> Index of spatial observations excluded: 45
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
print(msurr_points)
#> [,1] [,2] [,3] [,4]
#> [1,] 1 10 64 44
#> [2,] 2 88 9 74
#> [3,] 3 54 13 65
#> [4,] 5 37 21 57
#> [5,] 6 77 97 32
#> [6,] 7 66 62 44
#> [7,] 8 38 91 17
#> [8,] 9 18 100 74
#> [9,] 13 65 96 39
#> [10,] 15 20 72 90
#> [11,] 16 48 15 43
#> [12,] 21 57 58 18
#> [13,] 22 19 67 77
#> [14,] 24 25 30 73
#> [15,] 29 11 75 46
#> [16,] 30 73 56 53
#> [17,] 32 45 82 93
#> [18,] 39 71 5 37
#> [19,] 43 50 90 35
#> [20,] 44 95 24 3
#> [21,] 49 86 87 22
#> [22,] 51 26 32 45
#> [23,] 52 92 61 23
#> [24,] 55 36 52 23
#> [25,] 56 53 83 63
#> [26,] 58 34 2 74
#> [27,] 59 28 94 14
#> [28,] 60 33 29 95
#> [29,] 61 23 89 86
#> [30,] 62 85 44 24
#> [31,] 64 84 60 95
#> [32,] 67 12 69 39
#> [33,] 69 41 3 13
#> [34,] 70 76 7 66
#> [35,] 72 47 43 90
#> [36,] 75 46 70 7
#> [37,] 78 31 6 97
#> [38,] 81 98 8 38
#> [39,] 82 4 93 99
#> [40,] 83 63 59 28
#> [41,] 87 68 22 19
#> [42,] 89 40 49 86
#> [43,] 90 35 55 61
#> [44,] 91 17 78 31
#> [45,] 94 14 16 40
#> [46,] 96 42 39 37
#> [47,] 97 27 51 32
#> [48,] 100 74 81 98
# Example 2:
data("FastFood.sf")
m = 6
r = 1
msurr_points <- m.surround(x = FastFood.sf, m = m, r = r, distance = "Euclidean",
control = list(dtmaxpc = .01))
#> Warning: bounding box has potentially an invalid value range for longlat data
#>
#> Threshold distance: 1054.512
#> Number of m-surroundings excluded for exceeding
#> the threshold distance: 154
#>
#> Index of spatial observations excluded: 6 12 19 25 27 29 32 36 40 46 49 55 57 58 59 60 61 63 74 75 80 83 85 86 88 89 91 100 101 102 105 110 111 112 113 118 119 120 122 123 124 125 128 131 137 138 143 144 147 150 151 155 156 157 160 164 165 168 171 173 174 2 3 5 7 8 17 20 21 22 23 24 33 34 38 51 54 62 64 65 68 69 76 77 78 98 99 103 107 109 114 115 126 132 133 135 139 140 141 149 154 159 161 162 163 167 170 172 175 9 13 16 26 31 35 37 39 41 43 47 52 56 67 70 71 73 79 92 93 106 121 134 136 153 166 4 42 53 66 72 82 84 87 90 96 142 148 18 28 30 81 108 129 152
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
#> Warning: bounding box has potentially an invalid value range for longlat data
print(msurr_points)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 1 180 675 719 471 294
#> [2,] 39 352 693 615 402 469
#> [3,] 40 807 745 496 592 512
#> [4,] 63 738 612 186 53 796
#> [5,] 74 721 751 48 165 500
#> [6,] 208 699 601 648 824 778
#> [7,] 209 642 397 752 509 483
#> [8,] 221 153 477 797 584 594
#> [9,] 226 61 122 607 617 765
#> [10,] 483 131 339 116 229 63
#> [11,] 500 764 166 559 373 310
#> [12,] 505 744 47 367 706 209
#> [13,] 529 622 412 93 248 398
#> [14,] 593 97 613 403 575 221
#> [15,] 594 105 753 396 35 208
#> [16,] 645 106 585 596 610 510
#> [17,] 657 488 133 792 489 479
#> [18,] 763 499 630 743 58 74
#> [19,] 765 849 68 152 600 763
#> [20,] 796 115 588 597 843 226
#> [21,] 832 387 654 60 757 516