Skip to contents

Computes Moran's Eigenvector Maps (MEMs) using mem() at multiple distance thresholds and combines them into a single data frame. This creates spatial predictors capturing patterns at different spatial scales.

Usage

mem_multithreshold(
  distance.matrix = NULL,
  distance.thresholds = NULL,
  max.spatial.predictors = NULL
)

Arguments

distance.matrix

Numeric distance matrix between spatial locations.

distance.thresholds

Numeric vector of distance thresholds. Each threshold defines the maximum distance for spatial neighbors at that scale. Default: NULL (automatically computed with default_distance_thresholds()).

max.spatial.predictors

Integer specifying the maximum number of spatial predictors to return. If the total number of MEMs exceeds this value, only the first max.spatial.predictors columns are returned. Default: NULL (no limit).

Value

Data frame with one row per observation (matching distance.matrix dimensions) and columns representing MEMs at different distance thresholds. Column names follow the pattern spatial_predictor_<threshold>_<number> (e.g., "spatial_predictor_0_1", "spatial_predictor_1000_2").

Details

This function generates spatial predictors at multiple spatial scales by computing MEMs at different distance thresholds. Different thresholds capture spatial patterns at different scales:

  • Smaller thresholds (e.g., 0) capture fine-scale spatial patterns

  • Larger thresholds capture broad-scale spatial patterns

Algorithm:

  1. For each distance threshold, calls mem() to compute MEMs

  2. Each mem() call applies the threshold, double-centers the matrix, and extracts positive eigenvectors

  3. Combines all MEMs into a single data frame

  4. Optionally limits the total number of predictors with max.spatial.predictors

The resulting MEMs are used as spatial predictors in rf_spatial() to model spatial autocorrelation at multiple scales simultaneously.

Examples

data(plants_distance)

# Compute MEMs for multiple distance thresholds
mems <- mem_multithreshold(
  distance.matrix = plants_distance,
  distance.thresholds = c(0, 1000, 5000)
)

