Phytosociological analysis

For this example we’ll use a database of forestry inventories done in the amazon forest, and make a phytosociological analysis of the area.

library(forestmangr)
data(exfm20)
data_ex <- exfm20

data_ex
#> # A tibble: 12,295 x 18
#>   cod   transect  tree common.name scientific.name family   dbh canopy.pos
#>   <fct> <fct>    <int> <fct>       <fct>           <fct>  <dbl> <fct>     
#> 1 CAU_~ T01          2 macucu      Licania guiane~ Chrys~  10.3 S         
#> 2 CAU_~ T01          5 casca seca  Licania canesc~ Chrys~  14.6 S         
#> 3 CAU_~ T01          6 cajuacu     Anacardium spr~ Anaca~  78.8 E         
#> 4 CAU_~ T01          7 breu branco Protium panicu~ Burse~  14.7 S         
#> 5 CAU_~ T01          9 breu branco Protium panicu~ Burse~  10.6 E         
#> 6 CAU_~ T01         10 caramuxi    Pouteria hispi~ Sapot~  27.1 C         
#> # ... with 12,289 more rows, and 10 more variables: light <int>,
#> #   dead <lgl>, Hcom <dbl>, Htot <dbl>, date <int>, utm.east <dbl>,
#> #   utm.north <dbl>, vol <dbl>, plot.area <int>, total.area <int>

First we’ll calculate the diversity indexes of the area, with the species_diversity function. It just needs the data and column name for species:

species_diversity(data_ex, "scientific.name")
#> # A tibble: 1 x 5
#>   Shannon Simpson EqMaxima Pielou Jentsch
#>     <dbl>   <dbl>    <dbl>  <dbl>   <dbl>
#> 1     3.9    0.95     5.15   0.76    0.01

We can evaluate similarity between plots by the Jaccard index, using the similarity_matrix function:

similarity_matrix(data_ex, "scientific.name", "transect", index = "Jaccard")
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#>  [1,] 1.00 0.38 0.44 0.42 0.36 0.29 0.44 0.39 0.37  0.38  0.39  0.34  0.35
#>  [2,] 0.38 1.00 0.30 0.36 0.30 0.20 0.49 0.34 0.34  0.30  0.37  0.18  0.35
#>  [3,] 0.44 0.30 1.00 0.34 0.33 0.30 0.35 0.36 0.38  0.35  0.37  0.28  0.34
#>  [4,] 0.42 0.36 0.34 1.00 0.29 0.28 0.40 0.36 0.40  0.37  0.35  0.26  0.31
#>  [5,] 0.36 0.30 0.33 0.29 1.00 0.34 0.33 0.44 0.40  0.39  0.32  0.32  0.31
#>  [6,] 0.29 0.20 0.30 0.28 0.34 1.00 0.26 0.44 0.42  0.41  0.33  0.29  0.28
#>  [7,] 0.44 0.49 0.35 0.40 0.33 0.26 1.00 0.36 0.34  0.35  0.34  0.30  0.33
#>  [8,] 0.39 0.34 0.36 0.36 0.44 0.44 0.36 1.00 0.48  0.34  0.37  0.29  0.32
#>  [9,] 0.37 0.34 0.38 0.40 0.40 0.42 0.34 0.48 1.00  0.42  0.43  0.29  0.34
#> [10,] 0.38 0.30 0.35 0.37 0.39 0.41 0.35 0.34 0.42  1.00  0.36  0.26  0.31
#> [11,] 0.39 0.37 0.37 0.35 0.32 0.33 0.34 0.37 0.43  0.36  1.00  0.23  0.33
#> [12,] 0.34 0.18 0.28 0.26 0.32 0.29 0.30 0.29 0.29  0.26  0.23  1.00  0.35
#> [13,] 0.35 0.35 0.34 0.31 0.31 0.28 0.33 0.32 0.34  0.31  0.33  0.35  1.00
#> [14,] 0.32 0.23 0.33 0.31 0.32 0.41 0.24 0.41 0.33  0.32  0.30  0.39  0.35
#> [15,] 0.42 0.31 0.38 0.41 0.35 0.34 0.33 0.36 0.40  0.35  0.42  0.31  0.38
#> [16,] 0.22 0.28 0.31 0.29 0.35 0.34 0.33 0.40 0.30  0.31  0.30  0.26  0.31
#> [17,] 0.24 0.26 0.30 0.22 0.29 0.28 0.28 0.30 0.30  0.29  0.27  0.25  0.28
#> [18,] 0.28 0.25 0.32 0.29 0.29 0.34 0.27 0.36 0.36  0.33  0.25  0.31  0.29
#> [19,] 0.29 0.31 0.26 0.28 0.36 0.29 0.31 0.31 0.33  0.29  0.31  0.29  0.36
#> [20,] 0.26 0.24 0.29 0.29 0.30 0.31 0.23 0.37 0.35  0.26  0.39  0.24  0.38
#> [21,] 0.36 0.33 0.26 0.30 0.31 0.28 0.39 0.38 0.34  0.27  0.42  0.33  0.30
#> [22,] 0.28 0.31 0.27 0.32 0.31 0.32 0.33 0.40 0.38  0.35  0.28  0.29  0.27
#>       [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22]
#>  [1,]  0.32  0.42  0.22  0.24  0.28  0.29  0.26  0.36  0.28
#>  [2,]  0.23  0.31  0.28  0.26  0.25  0.31  0.24  0.33  0.31
#>  [3,]  0.33  0.38  0.31  0.30  0.32  0.26  0.29  0.26  0.27
#>  [4,]  0.31  0.41  0.29  0.22  0.29  0.28  0.29  0.30  0.32
#>  [5,]  0.32  0.35  0.35  0.29  0.29  0.36  0.30  0.31  0.31
#>  [6,]  0.41  0.34  0.34  0.28  0.34  0.29  0.31  0.28  0.32
#>  [7,]  0.24  0.33  0.33  0.28  0.27  0.31  0.23  0.39  0.33
#>  [8,]  0.41  0.36  0.40  0.30  0.36  0.31  0.37  0.38  0.40
#>  [9,]  0.33  0.40  0.30  0.30  0.36  0.33  0.35  0.34  0.38
#> [10,]  0.32  0.35  0.31  0.29  0.33  0.29  0.26  0.27  0.35
#> [11,]  0.30  0.42  0.30  0.27  0.25  0.31  0.39  0.42  0.28
#> [12,]  0.39  0.31  0.26  0.25  0.31  0.29  0.24  0.33  0.29
#> [13,]  0.35  0.38  0.31  0.28  0.29  0.36  0.38  0.30  0.27
#> [14,]  1.00  0.40  0.39  0.27  0.37  0.37  0.41  0.40  0.35
#> [15,]  0.40  1.00  0.32  0.32  0.36  0.34  0.40  0.37  0.27
#> [16,]  0.39  0.32  1.00  0.38  0.27  0.28  0.40  0.30  0.36
#> [17,]  0.27  0.32  0.38  1.00  0.30  0.26  0.31  0.26  0.28
#> [18,]  0.37  0.36  0.27  0.30  1.00  0.32  0.33  0.30  0.36
#> [19,]  0.37  0.34  0.28  0.26  0.32  1.00  0.35  0.41  0.34
#> [20,]  0.41  0.40  0.40  0.31  0.33  0.35  1.00  0.33  0.33
#> [21,]  0.40  0.37  0.30  0.26  0.30  0.41  0.33  1.00  0.28
#> [22,]  0.35  0.27  0.36  0.28  0.36  0.34  0.33  0.28  1.00

We can also generate a dendrogram for this analysis:

similarity_matrix(exfm20, "scientific.name", "transect", index = "Jaccard", dendrogram = TRUE, n_groups = 3)
#> $Dendrogram

