library(alphahull)
## Registered S3 method overwritten by 'R.oo':
##   method        from       
##   throw.default R.methodsS3
library(hypervolume)
## Loading required package: Rcpp
## Loading required package: rgl
library(car)
## Loading required package: carData
library(MASS)
library(lme4)
## Loading required package: Matrix
## Registered S3 methods overwritten by 'lme4':
##   method                          from
##   cooks.distance.influence.merMod car 
##   influence.merMod                car 
##   dfbeta.influence.merMod         car 
##   dfbetas.influence.merMod        car
#source(file = "HighstatLibV10.R") #cool tools to support
#library(factoextra) # Useful for PCA analysis
library(here)
## here() starts at /Users/santorui/Documents/GitHub/FinlandAnalysis
library(data.table) # to work with data
library(dplyr)      # to manage data
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
## 
##     between, first, last
## The following object is masked from 'package:MASS':
## 
##     select
## The following object is masked from 'package:car':
## 
##     recode
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(magrittr)   # to use the pipe operator %>% 
library(MuMIn)
## Registered S3 method overwritten by 'MuMIn':
##   method         from
##   predict.merMod lme4
library(glmmTMB)
## Warning in checkMatrixPackageVersion(): Package version inconsistency detected.
## TMB was built with Matrix version 1.2.17
## Current Matrix version is 1.2.18
## Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package
library(bbmle)
## Loading required package: stats4
## 
## Attaching package: 'bbmle'
## The following object is masked from 'package:MuMIn':
## 
##     AICc
## The following object is masked from 'package:dplyr':
## 
##     slice
library(performance)
library(see)
library(pscl)
## Classes and Methods for R developed in the
## Political Science Computational Laboratory
## Department of Political Science
## Stanford University
## Simon Jackman
## hurdle and zeroinfl functions by Achim Zeileis
Results2 <- read.csv2(here("results","RESULTS.CSV"), header=TRUE, row.names = 1,  stringsAsFactors = T,sep = ",", dec = ".")
Results2
##               ForestID Dist_trail Dist_edge Dist_trail_beginning
## 1             Lagoinha          0         0                  250
## 2             Lagoinha         50       293                  250
## 3             Lagoinha        235        50                  250
## 4  Mist\xe9rios_Negros          0         0                    0
## 5  Mist\xe9rios_Negros          0         0                  200
## 6  Mist\xe9rios_Negros          0        25                  960
## 7  Mist\xe9rios_Negros         50        50                  200
## 8  Mist\xe9rios_Negros        600       600                 1880
## 9        Santa_Barbara          0       510                    0
## 10       Santa_Barbara          0       481                   50
## 11       Santa_Barbara          0       436                  250
## 12       Santa_Barbara          0       404                  401
## 13       Santa_Barbara         50       441                  401
## 14       Santa_Barbara        300       600                  401
## 15           Pico_Vara          0         0                    0
## 16           Pico_Vara          0         0                   50
## 17           Pico_Vara          0         0                  250
## 18           Pico_Vara          0         0                  400
##    Dist_trail_std Dist_edge_std Dist_trail_beginning_std TAlphaAll
## 1        0.000000    0.00000000               0.47411353         5
## 2        0.312279    0.96318857               0.47411353        10
## 3        1.467711    0.16436665               0.47411353         8
## 4        0.000000    0.00000000               0.00000000        17
## 5        0.000000    0.00000000               0.37929082        16
## 6        0.000000    0.08218333               1.82059594        11
## 7        0.312279    0.16436665               0.37929082        11
## 8        3.747348    1.97239980               3.56533373        13
## 9        0.000000    1.67653983               0.00000000        12
## 10       0.000000    1.58120718               0.09482271        11
## 11       0.000000    1.43327719               0.47411353         7
## 12       0.000000    1.32808253               0.76047810        14
## 13       0.312279    1.44971386               0.76047810        10
## 14       1.873674    1.97239980               0.76047810         9
## 15       0.000000    0.00000000               0.00000000        10
## 16       0.000000    0.00000000               0.09482271        11
## 17       0.000000    0.00000000               0.47411353        12
## 18       0.000000    0.00000000               0.75858164        11
##    TAlphaNat TAlphaNInd TAlphaEnd FAlphaAll FAlphaNat FAlphaNInd FAlphaEnd
## 1          5          0         3  2.507196  2.507196  0.0001000  1.458813
## 2          8          2         5  4.571896  3.649118  1.2911438  2.426661
## 3          8          0         6  3.748115  3.748115  0.0001000  2.736208
## 4         10          7         6  7.055960  4.811024  2.9836466  2.963138
## 5         11          5         6  6.188667  4.841288  1.7638506  2.963138
## 6         10          1         6  4.419375  4.062232  0.6455719  2.653394
## 7          9          2         5  4.455256  3.885097  1.0704329  2.426661
## 8         10          3         7  5.157504  4.091758  1.4415752  3.405778
## 9         11          1         7  4.877473  4.591758  0.6455719  3.405778
## 10         9          2         6  4.826500  4.026895  1.2911438  2.804438
## 11         6          1         4  3.438483  3.152768  0.6455719  2.104385
## 12        11          3         8  5.248713  4.678871  1.0704329  3.759558
## 13         9          1         6  3.913632  3.739558  0.6455719  2.484387
## 14         9          0         5  3.839360  3.839360  0.0001000  2.199731
## 15         8          2         5  3.662528  3.186972  1.0704329  2.265014
## 16         9          2         6  4.669753  4.026895  1.1820494  2.804438
## 17        11          1         5  4.320189  4.034474  0.6455719  2.158866
## 18         9          2         5  4.424199  3.658167  1.1820494  2.199731
##    abund.all abund.nat abund.nind abund.end prop.Talpha prop.Falpha
## 1        117       117          0       105  0.00010000   0.9999000
## 2         92        90          2        81  0.20000000   0.7981628
## 3        139       139          0       111  0.00010000   0.9999000
## 4        111        99         12        64  0.41176471   0.6818383
## 5        147       115         32        94  0.31250000   0.7822829
## 6        103       102          1        71  0.09090909   0.9191869
## 7        167       148         19       128  0.18181818   0.8720254
## 8        159       114         45        82  0.23076923   0.7933601
## 9        134       130          4       115  0.08333333   0.9414216
## 10        66        63          3        43  0.18181818   0.8343304
## 11       188       176         12       145  0.14285714   0.9169068
## 12       207       184         23       169  0.21428571   0.8914321
## 13       115       113          2       108  0.10000000   0.9555211
## 14       154       154          0       135  0.00010000   0.9999000
## 15        87        77         10        66  0.20000000   0.8701564
## 16        90        82          8        70  0.18181818   0.8623358
## 17        99        96          3        79  0.08333333   0.9338652
## 18       159       157          2       138  0.18181818   0.8268540
##     prop.abund  prop.end all.tax.btotal all.tax.brich all.tax.brepl
## 1  0.000100000 0.8974359      0.3750000    0.37500000     0.0010000
## 2  0.021739130 0.8804348      0.5000000    0.16666667     0.3333333
## 3  0.000100000 0.7985612      0.0010000    0.00100000     0.0010000
## 4  0.108108108 0.5765766      0.5000000    0.20000000     0.3000000
## 5  0.217687075 0.6394558      0.3888889    0.16666667     0.2222222
## 6  0.009708738 0.6893204      0.5882353    0.11764706     0.4705882
## 7  0.113772455 0.7664671      0.5000000    0.12500000     0.3750000
## 8  0.283018868 0.5157233      0.0010000    0.00100000     0.0010000
## 9  0.029850746 0.8582090      0.5000000    0.21428571     0.2857143
## 10 0.045454545 0.6515152      0.5714286    0.14285714     0.4285714
## 11 0.063829787 0.7712766      0.5454545    0.18181818     0.3636364
## 12 0.111111111 0.8164251      0.5625000    0.31250000     0.2500000
## 13 0.017391304 0.9391304      0.4166667    0.08333333     0.3333333
## 14 0.000100000 0.8766234      0.0010000    0.00100000     0.0010000
## 15 0.114942529 0.7586207      0.5000000    0.07142857     0.4285714
## 16 0.088888889 0.7777778      0.5333333    0.00100000     0.5333333
## 17 0.030303030 0.7979798      0.4666667    0.06666667     0.4000000
## 18 0.012578616 0.8679245      0.0010000    0.00100000     0.0010000
##    nat.tax.btotal nat.tax.brich nat.tax.brepl nind.tax.btotal
## 1       0.3750000    0.37500000     0.0010000       0.0010000
## 2       0.4000000    0.00100000     0.4000000       0.9990000
## 3       0.0010000    0.00100000     0.0010000       0.0010000
## 4       0.3333333    0.00100000     0.3333333       0.7500000
## 5       0.3846154    0.07692308     0.3076923       0.4000000
## 6       0.4615385    0.00100000     0.4615385       0.9990000
## 7       0.4166667    0.08333333     0.3333333       0.7500000
## 8       0.0010000    0.00100000     0.0010000       0.0010000
## 9       0.4615385    0.15384615     0.3076923       0.9990000
## 10      0.5000000    0.00100000     0.5000000       0.9990000
## 11      0.5000000    0.30000000     0.2000000       0.9990000
## 12      0.4615385    0.15384615     0.3076923       0.9990000
## 13      0.3636364    0.00100000     0.3636364       0.9990000
## 14      0.0010000    0.00100000     0.0010000       0.0010000
## 15      0.4545455    0.09090909     0.3636364       0.6666667
## 16      0.5000000    0.00100000     0.5000000       0.6666667
## 17      0.3333333    0.16666667     0.1666667       0.9990000
## 18      0.0010000    0.00100000     0.0010000       0.0010000
##    nind.tax.brich nind.tax.brepl end.tax.btotal end.tax.brich
## 1       0.0010000      0.0010000      0.5000000     0.5000000
## 2       0.9990000      0.0010000      0.4285714     0.1428571
## 3       0.0010000      0.0010000      0.0010000     0.0010000
## 4       0.5000000      0.2500000      0.1428571     0.1428571
## 5       0.4000000      0.0010000      0.1428571     0.1428571
## 6       0.5000000      0.5000000      0.3750000     0.1250000
## 7       0.2500000      0.5000000      0.2857143     0.2857143
## 8       0.0010000      0.0010000      0.0010000     0.0010000
## 9       0.9990000      0.0010000      0.5000000     0.2500000
## 10      0.9990000      0.0010000      0.4285714     0.1428571
## 11      0.9990000      0.0010000      0.5000000     0.1666667
## 12      0.9990000      0.0010000      0.3750000     0.3750000
## 13      0.9990000      0.0010000      0.1666667     0.1666667
## 14      0.0010000      0.0010000      0.0010000     0.0010000
## 15      0.0010000      0.6666667      0.5714286     0.0010000
## 16      0.0010000      0.6666667      0.4285714     0.1428571
## 17      0.3333333      0.6666667      0.3333333     0.0010000
## 18      0.0010000      0.0010000      0.0010000     0.0010000
##    end.tax.brepl all.func.btotal all.func.brich all.func.brepl
## 1      0.0010000       0.4703047     0.13145819     0.33884650
## 2      0.2857143       0.4510427     0.31515581     0.13588692
## 3      0.0010000       0.0010000     0.00100000     0.00100000
## 4      0.0010000       0.5584348     0.25627825     0.30215660
## 5      0.0010000       0.2792181     0.06748164     0.21173649
## 6      0.2500000       0.5247621     0.31531803     0.20944404
## 7      0.0010000       0.3148084     0.04135440     0.27345396
## 8      0.0010000       0.0010000     0.00100000     0.00100000
## 9      0.2500000       0.5260492     0.10235769     0.42369155
## 10     0.2857143       0.6572888     0.53708446     0.12020438
## 11     0.3333333       0.5266739     0.14647102     0.38020285
## 12     0.0010000       0.5870997     0.20743412     0.37966555
## 13     0.0010000       0.4914517     0.21871146     0.27274028
## 14     0.0010000       0.0010000     0.00100000     0.00100000
## 15     0.5714286       0.5250878     0.43168162     0.09340618
## 16     0.2857143       0.6401026     0.37683904     0.26326358
## 17     0.3333333       0.4641417     0.35717635     0.10696535
## 18     0.0010000       0.0010000     0.00100000     0.00100000
##    nat.func.btotal nat.func.brich nat.func.brepl nind.func.btotal
## 1        0.4703047     0.13145819     0.33884650        0.0010000
## 2        0.4474493     0.33220517     0.11524413        0.9990000
## 3        0.0010000     0.00100000     0.00100000        0.0010000
## 4        0.5256001     0.09645607     0.42914408        0.8330498
## 5        0.3446691     0.01439418     0.33027495        0.3296413
## 6        0.3675332     0.09069260     0.27684058        0.9963128
## 7        0.3791924     0.21033381     0.16885860        0.5975177
## 8        0.0010000     0.00100000     0.00100000        0.0010000
## 9        0.5332315     0.12395226     0.40927928        0.9990000
## 10       0.6601833     0.56185864     0.09832462        0.9990000
## 11       0.5228679     0.09847547     0.42439247        0.9990000
## 12       0.5762955     0.13399572     0.44229977        0.9990000
## 13       0.4956483     0.23100532     0.26464296        0.9990000
## 14       0.0010000     0.00100000     0.00100000        0.0010000
## 15       0.5567426     0.49342135     0.06332120        0.8920702
## 16       0.6518425     0.42306199     0.22878048        0.8450143
## 17       0.4634681     0.37046817     0.09299989        0.8861977
## 18       0.0010000     0.00100000     0.00100000        0.0010000
##    nind.func.brich nind.func.brepl end.func.btotal end.func.brich
## 1        0.0010000      0.00100000       0.4325629     0.04353992
## 2        0.9990000      0.00100000       0.3865546     0.25210084
## 3        0.0010000      0.00100000       0.0010000     0.00100000
## 4        0.7085055      0.12454426       0.6243414     0.16960174
## 5        0.3076977      0.02194364       0.3808905     0.11039383
## 6        0.9600486      0.03626414       0.3013586     0.12212455
## 7        0.5697584      0.02775928       0.4366802     0.34244148
## 8        0.0010000      0.00100000       0.0010000     0.00100000
## 9        0.9990000      0.00100000       0.5605254     0.11515797
## 10       0.9990000      0.00100000       0.7247930     0.65909574
## 11       0.9990000      0.00100000       0.5347506     0.05233033
## 12       0.9990000      0.00100000       0.5908064     0.15760718
## 13       0.9990000      0.00100000       0.4641196     0.17065338
## 14       0.0010000      0.00100000       0.0010000     0.00100000
## 15       0.7386199      0.15345034       0.5533273     0.51059037
## 16       0.6929914      0.15202286       0.6707071     0.43457653
## 17       0.2227605      0.66343721       0.4915034     0.41014424
## 18       0.0010000      0.00100000       0.0010000     0.00100000
##    end.func.brepl
## 1      0.38902297
## 2      0.13445378
## 3      0.00100000
## 4      0.45473967
## 5      0.27049662
## 6      0.17923405
## 7      0.09423873
## 8      0.00100000
## 9      0.44536745
## 10     0.06569727
## 11     0.48242031
## 12     0.43319925
## 13     0.29346624
## 14     0.00100000
## 15     0.04273692
## 16     0.23613055
## 17     0.08135913
## 18     0.00100000
withoutcontrols <- Results2[-c(1,6,11,17,21),]
withoutcontrols
##               ForestID Dist_trail Dist_edge Dist_trail_beginning
## 2             Lagoinha         50       293                  250
## 3             Lagoinha        235        50                  250
## 4  Mist\xe9rios_Negros          0         0                    0
## 5  Mist\xe9rios_Negros          0         0                  200
## 7  Mist\xe9rios_Negros         50        50                  200
## 8  Mist\xe9rios_Negros        600       600                 1880
## 9        Santa_Barbara          0       510                    0
## 10       Santa_Barbara          0       481                   50
## 12       Santa_Barbara          0       404                  401
## 13       Santa_Barbara         50       441                  401
## 14       Santa_Barbara        300       600                  401
## 15           Pico_Vara          0         0                    0
## 16           Pico_Vara          0         0                   50
## 18           Pico_Vara          0         0                  400
##    Dist_trail_std Dist_edge_std Dist_trail_beginning_std TAlphaAll
## 2        0.312279     0.9631886               0.47411353        10
## 3        1.467711     0.1643667               0.47411353         8
## 4        0.000000     0.0000000               0.00000000        17
## 5        0.000000     0.0000000               0.37929082        16
## 7        0.312279     0.1643667               0.37929082        11
## 8        3.747348     1.9723998               3.56533373        13
## 9        0.000000     1.6765398               0.00000000        12
## 10       0.000000     1.5812072               0.09482271        11
## 12       0.000000     1.3280825               0.76047810        14
## 13       0.312279     1.4497139               0.76047810        10
## 14       1.873674     1.9723998               0.76047810         9
## 15       0.000000     0.0000000               0.00000000        10
## 16       0.000000     0.0000000               0.09482271        11
## 18       0.000000     0.0000000               0.75858164        11
##    TAlphaNat TAlphaNInd TAlphaEnd FAlphaAll FAlphaNat FAlphaNInd FAlphaEnd
## 2          8          2         5  4.571896  3.649118  1.2911438  2.426661
## 3          8          0         6  3.748115  3.748115  0.0001000  2.736208
## 4         10          7         6  7.055960  4.811024  2.9836466  2.963138
## 5         11          5         6  6.188667  4.841288  1.7638506  2.963138
## 7          9          2         5  4.455256  3.885097  1.0704329  2.426661
## 8         10          3         7  5.157504  4.091758  1.4415752  3.405778
## 9         11          1         7  4.877473  4.591758  0.6455719  3.405778
## 10         9          2         6  4.826500  4.026895  1.2911438  2.804438
## 12        11          3         8  5.248713  4.678871  1.0704329  3.759558
## 13         9          1         6  3.913632  3.739558  0.6455719  2.484387
## 14         9          0         5  3.839360  3.839360  0.0001000  2.199731
## 15         8          2         5  3.662528  3.186972  1.0704329  2.265014
## 16         9          2         6  4.669753  4.026895  1.1820494  2.804438
## 18         9          2         5  4.424199  3.658167  1.1820494  2.199731
##    abund.all abund.nat abund.nind abund.end prop.Talpha prop.Falpha
## 2         92        90          2        81  0.20000000   0.7981628
## 3        139       139          0       111  0.00010000   0.9999000
## 4        111        99         12        64  0.41176471   0.6818383
## 5        147       115         32        94  0.31250000   0.7822829
## 7        167       148         19       128  0.18181818   0.8720254
## 8        159       114         45        82  0.23076923   0.7933601
## 9        134       130          4       115  0.08333333   0.9414216
## 10        66        63          3        43  0.18181818   0.8343304
## 12       207       184         23       169  0.21428571   0.8914321
## 13       115       113          2       108  0.10000000   0.9555211
## 14       154       154          0       135  0.00010000   0.9999000
## 15        87        77         10        66  0.20000000   0.8701564
## 16        90        82          8        70  0.18181818   0.8623358
## 18       159       157          2       138  0.18181818   0.8268540
##    prop.abund  prop.end all.tax.btotal all.tax.brich all.tax.brepl
## 2  0.02173913 0.8804348      0.5000000    0.16666667     0.3333333
## 3  0.00010000 0.7985612      0.0010000    0.00100000     0.0010000
## 4  0.10810811 0.5765766      0.5000000    0.20000000     0.3000000
## 5  0.21768707 0.6394558      0.3888889    0.16666667     0.2222222
## 7  0.11377246 0.7664671      0.5000000    0.12500000     0.3750000
## 8  0.28301887 0.5157233      0.0010000    0.00100000     0.0010000
## 9  0.02985075 0.8582090      0.5000000    0.21428571     0.2857143
## 10 0.04545455 0.6515152      0.5714286    0.14285714     0.4285714
## 12 0.11111111 0.8164251      0.5625000    0.31250000     0.2500000
## 13 0.01739130 0.9391304      0.4166667    0.08333333     0.3333333
## 14 0.00010000 0.8766234      0.0010000    0.00100000     0.0010000
## 15 0.11494253 0.7586207      0.5000000    0.07142857     0.4285714
## 16 0.08888889 0.7777778      0.5333333    0.00100000     0.5333333
## 18 0.01257862 0.8679245      0.0010000    0.00100000     0.0010000
##    nat.tax.btotal nat.tax.brich nat.tax.brepl nind.tax.btotal
## 2       0.4000000    0.00100000     0.4000000       0.9990000
## 3       0.0010000    0.00100000     0.0010000       0.0010000
## 4       0.3333333    0.00100000     0.3333333       0.7500000
## 5       0.3846154    0.07692308     0.3076923       0.4000000
## 7       0.4166667    0.08333333     0.3333333       0.7500000
## 8       0.0010000    0.00100000     0.0010000       0.0010000
## 9       0.4615385    0.15384615     0.3076923       0.9990000
## 10      0.5000000    0.00100000     0.5000000       0.9990000
## 12      0.4615385    0.15384615     0.3076923       0.9990000
## 13      0.3636364    0.00100000     0.3636364       0.9990000
## 14      0.0010000    0.00100000     0.0010000       0.0010000
## 15      0.4545455    0.09090909     0.3636364       0.6666667
## 16      0.5000000    0.00100000     0.5000000       0.6666667
## 18      0.0010000    0.00100000     0.0010000       0.0010000
##    nind.tax.brich nind.tax.brepl end.tax.btotal end.tax.brich
## 2           0.999      0.0010000      0.4285714     0.1428571
## 3           0.001      0.0010000      0.0010000     0.0010000
## 4           0.500      0.2500000      0.1428571     0.1428571
## 5           0.400      0.0010000      0.1428571     0.1428571
## 7           0.250      0.5000000      0.2857143     0.2857143
## 8           0.001      0.0010000      0.0010000     0.0010000
## 9           0.999      0.0010000      0.5000000     0.2500000
## 10          0.999      0.0010000      0.4285714     0.1428571
## 12          0.999      0.0010000      0.3750000     0.3750000
## 13          0.999      0.0010000      0.1666667     0.1666667
## 14          0.001      0.0010000      0.0010000     0.0010000
## 15          0.001      0.6666667      0.5714286     0.0010000
## 16          0.001      0.6666667      0.4285714     0.1428571
## 18          0.001      0.0010000      0.0010000     0.0010000
##    end.tax.brepl all.func.btotal all.func.brich all.func.brepl
## 2      0.2857143       0.4510427     0.31515581     0.13588692
## 3      0.0010000       0.0010000     0.00100000     0.00100000
## 4      0.0010000       0.5584348     0.25627825     0.30215660
## 5      0.0010000       0.2792181     0.06748164     0.21173649
## 7      0.0010000       0.3148084     0.04135440     0.27345396
## 8      0.0010000       0.0010000     0.00100000     0.00100000
## 9      0.2500000       0.5260492     0.10235769     0.42369155
## 10     0.2857143       0.6572888     0.53708446     0.12020438
## 12     0.0010000       0.5870997     0.20743412     0.37966555
## 13     0.0010000       0.4914517     0.21871146     0.27274028
## 14     0.0010000       0.0010000     0.00100000     0.00100000
## 15     0.5714286       0.5250878     0.43168162     0.09340618
## 16     0.2857143       0.6401026     0.37683904     0.26326358
## 18     0.0010000       0.0010000     0.00100000     0.00100000
##    nat.func.btotal nat.func.brich nat.func.brepl nind.func.btotal
## 2        0.4474493     0.33220517     0.11524413        0.9990000
## 3        0.0010000     0.00100000     0.00100000        0.0010000
## 4        0.5256001     0.09645607     0.42914408        0.8330498
## 5        0.3446691     0.01439418     0.33027495        0.3296413
## 7        0.3791924     0.21033381     0.16885860        0.5975177
## 8        0.0010000     0.00100000     0.00100000        0.0010000
## 9        0.5332315     0.12395226     0.40927928        0.9990000
## 10       0.6601833     0.56185864     0.09832462        0.9990000
## 12       0.5762955     0.13399572     0.44229977        0.9990000
## 13       0.4956483     0.23100532     0.26464296        0.9990000
## 14       0.0010000     0.00100000     0.00100000        0.0010000
## 15       0.5567426     0.49342135     0.06332120        0.8920702
## 16       0.6518425     0.42306199     0.22878048        0.8450143
## 18       0.0010000     0.00100000     0.00100000        0.0010000
##    nind.func.brich nind.func.brepl end.func.btotal end.func.brich
## 2        0.9990000      0.00100000       0.3865546      0.2521008
## 3        0.0010000      0.00100000       0.0010000      0.0010000
## 4        0.7085055      0.12454426       0.6243414      0.1696017
## 5        0.3076977      0.02194364       0.3808905      0.1103938
## 7        0.5697584      0.02775928       0.4366802      0.3424415
## 8        0.0010000      0.00100000       0.0010000      0.0010000
## 9        0.9990000      0.00100000       0.5605254      0.1151580
## 10       0.9990000      0.00100000       0.7247930      0.6590957
## 12       0.9990000      0.00100000       0.5908064      0.1576072
## 13       0.9990000      0.00100000       0.4641196      0.1706534
## 14       0.0010000      0.00100000       0.0010000      0.0010000
## 15       0.7386199      0.15345034       0.5533273      0.5105904
## 16       0.6929914      0.15202286       0.6707071      0.4345765
## 18       0.0010000      0.00100000       0.0010000      0.0010000
##    end.func.brepl
## 2      0.13445378
## 3      0.00100000
## 4      0.45473967
## 5      0.27049662
## 7      0.09423873
## 8      0.00100000
## 9      0.44536745
## 10     0.06569727
## 12     0.43319925
## 13     0.29346624
## 14     0.00100000
## 15     0.04273692
## 16     0.23613055
## 18     0.00100000
## Obtaining the several R2 values
###############
###CRUDE SOLUTION FOR CALCULATING R 
##################3

