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.
.
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: 2
#>
#> Index of spatial observations excluded: 44 33
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
#> Warning: style is M (missing); style should be set to a valid value
#> Warning: no-neighbour observations found, set zero.policy to TRUE;
#> this warning will soon become an error
#> Warning: neighbour object has 2 sub-graphs
print(msurr_points)
#> [,1] [,2] [,3] [,4]
#> [1,] 1 63 40 37
#> [2,] 6 73 28 14
#> [3,] 7 18 98 94
#> [4,] 8 87 39 21
#> [5,] 9 12 64 99
#> [6,] 10 31 52 4
#> [7,] 16 62 9 12
#> [8,] 17 20 27 98
#> [9,] 22 58 41 50
#> [10,] 23 2 85 45
#> [11,] 25 11 44 4
#> [12,] 27 55 93 47
#> [13,] 28 14 8 87
#> [14,] 32 80 48 70
#> [15,] 33 30 16 62
#> [16,] 35 84 6 66
#> [17,] 39 21 10 52
#> [18,] 40 37 59 29
#> [19,] 41 50 72 26
#> [20,] 42 61 33 99
#> [21,] 44 15 83 38
#> [22,] 48 70 60 43
#> [23,] 49 77 42 33
#> [24,] 52 36 49 77
#> [25,] 53 81 76 19
#> [26,] 54 3 57 56
#> [27,] 56 67 25 11
#> [28,] 57 5 78 51
#> [29,] 59 29 75 54
#> [30,] 60 43 100 17
#> [31,] 64 97 90 53
#> [32,] 65 95 74 51
#> [33,] 71 34 79 69
#> [34,] 72 46 35 66
#> [35,] 74 51 71 79
#> [36,] 75 86 54 3
#> [37,] 76 19 7 18
#> [38,] 78 13 56 82
#> [39,] 79 69 32 80
#> [40,] 82 88 96 91
#> [41,] 83 38 82 96
#> [42,] 85 45 22 90
#> [43,] 90 24 53 81
#> [44,] 93 47 23 19
#> [45,] 96 91 65 95
#> [46,] 98 94 89 99
#> [47,] 100 68 17 20
# 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 = .2))
#>
#> Threshold distance: 21090.24
#> Number of m-surroundings excluded for exceeding
#> the threshold distance: 6
#>
#> Index of spatial observations excluded: 20 141 110 64 90 111
plot(msurr_points, type = 1)
plot(msurr_points, type = 2)
#> Warning: style is M (missing); style should be set to a valid value
#> Warning: no-neighbour observations found, set zero.policy to TRUE;
#> this warning will soon become an error
#> Warning: neighbour object has 32 sub-graphs
print(msurr_points)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 1 180 675 719 471 294
#> [2,] 10 627 865 123 262 237
#> [3,] 12 160 495 729 18 363
#> [4,] 14 602 552 487 305 619
#> [5,] 16 325 637 103 515 538
#> [6,] 17 555 156 190 837 711
#> [7,] 23 741 640 158 709 335
#> [8,] 32 502 167 303 383 657
#> [9,] 33 230 337 458 786 348
#> [10,] 39 352 693 615 402 469
#> [11,] 40 807 745 496 592 512
#> [12,] 52 65 520 793 274 261
#> [13,] 55 486 628 168 272 572
#> [14,] 63 738 612 186 53 796
#> [15,] 74 721 751 48 165 500
#> [16,] 78 365 668 200 857 170
#> [17,] 79 270 688 46 144 676
#> [18,] 81 650 791 694 362 391
#> [19,] 83 235 665 570 90 716
#> [20,] 95 869 289 260 395 12
#> [21,] 100 710 364 534 8 805
#> [22,] 102 386 253 163 553 132
#> [23,] 107 484 497 506 795 593
#> [24,] 110 809 490 370 238 812
#> [25,] 111 715 463 147 454 440
#> [26,] 117 644 202 417 2 746
#> [27,] 132 189 873 269 264 52
#> [28,] 134 188 722 255 623 382
#> [29,] 136 234 87 639 28 522
#> [30,] 137 214 725 863 687 329
#> [31,] 141 251 450 278 119 143
#> [32,] 142 451 27 444 452 332
#> [33,] 143 774 344 851 291 142
#> [34,] 151 775 286 442 459 819
#> [35,] 155 201 811 410 276 768
#> [36,] 157 678 330 736 523 136
#> [37,] 170 306 241 519 376 691
#> [38,] 173 772 465 724 326 327
#> [39,] 178 75 243 606 408 432
#> [40,] 179 384 815 603 30 107
#> [41,] 194 328 149 246 282 755
#> [42,] 199 467 232 340 730 686
#> [43,] 208 699 601 648 824 778
#> [44,] 209 642 397 752 509 483
#> [45,] 210 731 181 427 227 871
#> [46,] 213 629 547 409 172 414
#> [47,] 221 153 477 797 584 594
#> [48,] 224 379 380 794 518 505
#> [49,] 226 61 122 607 617 765
#> [50,] 231 67 804 428 692 418
#> [51,] 237 462 62 308 406 460
#> [52,] 250 96 806 876 498 32
#> [53,] 261 293 705 89 779 55
#> [54,] 263 240 563 390 742 17
#> [55,] 267 265 643 521 312 782
#> [56,] 273 401 726 697 366 347
#> [57,] 275 543 858 683 268 110
#> [58,] 287 577 566 590 249 540
#> [59,] 294 707 700 470 839 117
#> [60,] 310 827 501 759 760 645
#> [61,] 321 735 169 571 389 95
#> [62,] 327 466 80 207 681 754
#> [63,] 332 713 50 316 732 453
#> [64,] 335 801 749 545 856 287
#> [65,] 338 26 457 712 191 785
#> [66,] 341 734 359 441 456 355
#> [67,] 347 217 69 526 413 531
#> [68,] 348 449 112 445 666 194
#> [69,] 350 88 872 280 120 714
#> [70,] 353 4 66 236 407 717
#> [71,] 355 258 698 455 176 151
#> [72,] 360 614 524 218 29 631
#> [73,] 363 13 508 840 161 517
#> [74,] 382 318 434 776 802 854
#> [75,] 391 790 315 424 334 426
#> [76,] 398 661 42 233 541 798
#> [77,] 414 670 301 557 15 780
#> [78,] 418 472 24 558 562 263
#> [79,] 421 816 349 20 689 625
#> [80,] 422 9 662 356 309 771
#> [81,] 425 850 756 247 400 422
#> [82,] 426 747 73 252 140 421
#> [83,] 431 54 579 877 702 573
#> [84,] 432 223 11 581 419 777
#> [85,] 440 664 175 852 703 875
#> [86,] 453 528 378 43 279 33
#> [87,] 460 7 580 196 94 431
#> [88,] 479 31 346 41 847 480
#> [89,] 480 808 388 38 304 481
#> [90,] 481 482 762 684 826 860
#> [91,] 483 131 339 116 229 63
#> [92,] 500 764 166 559 373 310
#> [93,] 503 51 393 870 504 321
#> [94,] 505 744 47 367 706 209
#> [95,] 510 750 285 737 507 250
#> [96,] 512 511 766 862 57 224
#> [97,] 514 608 130 842 513 40
#> [98,] 516 3 660 845 550 16
#> [99,] 517 728 159 533 544 635
#> [100,] 522 867 342 848 846 773
#> [101,] 529 622 412 93 248 398
#> [102,] 531 784 527 377 177 633
#> [103,] 538 682 369 19 546 574
#> [104,] 540 833 535 211 589 799
#> [105,] 564 813 86 187 651 78
#> [106,] 569 113 198 656 127 598
#> [107,] 574 723 385 708 228 100
#> [108,] 576 22 374 561 6 646
#> [109,] 583 298 599 853 290 770
#> [110,] 586 56 493 492 71 859
#> [111,] 593 97 613 403 575 221
#> [112,] 594 105 753 396 35 208
#> [113,] 598 183 636 604 109 83
#> [114,] 609 435 767 25 197 353
#> [115,] 611 242 696 476 182 609
#> [116,] 619 372 411 203 647 586
#> [117,] 625 420 205 663 333 350
#> [118,] 631 49 296 653 690 866
#> [119,] 632 836 212 560 761 102
#> [120,] 633 361 37 838 525 529
#> [121,] 635 491 658 834 256 275
#> [122,] 645 106 585 596 610 510
#> [123,] 646 254 192 277 437 583
#> [124,] 649 621 85 415 371 831
#> [125,] 657 488 133 792 489 479
#> [126,] 676 787 145 98 820 81
#> [127,] 677 311 108 781 551 576
#> [128,] 679 72 121 667 874 137
#> [129,] 686 283 148 36 672 173
#> [130,] 691 548 295 841 118 14
#> [131,] 704 114 473 669 605 178
#> [132,] 711 216 185 164 740 213
#> [133,] 714 336 433 701 44 273
#> [134,] 716 204 154 828 624 829
#> [135,] 717 319 21 436 128 677
#> [136,] 746 323 76 416 245 231
#> [137,] 754 468 150 324 626 111
#> [138,] 755 464 641 822 271 199
#> [139,] 763 499 630 743 58 74
#> [140,] 765 849 68 152 600 763
#> [141,] 768 5 532 810 368 134
#> [142,] 770 101 554 381 307 632
#> [143,] 771 99 138 817 394 788
#> [144,] 773 45 193 443 673 360
#> [145,] 777 300 595 461 591 10
#> [146,] 778 478 314 659 823 825
#> [147,] 780 375 239 206 184 814
#> [148,] 782 162 104 297 783 157
#> [149,] 785 821 392 195 266 141
#> [150,] 788 343 284 139 423 210
#> [151,] 789 818 225 685 174 91
#> [152,] 796 115 588 597 843 226
#> [153,] 798 345 568 59 864 569
#> [154,] 799 652 674 126 769 832
#> [155,] 803 357 475 399 125 704
#> [156,] 805 537 313 835 536 649
#> [157,] 812 34 135 582 844 514
#> [158,] 814 556 549 302 171 564
#> [159,] 819 638 259 634 733 79
#> [160,] 825 618 695 215 578 503
#> [161,] 829 565 82 830 542 23
#> [162,] 831 539 855 320 758 155
#> [163,] 832 387 654 60 757 516
#> [164,] 854 288 222 124 474 803
#> [165,] 859 868 620 485 292 179
#> [166,] 860 429 530 680 220 267
#> [167,] 866 671 439 446 748 338
#> [168,] 871 64 351 299 430 679
#> [169,] 875 448 146 447 317 341