#> 
#> $Matrix
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#>  [1,] 1.00 0.38 0.44 0.42 0.36 0.29 0.44 0.39 0.37  0.38  0.39  0.34  0.35
#>  [2,] 0.38 1.00 0.30 0.36 0.30 0.20 0.49 0.34 0.34  0.30  0.37  0.18  0.35
#>  [3,] 0.44 0.30 1.00 0.34 0.33 0.30 0.35 0.36 0.38  0.35  0.37  0.28  0.34
#>  [4,] 0.42 0.36 0.34 1.00 0.29 0.28 0.40 0.36 0.40  0.37  0.35  0.26  0.31
#>  [5,] 0.36 0.30 0.33 0.29 1.00 0.34 0.33 0.44 0.40  0.39  0.32  0.32  0.31
#>  [6,] 0.29 0.20 0.30 0.28 0.34 1.00 0.26 0.44 0.42  0.41  0.33  0.29  0.28
#>  [7,] 0.44 0.49 0.35 0.40 0.33 0.26 1.00 0.36 0.34  0.35  0.34  0.30  0.33
#>  [8,] 0.39 0.34 0.36 0.36 0.44 0.44 0.36 1.00 0.48  0.34  0.37  0.29  0.32
#>  [9,] 0.37 0.34 0.38 0.40 0.40 0.42 0.34 0.48 1.00  0.42  0.43  0.29  0.34
#> [10,] 0.38 0.30 0.35 0.37 0.39 0.41 0.35 0.34 0.42  1.00  0.36  0.26  0.31
#> [11,] 0.39 0.37 0.37 0.35 0.32 0.33 0.34 0.37 0.43  0.36  1.00  0.23  0.33
#> [12,] 0.34 0.18 0.28 0.26 0.32 0.29 0.30 0.29 0.29  0.26  0.23  1.00  0.35
#> [13,] 0.35 0.35 0.34 0.31 0.31 0.28 0.33 0.32 0.34  0.31  0.33  0.35  1.00
#> [14,] 0.32 0.23 0.33 0.31 0.32 0.41 0.24 0.41 0.33  0.32  0.30  0.39  0.35
#> [15,] 0.42 0.31 0.38 0.41 0.35 0.34 0.33 0.36 0.40  0.35  0.42  0.31  0.38
#> [16,] 0.22 0.28 0.31 0.29 0.35 0.34 0.33 0.40 0.30  0.31  0.30  0.26  0.31
#> [17,] 0.24 0.26 0.30 0.22 0.29 0.28 0.28 0.30 0.30  0.29  0.27  0.25  0.28
#> [18,] 0.28 0.25 0.32 0.29 0.29 0.34 0.27 0.36 0.36  0.33  0.25  0.31  0.29
#> [19,] 0.29 0.31 0.26 0.28 0.36 0.29 0.31 0.31 0.33  0.29  0.31  0.29  0.36
#> [20,] 0.26 0.24 0.29 0.29 0.30 0.31 0.23 0.37 0.35  0.26  0.39  0.24  0.38
#> [21,] 0.36 0.33 0.26 0.30 0.31 0.28 0.39 0.38 0.34  0.27  0.42  0.33  0.30
#> [22,] 0.28 0.31 0.27 0.32 0.31 0.32 0.33 0.40 0.38  0.35  0.28  0.29  0.27
#>       [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22]
#>  [1,]  0.32  0.42  0.22  0.24  0.28  0.29  0.26  0.36  0.28
#>  [2,]  0.23  0.31  0.28  0.26  0.25  0.31  0.24  0.33  0.31
#>  [3,]  0.33  0.38  0.31  0.30  0.32  0.26  0.29  0.26  0.27
#>  [4,]  0.31  0.41  0.29  0.22  0.29  0.28  0.29  0.30  0.32
#>  [5,]  0.32  0.35  0.35  0.29  0.29  0.36  0.30  0.31  0.31
#>  [6,]  0.41  0.34  0.34  0.28  0.34  0.29  0.31  0.28  0.32
#>  [7,]  0.24  0.33  0.33  0.28  0.27  0.31  0.23  0.39  0.33
#>  [8,]  0.41  0.36  0.40  0.30  0.36  0.31  0.37  0.38  0.40
#>  [9,]  0.33  0.40  0.30  0.30  0.36  0.33  0.35  0.34  0.38
#> [10,]  0.32  0.35  0.31  0.29  0.33  0.29  0.26  0.27  0.35
#> [11,]  0.30  0.42  0.30  0.27  0.25  0.31  0.39  0.42  0.28
#> [12,]  0.39  0.31  0.26  0.25  0.31  0.29  0.24  0.33  0.29
#> [13,]  0.35  0.38  0.31  0.28  0.29  0.36  0.38  0.30  0.27
#> [14,]  1.00  0.40  0.39  0.27  0.37  0.37  0.41  0.40  0.35
#> [15,]  0.40  1.00  0.32  0.32  0.36  0.34  0.40  0.37  0.27
#> [16,]  0.39  0.32  1.00  0.38  0.27  0.28  0.40  0.30  0.36
#> [17,]  0.27  0.32  0.38  1.00  0.30  0.26  0.31  0.26  0.28
#> [18,]  0.37  0.36  0.27  0.30  1.00  0.32  0.33  0.30  0.36
#> [19,]  0.37  0.34  0.28  0.26  0.32  1.00  0.35  0.41  0.34
#> [20,]  0.41  0.40  0.40  0.31  0.33  0.35  1.00  0.33  0.33
#> [21,]  0.40  0.37  0.30  0.26  0.30  0.41  0.33  1.00  0.28
#> [22,]  0.35  0.27  0.36  0.28  0.36  0.34  0.33  0.28  1.00