version1 <- function(m) {
  lmfit <-  lm(model.response(model.frame(m)) ~ fitted(m))
  summary(lmfit)$r.squared
  
}

## Ω20 (Xu 2003), which is almost the same, is based on comparing the residual variance of the full model against the 
##residual variance of a (fixed) intercept-only null model:

version2 <- function(m){
  
  1-var(residuals(m))/var(model.response(model.frame(m)))
  
}

## Another possibility is the squared correlation between the response variable and the predicted values:
version3 <- function(m){
  cor(model.response(model.frame(m)),predict(m,type="response"))^2
}


r2 <- function(model){
  
  print(" ")
  print("STANDARD R2")
  print(" ")
  print(performance::r2(model))
  print(" ")
  print(" ")
  print("NAKAGAWA")
  print(" ")
  print(performance::r2_nakagawa(model))
  print(" ")
  print("VERSION1")
  print(" ")
  print(version1(model))
  print(" ")
  print(" ")
  print("VERSION2")
  print(" ")
  print(version2(model))
  print(" ")
  print("VERSION3")
  print(" ")
  print(version3(model))
  
  } 
################
###CHECKING R2
#################

TAlphaNInd.glmm.5 = glmmTMB(TAlphaNInd ~   Dist_trail_beginning_std +(1 | ForestID), data= Results2,family = "poisson") 
r2(  TAlphaNInd.glmm.5   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: mu of 1.7 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.385
##      Marginal R2: 0.040
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: mu of 1.7 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.385
##      Marginal R2: 0.040
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.525133
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.4673168
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.525133
TAlphaNInd.glmm.6 = glmmTMB(TAlphaNInd ~ Dist_edge_std +  (1 | ForestID), data= Results2,family = "poisson") 
r2(  TAlphaNInd.glmm.6   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: mu of 1.7 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.283
##      Marginal R2: 0.030
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: mu of 1.7 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.283
##      Marginal R2: 0.030
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.3985183
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.3513795
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.3985183
FAlphaAll.glmm.9 = glmmTMB(FAlphaAll ~  Dist_trail_beginning_std + (1 | ForestID), data= Results2,family = "Gamma") 
## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation
## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation

## Warning in nlminb(start = par, objective = fn, gradient = gr, control =
## control$optCtrl): NA/NaN function evaluation
r2(  FAlphaAll.glmm.9   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## # R2 for Mixed Models
## 
##   Conditional R2: 0.023
##      Marginal R2: 0.001
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## # R2 for Mixed Models
## 
##   Conditional R2: 0.023
##      Marginal R2: 0.001
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.4749602
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.4110315
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.4749602
abund.all.glmm.14 = glmmTMB(abund.all ~   Dist_trail_std +(1 | ForestID), data= Results2,family = "nbinom1") 
r2(   abund.all.glmm.14  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.083
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.083
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.06579715
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.06326355
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.06579715
prop.Talpha.glmm.19 = glmmTMB(prop.Talpha ~   Dist_trail_std +(1 | ForestID), data= Results2,family = "beta_family") 
r2(  prop.Talpha.glmm.19   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: mu of 0.1 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.560
##      Marginal R2: 0.198
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: mu of 0.1 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.560
##      Marginal R2: 0.198
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.3085268
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.2902301
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.3085268
prop.Falpha.glmm.21 = glmmTMB(prop.Falpha ~   Dist_trail_std + (1 | ForestID), data= Results2,family = "beta_family") 
r2(  prop.Falpha.glmm.21   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## # R2 for Mixed Models
## 
##   Conditional R2: 1.190
##      Marginal R2: 0.336
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## # R2 for Mixed Models
## 
##   Conditional R2: 1.190
##      Marginal R2: 0.336
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.2343031
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.2058367
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.2343031
dredge.24 = dredge(glmmTMB(all.tax.btotal ~ Dist_trail_beginning_std + Dist_trail_std + Dist_edge_std +  (1 | ForestID), data= withoutcontrols,family = "beta_family"))
## Fixed terms are "cond((Int))" and "disp((Int))"
dredge.24
## Global model call: glmmTMB(formula = all.tax.btotal ~ Dist_trail_beginning_std + 
##     Dist_trail_std + Dist_edge_std + (1 | ForestID), data = withoutcontrols, 
##     family = "beta_family", ziformula = ~0, dispformula = ~1)
## ---
## Model selection table 
##   cnd((Int)) dsp((Int)) cnd(Dst_edg_std) cnd(Dst_trl_bgn_std)
## 5    -0.4790          +                                      
## 6    -0.8101          +           0.5579                     
## 3    -0.5005          +                              -0.78720
## 1    -0.9393          +                                      
## 7    -0.4681          +                              -0.04445
## 2    -0.7595          +          -0.2241                     
## 4    -0.6036          +           0.1980             -0.88510
## 8    -0.7570          +           0.5615             -0.17960
##   cnd(Dst_trl_std) df logLik  AICc delta weight
## 5          -0.8739  4 12.035 -11.6  0.00  0.606
## 6          -1.1490  5 13.103  -8.7  2.92  0.141
## 3                   4 10.211  -8.0  3.65  0.098
## 1                   3  7.990  -7.6  4.05  0.080
## 7          -0.8566  5 12.037  -6.6  5.05  0.048
## 2                   4  8.182  -3.9  7.71  0.013
## 4                   5 10.352  -3.2  8.42  0.009
## 8          -1.0950  6 13.136  -2.3  9.35  0.006
## Models ranked by AICc(x) 
## Random terms (all models): 
## 'cond(1 | ForestID)'
all.tax.btotal.glmm.24 = glmmTMB(all.tax.btotal ~    (1 | ForestID), data= withoutcontrols,family = "beta_family") 

all.tax.brich.glmm.25 = glmmTMB(all.tax.btotal ~   Dist_trail_std +(1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(  all.tax.brich.glmm.25  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.717
##      Marginal R2: 0.708
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## # R2 for Mixed Models
## 
##   Conditional R2: 0.717
##      Marginal R2: 0.708
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.5989002
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.5302905
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.5989002
all.tax.brich.glmm.25a = glmmTMB(all.tax.btotal  ~ Dist_edge_std + Dist_trail_std +(1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(  all.tax.brich.glmm.25a   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.790
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.790
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.5874673
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.572622
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.5874673
nind.tax.btotal.glmm.31 = glmmTMB(nind.tax.btotal ~ Dist_edge_std +  (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(  nind.tax.btotal.glmm.31   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 1.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: -1.768
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 1.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: -1.768
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.01294264
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.01176139
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.01294264
nind.tax.brich.glmm.32 = glmmTMB(nind.tax.brich ~ Dist_edge_std +  (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(  nind.tax.brich.glmm.32   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 0.9 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.730
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.9 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.730
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.1813694
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.154714
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.1813694
end.tax.btotal.glmm.35 = glmmTMB(end.tax.btotal ~   Dist_trail_std +(1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(   end.tax.btotal.glmm.35  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 0.3 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.575
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.3 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.575
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.3969704
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.3532717
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.3969704
all.func.btotal.glmm.39 = glmmTMB(all.func.btotal ~ Dist_edge_std +  (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(   all.func.btotal.glmm.39  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.048
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.048
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.002098823
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] -0.003740786
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.002098823
nat.func.btotal.glmm.43 = glmmTMB(nat.func.btotal ~  Dist_trail_beginning_std + (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(  nat.func.btotal.glmm.43   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.564
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.564
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.4119036
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.3343611
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.4119036
nind.func.btotal.glmm.46 = glmmTMB(nind.func.btotal ~ Dist_edge_std +  (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(   nind.func.btotal.glmm.46  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 1.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: -0.613
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 1.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: -0.613
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.003388029
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] -0.0003418351
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.003388029
nind.func.brich.glmm.48 = glmmTMB(nind.func.brich ~ Dist_edge_std +  (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(   nind.func.brich.glmm.48  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 1.1 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: -3.676
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 1.1 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: -3.676
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.02100292
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.02088823
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.02100292
end.func.btotal.glmm.50 = glmmTMB(end.func.btotal ~  Dist_trail_beginning_std + (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(   end.func.btotal.glmm.50  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.588
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.4 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.588
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.4439095
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.3503584
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.4439095
end.func.brich.glmm.52 = glmmTMB(end.func.brich ~  Dist_trail_beginning_std + (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(   end.func.brich.glmm.52  )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!
## Warning: mu of 0.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.438
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.438
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.3243946
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] 0.2523689
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.3243946
end.func.brepl.glmm.54 = glmmTMB(end.func.brepl ~ Dist_edge_std +  (1 | ForestID), data= withoutcontrols,family = "beta_family") 
r2(  end.func.brepl.glmm.54   )
## [1] " "
## [1] "STANDARD R2"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.015
## [1] " "
## [1] " "
## [1] "NAKAGAWA"
## [1] " "
## Warning: Can't compute random effect variances. Some variance components equal zero.
##   Solution: Respecify random structure!

## Warning: mu of 0.2 is too close to zero, estimate of random effect variances may be unreliable.
## Random effect variances not available. Returned R2 does not account for random effects.
## # R2 for Mixed Models
## 
##   Conditional R2: NA
##      Marginal R2: 0.015
## [1] " "
## [1] "VERSION1"
## [1] " "
## [1] 0.0001037741
## [1] " "
## [1] " "
## [1] "VERSION2"
## [1] " "
## [1] -0.008681977
## [1] " "
## [1] "VERSION3"
## [1] " "
## [1] 0.0001037741