# View structure
head(mems)
#>   spatial_predictor_0_1 spatial_predictor_0_2 spatial_predictor_0_3
#> 1          -0.025921732           0.005220262           -0.04169686
#> 2          -0.099667898           0.053971309           -0.13244795
#> 3          -0.001047654          -0.014304635            0.04436019
#> 4          -0.016569475           0.004799116           -0.03074566
#> 5          -0.022576055           0.001959546           -0.02303677
#> 6          -0.015525218           0.002374152           -0.01979535
#>   spatial_predictor_0_4 spatial_predictor_0_5 spatial_predictor_0_6
#> 1         -0.0363323858          -0.029427120          -0.004345679
#> 2          0.3826927819           0.205013057           0.006481398
#> 3         -0.0031386301          -0.026240412           0.036601404
#> 4          0.0005170325          -0.014444892          -0.003356330
#> 5         -0.0524239401           0.006729439          -0.006797669
#> 6         -0.0338955963          -0.007884866          -0.002744701
#>   spatial_predictor_0_7 spatial_predictor_0_8 spatial_predictor_0_9
#> 1          0.0059417525          -0.003509625          -0.006296265
#> 2         -0.0338063656           0.174542054           0.024450222
#> 3         -0.0616077280           0.019577234          -0.001448598
#> 4          0.0009804302           0.010526820          -0.002889298
#> 5          0.0025571100          -0.011762268           0.004846323
#> 6          0.0029345255          -0.007054664          -0.002369704
#>   spatial_predictor_0_10 spatial_predictor_0_11 spatial_predictor_0_12
#> 1            0.002487306            0.005395791           -0.011379866
#> 2            0.005829746           -0.054961827            0.153839059
#> 3           -0.018299683            0.039246420           -0.008007024
#> 4            0.008730811            0.002146499            0.007681169
#> 5           -0.045296964           -0.039538738           -0.011040322
#> 6           -0.009715209           -0.004288805           -0.009536937
#>   spatial_predictor_0_13 spatial_predictor_0_14 spatial_predictor_0_15
#> 1            0.191604368          -0.0072850442           -0.026412798
#> 2            0.019835793          -0.0057251178           -0.062892949
#> 3           -0.014692044          -0.0201202412            0.008020865
#> 4           -0.008201179           0.0001369046            0.006005988
#> 5            0.164381811          -0.0088932051           -0.021214181
#> 6            0.178202420          -0.0060291344           -0.016907370
#>   spatial_predictor_0_16 spatial_predictor_0_17 spatial_predictor_0_18
#> 1            0.109791768             0.12559194            0.107268296
#> 2           -0.003832431             0.03668636            0.014722504
#> 3            0.048006557            -0.17744495            0.150866603
#> 4           -0.024858297            -0.01844209           -0.009470203
#> 5            0.108145269             0.02998075           -0.013711486
#> 6            0.083504053             0.06773982            0.047243449
#>   spatial_predictor_0_19 spatial_predictor_0_20 spatial_predictor_0_21
#> 1           -0.012273527            0.046229850            -0.04237342
#> 2            0.202464657            0.082229660             0.15771710
#> 3           -0.003222866            0.030550230             0.08951193
#> 4           -0.011830035            0.040433340            -0.02567659
#> 5            0.034505110           -0.178892320             0.04343963
#> 6           -0.009624029            0.008015184            -0.03834844
#>   spatial_predictor_0_22 spatial_predictor_0_23 spatial_predictor_0_24
#> 1             0.03596611             0.01118606             0.10224462
#> 2             0.04038242            -0.11437678            -0.01012395
#> 3            -0.04504866             0.13461198            -0.02047940
#> 4            -0.06842079            -0.01692236             0.10377418
#> 5            -0.13917976            -0.04071620             0.05601777
#> 6            -0.05776603            -0.02652804             0.09311909
#>   spatial_predictor_0_25 spatial_predictor_0_26 spatial_predictor_0_27
#> 1          -0.0011848037            -0.02412275          -0.0007539716
#> 2          -0.0013068838            -0.07838816           0.0235252584
#> 3          -0.0387798586            -0.07535325           0.1064394216
#> 4           0.0049076695             0.03958842           0.0382303597
#> 5          -0.0005085273            -0.04327854           0.0018750185
#> 6          -0.0021059632            -0.04019586           0.0116133257
#>   spatial_predictor_0_28 spatial_predictor_0_29 spatial_predictor_0_30
#> 1            -0.01644154           -0.052111626            0.065321865
#> 2            -0.03939033            0.003796367           -0.003727503
#> 3             0.04395511           -0.014889858           -0.004292680
#> 4            -0.01956660            0.097801181           -0.133857876
#> 5            -0.02127332           -0.066337960            0.089123320
#> 6            -0.04411492           -0.104538187            0.131117350
#>   spatial_predictor_0_31 spatial_predictor_0_32 spatial_predictor_0_33
#> 1           -0.009110300           -0.005527607           0.0024141508
#> 2            0.006294934           -0.009297452          -0.0011867862
#> 3           -0.145501124            0.048790879           0.1471245843
#> 4            0.009342614           -0.004236143           0.0002171203
#> 5           -0.008281460            0.005782912          -0.0083726169
#> 6           -0.014943405           -0.004594169          -0.0026991507
#>   spatial_predictor_0_34 spatial_predictor_0_35 spatial_predictor_0_36
#> 1           0.0995535458            -0.02277398            0.032366522
#> 2          -0.0019609284            -0.02249876            0.003705815
#> 3           0.0009205415            -0.02456633           -0.047683754
#> 4          -0.0217659867            -0.01207111           -0.002365715
#> 5          -0.0976154193             0.02262826           -0.068423826
#> 6           0.0986535382            -0.02665171            0.001086085
#>   spatial_predictor_0_37 spatial_predictor_0_38 spatial_predictor_0_39
#> 1           -0.095207273            0.001470171           0.0220490866
#> 2           -0.009986122            0.001834603           0.0072022025
#> 3           -0.030017972            0.194260820           0.0002023167
#> 4            0.003665707           -0.002490411           0.0516209027
#> 5            0.207826521            0.003515905           0.0673115372
#> 6           -0.021607620            0.005222174           0.0807527077
#>   spatial_predictor_0_40 spatial_predictor_0_41 spatial_predictor_0_42
#> 1           -0.020744827            0.063465665           -0.001583198
#> 2            0.012513154            0.006773117            0.005153518
#> 3            0.117669489            0.028793256            0.002015785
#> 4           -0.004805407           -0.052984447           -0.011659562
#> 5            0.034927798           -0.171082675            0.006518095
#> 6           -0.013496439           -0.019748363            0.002035536
#>   spatial_predictor_0_43 spatial_predictor_0_44 spatial_predictor_0_45
#> 1           0.0008763528           -0.004924952            0.004441966
#> 2          -0.0061488312            0.005445949            0.004192209
#> 3           0.0145429165            0.054685966           -0.031594959
#> 4           0.0007896651            0.012327561           -0.125926338
#> 5           0.0029789094            0.004475698           -0.086190522
#> 6           0.0001205283           -0.003080538           -0.102438242
#>   spatial_predictor_0_46 spatial_predictor_0_47 spatial_predictor_0_48
#> 1           -0.010614314            0.109509260          -0.0291230983
#> 2           -0.008707069            0.004100545          -0.0083583731
#> 3            0.154873292            0.012040765          -0.0001406001
#> 4           -0.008602096           -0.251552263           0.1535405874
#> 5           -0.026927424            0.054298969           0.0705021721
#> 6           -0.027814286            0.034531636          -0.0040461329
#>   spatial_predictor_0_49 spatial_predictor_0_50 spatial_predictor_0_51
#> 1           -0.014141207            0.065556939            0.008376850
#> 2            0.004919289            0.002300612           -0.051908297
#> 3           -0.020129602           -0.006858614            0.007107829
#> 4            0.034783817           -0.001360919           -0.012019909
#> 5            0.001021822           -0.206500175           -0.033419293
#> 6           -0.008599773           -0.018817582            0.010105730
#>   spatial_predictor_0_52 spatial_predictor_0_53 spatial_predictor_0_54
#> 1           -0.270094108            0.016737186          -0.0008228533
#> 2           -0.017095345           -0.030601816          -0.0067216761
#> 3           -0.004057733           -0.033720564           0.0245429177
#> 4           -0.203816105            0.006645515           0.0057952190
#> 5           -0.008175125           -0.005998713           0.0025015180
#> 6           -0.113070059            0.004311746           0.0054377734
#>   spatial_predictor_0_55 spatial_predictor_0_56 spatial_predictor_0_57
#> 1            0.015664149           -0.029544538            -0.08246695
#> 2           -0.031129552            0.054424622             0.02365053
#> 3           -0.211044319           -0.115905532             0.01459723
#> 4            0.016373143           -0.030249584             0.03505309
#> 5           -0.003434644           -0.014103637            -0.01536707
#> 6            0.010990643           -0.004441768             0.11325329
#>   spatial_predictor_0_58 spatial_predictor_0_59 spatial_predictor_0_60
#> 1            0.037100611            0.096731288            0.005897200
#> 2            0.044103974           -0.007519343            0.030608519
#> 3           -0.016563181            0.010981383            0.050403472
#> 4            0.002291122            0.068845992           -0.004341585
#> 5           -0.035271720           -0.122375412            0.002701816
#> 6           -0.043342941           -0.007111342           -0.005799743
#>   spatial_predictor_0_61 spatial_predictor_0_62 spatial_predictor_0_63
#> 1            0.008479632            -0.09335058           -0.077496495
#> 2           -0.098699533            -0.07575240            0.105276944
#> 3           -0.007539959            -0.01065693            0.008150333
#> 4            0.024917090             0.03804528            0.019850232
#> 5           -0.010265142             0.07225392            0.040042615
#> 6            0.029787167             0.02760241           -0.138702962
#>   spatial_predictor_0_64 spatial_predictor_0_65 spatial_predictor_0_66
#> 1           -0.011023456            0.013749019            -0.00670314
#> 2            0.004368849           -0.026456375            -0.06720143
#> 3           -0.042359390            0.036145409            -0.02388848
#> 4            0.009653611            0.003252935             0.03549700
#> 5           -0.020165538           -0.041935828            -0.01486902
#> 6           -0.057357348           -0.169761130            -0.23725453
#>   spatial_predictor_0_67 spatial_predictor_0_68 spatial_predictor_0_69
#> 1           -0.092711212             0.04605361             0.14007779
#> 2            0.026432216            -0.04457336             0.05193081
#> 3           -0.002307292             0.05047973            -0.02176933
#> 4            0.047805935             0.01809031             0.01189454
#> 5            0.086121023            -0.07767593            -0.12162162
#> 6            0.012066368            -0.08022491            -0.20666531
#>   spatial_predictor_0_70 spatial_predictor_0_71 spatial_predictor_0_72
#> 1            -0.03865851             0.01149307             0.06794522
#> 2             0.03527919             0.04203337             0.01282620
#> 3             0.05057488            -0.02103948            -0.01111083
#> 4            -0.09374814            -0.19466068             0.02195679
#> 5             0.06707658             0.05352161            -0.03062204
#> 6             0.08652559             0.01833518             0.15627827
#>   spatial_predictor_0_73 spatial_predictor_0_74 spatial_predictor_0_75
#> 1           -0.035343901           -0.017915068            0.015542313
#> 2           -0.009111780            0.005375863            0.017540288
#> 3           -0.009049244            0.036453627            0.233927322
#> 4            0.063050823            0.063122301            0.030319256
#> 5           -0.047062419           -0.031912283            0.023691678
#> 6            0.016779720            0.013204202            0.005625772
#>   spatial_predictor_0_76 spatial_predictor_0_77 spatial_predictor_0_78
#> 1             0.03292822            0.069727084           -0.017757708
#> 2            -0.03399917           -0.005818549           -0.009577624
#> 3             0.04447370           -0.032276461           -0.003526079
#> 4            -0.09559430            0.063758722            0.064366459
#> 5             0.08129817            0.182586145            0.077074235
#> 6            -0.08945159           -0.169983941            0.035904400
#>   spatial_predictor_0_79 spatial_predictor_0_80 spatial_predictor_0_81
#> 1            0.013920614            -0.00821663           -0.015901522
#> 2            0.034844339             0.01212693           -0.003600061
#> 3            0.062467634             0.03735965           -0.087326353
#> 4            0.087933528            -0.04193539           -0.041426923
#> 5            0.049456016             0.18633301            0.023410926
#> 6            0.005426446             0.05857672           -0.020355821
#>   spatial_predictor_0_82 spatial_predictor_0_83 spatial_predictor_0_84
#> 1             0.02664505            0.051483998           -0.059455466
#> 2             0.02960288            0.018758921            0.013363577
#> 3            -0.03510723           -0.009796530           -0.061048344
#> 4             0.08514307            0.054298933            0.005360485
#> 5             0.04332644           -0.044720417           -0.006508432
#> 6             0.03165506           -0.006830768           -0.034532156
#>   spatial_predictor_0_85 spatial_predictor_0_86 spatial_predictor_0_87
#> 1             0.09722934           -0.097284331            0.086610223
#> 2             0.01470533            0.003332324           -0.020797134
#> 3             0.04897573            0.034998512           -0.040119569
#> 4            -0.01867608           -0.022669681            0.007774045
#> 5            -0.01168749           -0.030586171           -0.119438460
#> 6            -0.01424540           -0.044059874           -0.104983179
#>   spatial_predictor_1000_1 spatial_predictor_1000_2 spatial_predictor_1000_3
#> 1               0.08658532              -0.03231611              0.068231938
#> 2               0.02042442              -0.15314615              0.013698668
#> 3              -0.08057675               0.07390865              0.071567363
#> 4               0.06696771              -0.06176788              0.075926333
#> 5               0.10024445               0.04832441             -0.011952038
#> 6               0.08412779               0.02766366              0.005880981
#>   spatial_predictor_1000_4 spatial_predictor_1000_5 spatial_predictor_1000_6
#> 1             3.217489e-03              -0.07018759             -0.026959299
#> 2            -2.473432e-02               0.11286917             -0.003267409
#> 3            -5.019297e-02              -0.02021901             -0.015663412
#> 4            -3.161629e-05              -0.03105710             -0.063646355
#> 5            -3.334773e-03              -0.04076160             -0.003326743
#> 6            -1.666075e-03              -0.04259223             -0.035163054
#>   spatial_predictor_1000_7 spatial_predictor_1000_8 spatial_predictor_1000_9
#> 1             0.0215975143             0.0790860856              0.005040687
#> 2            -0.0026196641            -0.0536572424             -0.005489766
#> 3             0.0162036065            -0.0605032737             -0.103856648
#> 4            -0.0009505308            -0.0007683611              0.020450989
#> 5             0.0328064995             0.1410146912             -0.101773566
#> 6             0.0340545764             0.1560500779             -0.106090804
#>   spatial_predictor_1000_10 spatial_predictor_1000_11 spatial_predictor_1000_12
#> 1               0.003350271                0.07608810               -0.03150507
#> 2              -0.046485866               -0.01337414                0.04083626
#> 3              -0.075473384                0.05253653               -0.04096583
#> 4              -0.035159892               -0.08299955               -0.11650787
#> 5               0.026591665                0.09650615                0.11436048
#> 6               0.016861260                0.03868709                0.06749009
#>   spatial_predictor_1000_13 spatial_predictor_1000_14 spatial_predictor_1000_15
#> 1               -0.07222673                0.04009140              -0.054078382
#> 2               -0.03145447               -0.08060326               0.025209320
#> 3               -0.04615498               -0.09056808               0.004550364
#> 4                0.06517494                0.01875903              -0.099293633
#> 5               -0.05184261                0.06171003               0.052480136
#> 6               -0.01316298                0.01867532              -0.005327623
#>   spatial_predictor_1000_16 spatial_predictor_1000_17 spatial_predictor_1000_18
#> 1               0.017810969              0.0113269073              -0.010257510
#> 2               0.028927460              0.0477794844               0.114391523
#> 3              -0.003050005             -0.0498092053               0.080532853
#> 4              -0.027069687             -0.0398669021               0.074806234
#> 5              -0.038380623              0.0002771587               0.032738537
#> 6               0.071443001              0.0495003413              -0.009328155
#>   spatial_predictor_1000_19 spatial_predictor_1000_20 spatial_predictor_1000_21
#> 1                0.04813674             -0.0437974692                0.01102296
#> 2               -0.03764689             -0.0183330366               -0.03000959
#> 3                0.07959245             -0.0712543891               -0.03850909
#> 4               -0.02019075              0.0099556770               -0.04529636
#> 5                0.03940559              0.0004961722               -0.02981489
#> 6                0.03468993             -0.0032133431                0.03370076
#>   spatial_predictor_1000_22 spatial_predictor_1000_23 spatial_predictor_1000_24
#> 1              -0.027440375              -0.034200698               -0.13298626
#> 2               0.218439020              -0.187647453               -0.20219303
#> 3              -0.090324377               0.073754536               -0.04432696
#> 4               0.022049436               0.003090971               -0.03809253
#> 5               0.006696832               0.023545706               -0.03388560
#> 6              -0.040124541              -0.008380628               -0.01783676
#>   spatial_predictor_1000_25 spatial_predictor_1000_26 spatial_predictor_1000_27
#> 1                0.11636893               0.132667519               0.151602883
#> 2               -0.02570768              -0.084066858              -0.040487923
#> 3               -0.10873386               0.003123965              -0.032845800
#> 4                0.02217474               0.061350239               0.002773503
#> 5                0.04045397               0.055444249              -0.067371147
#> 6                0.01030714               0.007858013               0.103901541
#>   spatial_predictor_1000_28 spatial_predictor_1000_29 spatial_predictor_1000_30
#> 1                0.12106686              0.0317377071             -0.1594341401
#> 2                0.03077180              0.0822242624             -0.0252894818
#> 3                0.01742517              0.0005693548              0.0002860974
#> 4                0.04540237              0.0294925171             -0.0148152924
#> 5               -0.05796736             -0.0203579338              0.1131264022
#> 6                0.05061757              0.0118455318             -0.1125735350
#>   spatial_predictor_1000_31 spatial_predictor_1000_32 spatial_predictor_1000_33
#> 1               -0.04135196               -0.04034484                0.03137691
#> 2                0.07494952                0.03754340               -0.05337929
#> 3                0.02038282               -0.01248751               -0.11382103
#> 4                0.13600669                0.02155827                0.06537506
#> 5                0.04101160                0.09961856               -0.02509947
#> 6               -0.13869427               -0.11630926                0.02115162
#>   spatial_predictor_1000_34 spatial_predictor_1000_35 spatial_predictor_1000_36
#> 1               -0.01452556                0.13409851               -0.07015630
#> 2               -0.08013209                0.06133915               -0.04826374
#> 3               -0.02198527               -0.03069170                0.03953152
#> 4               -0.05692688                0.11252861                0.09945197
#> 5                0.02887879                0.17843541                0.03495999
#> 6                0.05676607                0.03817728                0.03808089
#>   spatial_predictor_1000_37 spatial_predictor_1000_38 spatial_predictor_1000_39
#> 1               -0.16441816               -0.15123087               -0.01569234
#> 2                0.04761633                0.06699646                0.04794570
#> 3                0.02162981               -0.02815115                0.01841747
#> 4                0.01412370                0.06762155                0.15921531
#> 5               -0.02014062                0.20978338               -0.17502231
#> 6               -0.03451317               -0.06725425               -0.25219520
#>   spatial_predictor_1000_40 spatial_predictor_1000_41 spatial_predictor_1000_42
#> 1              -0.052881697               0.041360648               -0.03712966
#> 2              -0.045060093               0.080340444               -0.06707884
#> 3              -0.036774983               0.063167729               -0.08381353
#> 4               0.012532971               0.002011998                0.06939317
#> 5               0.001508912              -0.045524768                0.02468731
#> 6              -0.032933814               0.014634112               -0.09950179
#>   spatial_predictor_1000_43 spatial_predictor_1000_44 spatial_predictor_1000_45
#> 1              0.0009924187                0.03406906              -0.063176151
#> 2              0.0475707151               -0.06485353              -0.029631986
#> 3             -0.0795885376               -0.09240317              -0.109308147
#> 4             -0.0707769709                0.03382653               0.012411380
#> 5              0.0608986522               -0.08283213              -0.008718039
#> 6             -0.0270807705               -0.06530144               0.117763752
#>   spatial_predictor_1000_46 spatial_predictor_1000_47 spatial_predictor_1000_48
#> 1              -0.002894634                0.04297005              -0.050901484
#> 2              -0.016717014                0.02501987               0.032720687
#> 3              -0.132058215               -0.07947253               0.009571893
#> 4               0.065341767               -0.01786437               0.038196552
#> 5              -0.073750376               -0.03367780              -0.144606160
#> 6              -0.038034542                0.03967850               0.138418127
#>   spatial_predictor_1000_49 spatial_predictor_1000_50 spatial_predictor_1000_51
#> 1                0.14359592                0.01846099                0.10635259
#> 2               -0.03772670               -0.02690010               -0.05430504
#> 3                0.02445001               -0.13600703                0.02110699
#> 4               -0.03080022                0.06074740                0.14563081
#> 5                0.05615738                0.01735644               -0.02263605
#> 6               -0.16474718               -0.07841596               -0.06888592
#>   spatial_predictor_1000_52 spatial_predictor_1000_53 spatial_predictor_1000_54
#> 1              -0.000241508               -0.10875651                0.01367290
#> 2               0.015850104               -0.08289016               -0.03913177
#> 3              -0.093901157                0.05106307               -0.01105852
#> 4              -0.076717763               -0.15232997               -0.01537210
#> 5              -0.015168571               -0.01763253               -0.01283656
#> 6              -0.011287484                0.06269636                0.01206870
#>   spatial_predictor_1000_55 spatial_predictor_1000_56 spatial_predictor_1000_57
#> 1               -0.08309078              -0.032753222                0.03403235
#> 2                0.02253975               0.001842601               -0.02742228
#> 3                0.24374902               0.033593021                0.31853032
#> 4               -0.05601574              -0.008248447                0.04937029
#> 5               -0.05061777              -0.035996369                0.06950188
#> 6                0.06594581               0.078808216               -0.09638643
#>   spatial_predictor_1000_58 spatial_predictor_1000_59 spatial_predictor_1000_60
#> 1               -0.06191693                0.04216419             -0.0231419456
#> 2                0.02030021               -0.08578727              0.0000734037
#> 3               -0.03935156                0.22351219             -0.0436377191
#> 4               -0.02356013                0.03949120             -0.0371362255
#> 5                0.14295371               -0.01720984             -0.0278205957
#> 6               -0.04028605               -0.02803037             -0.0027459329
#>   spatial_predictor_1000_61 spatial_predictor_1000_62 spatial_predictor_1000_63
#> 1               0.098280214               0.079847623               -0.07078457
#> 2               0.022023086              -0.073366242               -0.07414266
#> 3               0.035103433              -0.041340942               -0.10674560
#> 4               0.012275864               0.046810287                0.10887253
#> 5               0.004667341              -0.017673312                0.07930793
#> 6               0.002605628              -0.003060575               -0.11106312
#>   spatial_predictor_1000_64 spatial_predictor_1000_65 spatial_predictor_1000_66
#> 1              -0.009341237                0.09502692               0.026757354
#> 2              -0.032701838                0.08127296              -0.031106869
#> 3              -0.047211284                0.02020700              -0.082326152
#> 4              -0.032450026               -0.04638701              -0.083501222
#> 5              -0.017794081               -0.06405042               0.003938521
#> 6              -0.032329644                0.12832392              -0.038232356
#>   spatial_predictor_1000_67 spatial_predictor_1000_68 spatial_predictor_1000_69
#> 1               0.017717805              -0.056097200                0.02021046
#> 2              -0.036041310               0.053447156                0.03501488
#> 3              -0.024005564              -0.035042736               -0.12319399
#> 4               0.057734523               0.090578300                0.00989136
#> 5               0.001937527              -0.002230929               -0.07911011
#> 6               0.094831138               0.108278776                0.14358105
#>   spatial_predictor_1000_70 spatial_predictor_1000_71 spatial_predictor_1000_72
#> 1              -0.037729770                0.05672643               -0.14152073
#> 2               0.044920980               -0.09919566               -0.10969028
#> 3              -0.069083674                0.02324144                0.01200051
#> 4              -0.069607759                0.02891570               -0.08000965
#> 5              -0.002556965               -0.07422993               -0.07798042
#> 6              -0.030013400               -0.08394401               -0.03210298
#>   spatial_predictor_1000_73 spatial_predictor_5000_1 spatial_predictor_5000_2
#> 1              -0.019293352               0.07199820             0.0239353948
#> 2              -0.039012292               0.02746351            -0.0172216615
#> 3              -0.099882513              -0.07597655            -0.0485147776
#> 4               0.084892409               0.05829797             0.0422465233
#> 5              -0.057933974               0.08477245            -0.0139102904
#> 6              -0.002781528               0.08231523            -0.0002748449
#>   spatial_predictor_5000_3 spatial_predictor_5000_4 spatial_predictor_5000_5
#> 1              -0.05486655             -0.107006150              -0.01648821
#> 2               0.07561315              0.004184952              -0.10274275
#> 3               0.05281807             -0.039695517               0.01183390
#> 4              -0.07324577              0.089557939              -0.06019356
#> 5               0.06659431             -0.077785063              -0.02715719
#> 6               0.04308426             -0.105113236              -0.02640728
#>   spatial_predictor_5000_6 spatial_predictor_5000_7 spatial_predictor_5000_8
#> 1               0.06380175             0.0596363719               0.04055366
#> 2              -0.22859211            -0.0555953998               0.11515747
#> 3              -0.01442345            -0.0679633788              -0.02186725
#> 4              -0.01573504             0.0005949253               0.01316262
#> 5              -0.03831650            -0.0073180397              -0.05883968
#> 6              -0.04949227             0.0051429213              -0.03793394
#>   spatial_predictor_5000_9 spatial_predictor_5000_10 spatial_predictor_5000_11
#> 1               0.07460767              -0.073165410               0.003796257
#> 2               0.03351724              -0.082353191               0.162996915
#> 3               0.01942256               0.007168803               0.052610228
#> 4               0.06946470               0.005520727               0.031301475
#> 5               0.05320099               0.057930020              -0.106560925
#> 6              -0.01678641               0.065520476              -0.142799548
#>   spatial_predictor_5000_12 spatial_predictor_5000_13 spatial_predictor_5000_14
#> 1               0.019068820              -0.047265993              -0.027035214
#> 2              -0.004935663               0.053820272              -0.087927830
#> 3              -0.017920179               0.053665862              -0.008093601
#> 4               0.098079018               0.053854091               0.038132732
#> 5              -0.056446799              -0.003229838               0.098252346
#> 6              -0.028161194               0.059303749               0.068278870
#>   spatial_predictor_5000_15 spatial_predictor_5000_16 spatial_predictor_5000_17
#> 1                0.09498974              -0.042605193              -0.018035611
#> 2                0.03089895               0.041740618              -0.007017234
#> 3                0.06327196               0.028093803               0.044044863
#> 4               -0.01158486               0.009666273               0.018656379
#> 5               -0.05696720               0.038722124              -0.022586472
#> 6               -0.10562548               0.067736839               0.015524225
#>   spatial_predictor_5000_18 spatial_predictor_5000_19 spatial_predictor_5000_20
#> 1                0.08895054                0.03057443              -0.036816173
#> 2                0.02175828                0.03546826              -0.020434265
#> 3                0.02615244               -0.03165395               0.043372885
#> 4               -0.04650178                0.04379053              -0.057824899
#> 5                0.03234194                0.12648227               0.003336959
#> 6               -0.00410192                0.06011295               0.024366217
#>   spatial_predictor_5000_21 spatial_predictor_5000_22 spatial_predictor_5000_23
#> 1               -0.01734864                0.01266707               -0.03726276
#> 2                0.04108243                0.02825731               -0.10133496
#> 3               -0.01109768                0.06256047                0.11106185
#> 4               -0.07377196               -0.14922578                0.05013686
#> 5                0.12247721               -0.09068544                0.07892492
#> 6               -0.07167867               -0.04517031                0.03675831
#>   spatial_predictor_5000_24 spatial_predictor_5000_25 spatial_predictor_5000_26
#> 1              -0.085181897                0.05823798               -0.04566431
#> 2              -0.080434704               -0.06620975                0.05519300
#> 3              -0.061308086                0.06006801                0.04667698
#> 4              -0.063911399               -0.02140509               -0.03184073
#> 5              -0.048421387               -0.01488175               -0.02739511
#> 6              -0.005783037                0.02433378                0.02815328
#>   spatial_predictor_5000_27 spatial_predictor_5000_28 spatial_predictor_5000_29
#> 1               0.028342715               0.016901231               -0.03203252
#> 2              -0.129198741               0.025422107                0.05315748
#> 3              -0.006492682              -0.011466010                0.03215453
#> 4              -0.096787057               0.037257125                0.12248712
#> 5              -0.119201398              -0.120391473               -0.07296944
#> 6              -0.096943873              -0.001978548               -0.02276658
#>   spatial_predictor_5000_30 spatial_predictor_5000_31 spatial_predictor_5000_32
#> 1              -0.001273783                0.08780673              -0.080724095
#> 2               0.102338090               -0.06626997              -0.001334075
#> 3              -0.042822088               -0.01387536              -0.003407348
#> 4              -0.198818368               -0.13416812              -0.024851630
#> 5               0.010207573                0.07288329               0.092361713
#> 6              -0.033499684                0.11612793              -0.162980755
#>   spatial_predictor_5000_33 spatial_predictor_5000_34 spatial_predictor_5000_35
#> 1                0.01781027               0.002248750                0.01671515
#> 2               -0.02990437              -0.032641670                0.08678797
#> 3                0.06393024               0.010420819               -0.02761100
#> 4                0.03092086              -0.137247555               -0.12131250
#> 5               -0.01943636              -0.054533286               -0.04251760
#> 6               -0.08695361              -0.005047018               -0.11509346
#>   spatial_predictor_5000_36 spatial_predictor_5000_37 spatial_predictor_5000_38
#> 1              -0.006172086                0.11198682              -0.059864246
#> 2              -0.004448553               -0.12383714               0.079488834
#> 3               0.018851232               -0.02941015               0.042666612
#> 4               0.178075022                0.08977122              -0.007076506
#> 5               0.066770627                0.03876279              -0.051671055
#> 6               0.093604019               -0.08014813               0.069799965
#>   spatial_predictor_5000_39 spatial_predictor_5000_40 spatial_predictor_5000_41
#> 1               -0.06315411              -0.024782056              0.0127075254
#> 2               -0.06293867              -0.007467738              0.0181999516
#> 3               -0.01662694               0.018912417              0.0007662147
#> 4                0.07881042              -0.047469580             -0.1646598813
#> 5                0.04899792              -0.134123616              0.0773160118
#> 6               -0.05497356               0.031775739              0.0949174035
#>   spatial_predictor_5000_42 spatial_predictor_5000_43 spatial_predictor_5000_44
#> 1               -0.01778167               -0.08506967               0.004379197
#> 2                0.05644518               -0.04580026               0.124306897
#> 3               -0.01423978               -0.06279209               0.063065312
#> 4               -0.08040396                0.08214645               0.105889599
#> 5                0.01939318                0.09937598               0.031432852
#> 6                0.11631277                0.14451829               0.041000682
#>   spatial_predictor_5000_45 spatial_predictor_5000_46 spatial_predictor_5000_47
#> 1              -0.014888884                0.03924662                0.14769008
#> 2               0.064188224                0.06410487                0.08532677
#> 3              -0.036593562               -0.02231719               -0.11293032
#> 4               0.006766716                0.14574672               -0.17149452
#> 5               0.089360133                0.03172565                0.02744822
#> 6               0.041933253               -0.03777955                0.02752247
#>   spatial_predictor_5000_48 spatial_predictor_5000_49 spatial_predictor_5000_50
#> 1              -0.048251334                0.04714192                0.14637112
#> 2              -0.012187926               -0.14150864               -0.01302295
#> 3               0.046154718                0.05587225                0.01455556
#> 4               0.098008877               -0.07854284                0.15023238
#> 5              -0.009439831               -0.02011616                0.06439308
#> 6              -0.121534134               -0.07436057                0.09902297
#>   spatial_predictor_5000_51 spatial_predictor_5000_52 spatial_predictor_5000_53
#> 1              -0.068668099                0.05772877                0.05739608
#> 2              -0.022575358               -0.07449298               -0.02429778
#> 3               0.005354177               -0.11190406                0.03200119
#> 4               0.115493802                0.06475079               -0.07822792
#> 5              -0.005855112               -0.11116350                0.06640452
#> 6              -0.176250052                0.01193667               -0.05406238
#>   spatial_predictor_5000_54 spatial_predictor_5000_55 spatial_predictor_5000_56
#> 1               -0.11781180              0.0004691497              -0.049783698
#> 2               -0.01868333              0.0457440347              -0.049031389
#> 3                0.05618605              0.0336912718              -0.033694761
#> 4               -0.10116513             -0.0548091289              -0.035641947
#> 5                0.05319686             -0.1104736116              -0.006035261
#> 6               -0.15229959              0.0141379097              -0.056821992
dim(mems)
#> [1] 227 216

# Check column names showing threshold and predictor number
colnames(mems)[1:6]
#> [1] "spatial_predictor_0_1" "spatial_predictor_0_2" "spatial_predictor_0_3"
#> [4] "spatial_predictor_0_4" "spatial_predictor_0_5" "spatial_predictor_0_6"

# Limit number of spatial predictors
mems_limited <- mem_multithreshold(
  distance.matrix = plants_distance,
  distance.thresholds = c(0, 1000, 5000),
  max.spatial.predictors = 20
)
dim(mems_limited)
#> [1] 227  20