To evaluate the level of aggregation among species in the area, we can use the species_aggreg function:

species_aggreg(data_ex, "scientific.name", "transect")
#> # A tibble: 172 x 7
#>   especie           Payandeh Pay.res   Hazen Haz.res     Morisita Mor.res  
#> * <fct>                <dbl> <chr>     <dbl> <chr>          <dbl> <chr>    
#> 1 Abarema cochleata      0.9 Regular     18  Not aggreg~      0   Rare     
#> 2 Abarema jupunba        0.9 Regular     19  Not aggreg~      0   Rare     
#> 3 Abuta grandifolia     16   Aggregat~  337. Aggregated      11.9 Aggregat~
#> 4 Aiouea sp.             9.5 Aggregat~  200  Aggregated      10.4 Aggregat~
#> 5 Ambelania acida       10   Aggregat~  210  Aggregated      22   Aggregat~
#> 6 Anacardium spruc~      9.3 Aggregat~  195. Aggregated       7.7 Aggregat~
#> # ... with 166 more rows

We can also evaluate the horizontal structure of the forest. To do this, we can use the forest_structure function:

forest_structure(data_ex, "scientific.name", "dbh", "transect", 10000)
#> # A tibble: 172 x 9
#>   especie               AF     RF    AD     DR     ADo    RDo    IVC    IVI
#> * <fct>              <dbl>  <dbl> <dbl>  <dbl>   <dbl>  <dbl>  <dbl>  <dbl>
#> 1 Abarema cochleata  18.2  0.392  0.182 0.0343 0.0359  0.137  0.0859 0.188 
#> 2 Abarema jupunba    13.6  0.294  0.136 0.0258 0.0302  0.116  0.0707 0.145 
#> 3 Abuta grandifolia   9.09 0.196  1.36  0.258  0.0162  0.0621 0.160  0.172 
#> 4 Aiouea sp.          9.09 0.196  0.909 0.172  0.0413  0.158  0.165  0.175 
#> 5 Ambelania acida     4.55 0.0979 0.454 0.0859 0.00379 0.0145 0.0502 0.0661
#> 6 Anacardium spruce~ 27.3  0.588  1.23  0.232  0.159   0.608  0.420  0.476 
#> # ... with 166 more rows

It’s also possible to calculate the vertical and internal structures:

forest_structure(data_ex, "scientific.name", "dbh", "transect", 10000, "canopy.pos", "light") 
#> # A tibble: 172 x 19
#>   especie    AF     RF    AD     DR     ADo    RDo    IVC    IVI   VFC
#> * <fct>   <dbl>  <dbl> <dbl>  <dbl>   <dbl>  <dbl>  <dbl>  <dbl> <dbl>
#> 1 Abarem~ 18.2  0.392  0.182 0.0343 0.0359  0.137  0.0859 0.188   51.2
#> 2 Abarem~ 13.6  0.294  0.136 0.0258 0.0302  0.116  0.0707 0.145   25.6
#> 3 Abuta ~  9.09 0.196  1.36  0.258  0.0162  0.0621 0.160  0.172    0  
#> 4 Aiouea~  9.09 0.196  0.909 0.172  0.0413  0.158  0.165  0.175    0  
#> 5 Ambela~  4.55 0.0979 0.454 0.0859 0.00379 0.0145 0.0502 0.0661   0  
#> 6 Anacar~ 27.3  0.588  1.23  0.232  0.159   0.608  0.420  0.476   38.4
#> # ... with 166 more rows, and 9 more variables: VFE <dbl>, VFS <dbl>,
#> #   PSA <dbl>, PSR <dbl>, QF1 <dbl>, QF2 <dbl>, QF3 <dbl>, QAF <dbl>,
#> #   QRF <dbl>

To check if the forest is regulated, we can use the BDq method, with the bdq_meyer function:

bdq_meyer(data_ex, "transect", "dbh", 1000,licourt_index = 2)
#>    Class Class_Center NumIndv IndvHectare Meyer   q MeyerBalan
#> 1      2          7.5    4730      2150.0   564 1.8       6198
#> 2      3         12.5    2700      1227.3   434 1.5       3099
#> 3      4         17.5    1840       836.4   335 2.0       1550
#> 4      5         22.5     930       422.7   258 1.4        775
#> 5      6         27.5     670       304.5   199 1.8        387
#> 6      7         32.5     369       167.7   153 1.3        194
#> 7      8         37.5     291       132.3   118 1.4         97
#> 8      9         42.5     208        94.5    91 1.2         48
#> 9     10         47.5     180        81.8    70 1.6         24
#> 10    11         52.5     116        52.7    54 1.9         12
#> 11    12         57.5      60        27.3    42 1.2          6
#> 12    13         62.5      49        22.3    32 1.2          3
#> 13    14         67.5      40        18.2    25 1.9          2
#> 14    15         72.5      21         9.5    19 0.7          1
#> 15    16         77.5      29        13.2    15 1.5          0
#> 16    17         82.5      20         9.1    11 1.5          0
#> 17    18         87.5      13         5.9     9 1.6          0
#> 18    19         92.5       8         3.6     7 2.6          0
#> 19    20         97.5       3         1.4     5 0.8          0
#> 20    21        102.5       4         1.8     4 1.3          0
#> 21    22        107.5       3         1.4     3 2.8          0
#> 22    23        112.5       1         0.5     2 0.4          0
#> 23    24        117.5       3         1.4     2 2.8          0
#> 24    25        122.5       1         0.5     1 1.0          0
#> 25    28        137.5       1         0.5     1 1.0          0
#> 26    29        142.5       1         0.5     0 0.6          0
#> 27    30        147.5       2         0.9     0 1.8          0
#> 28    32        157.5       1         0.5     0 1.0          0
#> 29    40        197.5       1         0.5     0  NA          0

With the diameter_class function it’s possible to divide the data in diameter classes, and get the number of individuals per species in each class:

classified <- diameter_class(data_ex,"dbh", "transect", 10000, 10, 10, "scientific.name") 

head(classified)
#>         scientific.name CC NumIndv IndvHA          G        G_ha       RD
#> 1     Abuta grandifolia 15      30    1.4 0.35676712 0.016216687 100.0000
#> 2            Aiouea sp. 15      10    0.5 0.09331316 0.004241507  50.0000
#> 3       Ambelania acida 15      10    0.5 0.08332289 0.003787404 100.0000
#> 4 Anacardium spruceanum 15      10    0.5 0.27171635 0.012350743  37.0370
#> 5       Aniba canelilla 15      10    0.5 0.08332289 0.003787404  90.9091
#> 6      Aniba parviflora 15      10    0.5 0.10568318 0.004803781 100.0000

Another way of visualizing this table is to spread the center of class to columns. We can do this with the cc_to_column argument:

classified <- diameter_class(data_ex,"dbh", "transect", 10000, 10, 10,
               "scientific.name", cc_to_column=TRUE)
head(classified)
#>         scientific.name  15  25  35  45  55  65  75 85 95 105 115 125 135
#> 1     Abarema cochleata             0.1 0.1                              
#> 2       Abarema jupunba                 0.1                              
#> 3     Abuta grandifolia 1.4                                              
#> 4            Aiouea sp. 0.5     0.5                                      
#> 5       Ambelania acida 0.5                                              
#> 6 Anacardium spruceanum 0.5 0.5             0.1 0.1                      
#>   155 165 195 Total
#> 1               0.2
#> 2               0.1
#> 3               1.4
#> 4                 1
#> 5               0.5
#> 6               1.2