Environmental conditions and the presence of an endangered predator differentially shape arthropod communities across Gambelia sila’s historic range

library(ggplot2)
library(ggnewscale)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(performance)
library(glmmTMB)
library(emmeans)
library(RColorBrewer)
library(mvabund)
library(tidyr)
library(vegan)
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.6-4
library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
library(ggpubr)
active.shrub <-read.csv("Clean Data/active.shrub.cleaned.csv")
active.shrub <- mutate(active.shrub, site.shrub = ifelse(Site == "CaSl" | Site == "Coal" | Site == "Mov", "unshrubbed", "shrubbed"))
active.shrub <- mutate(active.shrub, bnll = ifelse(Site == "SiCr" | Site == "Coal" | Site == "Mov" | Site == "Aven", "absent", "present"))

temp <- read.csv("Clean Data/temps.csv")
temp <- rename(temp, Site = site)

active.shrub$Site <- gsub("LoK", "Lok", active.shrub$Site)
active.shrub <- left_join(active.shrub, temp, by = c("Site", "month", "day"))

#active transects

active.open <- read.csv("Clean Data/active_sweeps.csv")
active.open <- rename(active.open, Site = site)
active.open <- mutate(active.open, site.shrub = ifelse(Site == "CaSl" | Site == "Coal" | Site == "Mov", "unshrubbed", "shrubbed"))
active.open <- mutate(active.open, bnll = ifelse(Site == "SiCr" | Site == "Coal" | Site == "Mov" | Site == "Aven", "absent", "present"))

sum(active.open$wide.sweep.abun)
## [1] 769
active.open <- left_join(active.open, temp, by = c("Site", "month", "day"))

active.hoppers <- read.csv("Clean Data/by taxa/active_hoppers.csv")
active.hoppers <- mutate(active.hoppers, site.shrub = ifelse(Site == "CaSl" | Site == "Coal" | Site == "Mov", "unshrubbed", "shrubbed"))
active.hoppers <- mutate(active.hoppers, bnll = ifelse(Site == "SiCr" | Site == "Coal" | Site == "Mov" | Site == "Aven", "absent", "present"))

sum(active.hoppers$wide.hop.abun)
## [1] 377
active.hoppers <- left_join(active.hoppers, temp, by = c("Site", "month", "day"))


mal <- read.csv("Clean Data/malaise.csv")
mal <- rename(mal, Site = site)
mal$Site <- gsub("LoK", "Lok", mal$Site)
mal$Site <- gsub("PaPL", "PaPl", mal$Site)

See cleaning.R and cleaning_taxa. R for cleaning of raw data

Summary Tables

Open vegetation

#we have vegetation in quadrats for pitfalls
#we also have vegetation in quadrats for 10 transects

site.veg <- read.csv("Clean Data/site_veg.csv")

veg.summary <- site.veg %>% group_by(Site) %>% summarize(mean.veg =                                                 mean(dry.veg.percent), 
                                  sd.veg = sd(dry.veg.percent),
                                  mean.bare = mean(bare.ground.percent),
                                  sd.bare = sd(bare.ground.percent),
                                  mean.green = mean(green.veg.percent),
                                  sd.green = sd(green.veg.percent),
                                  mean.rocks = mean(rocks.percent),
                                  sd.rocks = sd(rocks.percent),
                                  mean.woody = mean(woody.debris.percent),
                                  sd.woody = sd(woody.debris.percent),
                            mean.veg.height = mean(veg.height, na.rm = TRUE),
                                  sd.veg.height = sd(veg.height, na.rm = TRUE))

Site <- veg.summary$Site
veg.summary <- select(veg.summary, -Site)
veg.summary <- round(veg.summary, 1)
veg.summary$Site <- Site
veg.summary <- mutate(veg.summary, dried_cover = paste(mean.veg,"±",sd.veg),
                        bare_cover = paste(mean.bare,"±",sd.bare),
                        green_cover = paste(mean.green,"±",sd.green),
                        rocky_cover = paste(mean.rocks,"±",sd.rocks),
                      woody_cover = paste(mean.woody,"±",sd.woody),
                      veg_height = paste(mean.veg.height,"±",sd.veg.height)
                        )
veg.summary.table <- select(veg.summary, Site, 14:19)
knitr::kable(veg.summary.table)
Site dried_cover bare_cover green_cover rocky_cover woody_cover veg_height
Aven 61.4 ± 39 33.7 ± 37.2 1.8 ± 10.7 1.7 ± 5.8 1.3 ± 7.7 21.4 ± 21.5
CaS 49.2 ± 28.7 41.6 ± 28.8 2 ± 10.9 3.3 ± 6.2 4 ± 10.3 13.7 ± 14
CaSl 46.2 ± 28.8 41.5 ± 24.8 1 ± 3.8 2.5 ± 5.4 8.8 ± 16.7 11.9 ± 9.1
Coal 63.4 ± 37.2 31.2 ± 36.2 4.3 ± 8.9 0.6 ± 1.7 0.5 ± 1.1 16.1 ± 14
Lok 58.9 ± 32.9 37.3 ± 32.1 1.1 ± 5.9 1.4 ± 2.1 1.3 ± 4.6 19.7 ± 11.7
Mov 65.6 ± 23 32.7 ± 23.2 0.9 ± 1.7 0.5 ± 1.2 0.3 ± 0.8 9 ± 4.3
PaPl 76.2 ± 25.2 22.5 ± 24.7 0.4 ± 2.3 1.1 ± 1.8 0.3 ± 0.8 17.6 ± 8
SemiT 40.9 ± 40.2 57.8 ± 40.8 0.6 ± 7.5 0 ± 0.1 0.7 ± 2.7 13.6 ± 15.5
Silver Creek 63.4 ± 34.9 35.6 ± 34.4 0.1 ± 0.4 0.4 ± 1.1 0.5 ± 3.4 12.8 ± 11.6

Pitfalls

pit <- read.csv("Clean Data/arth_cleanSP.csv")

#add a column for shrubbed vs unshrubbed site
pit <- mutate(pit, site.shrub = ifelse(Site == "CaSl" | Site == "Coal" | Site == "Mov", "unshrubbed", "shrubbed"))

pit <- mutate(pit, bnll = ifelse(Site == "SiCr" | Site == "Coal" | Site == "Mov" | Site == "Aven", "absent", "present"))


pitfall.summary <- pit %>% group_by(Site, month, Microsite) %>%
                          summarise(mean.abun = mean(abun),
                                    sd.abun = sd(abun),
                                    mean.richness = mean(Species),
                                    sd.richness = sd(Species),
                                    mean.H = mean(H),
                                    sd.H = sd(H))
## `summarise()` has grouped output by 'Site', 'month'. You can override using the
## `.groups` argument.
pitfall.summary[,4:9] <- round(pitfall.summary[,4:9], 1)
pitfall.summary <- mutate(pitfall.summary, 
                          Abundance = paste(mean.abun,"±", sd.abun),
                          Species_richness = paste(mean.richness,"±", sd.richness),
                          Shannons_diversity_index = paste(mean.H,"±", sd.H))

pitfall.summary.display <- select(pitfall.summary, 1:3, 10:12)
knitr::kable(pitfall.summary.display)
Site month Microsite Abundance Species_richness Shannons_diversity_index
Aven Aug open 10.4 ± 5.1 3.9 ± 1.2 1 ± 0.4
Aven Aug shrub 15.2 ± 12.6 5 ± 2.3 1.1 ± 0.6
Aven July open 13.3 ± 14.9 4.2 ± 2.7 1 ± 0.7
Aven July shrub 11.3 ± 13 3.8 ± 1.1 1 ± 0.4
Aven Sept open 11.5 ± 13 5 ± 2.3 1.3 ± 0.5
Aven Sept shrub 5.9 ± 2.4 4.2 ± 1.6 1.2 ± 0.5
CaS Aug open 53.2 ± 47.8 7.4 ± 2.1 1.2 ± 0.4
CaS Aug shrub 129.6 ± 112.1 8.4 ± 1.9 0.9 ± 0.3
CaS July open 20.5 ± 17.3 6.8 ± 2.6 1.5 ± 0.4
CaS July shrub 48.9 ± 38.5 11.1 ± 4.3 1.6 ± 0.5
CaS Sept open 33.3 ± 31.5 5.4 ± 1.9 0.9 ± 0.3
CaS Sept shrub 50.4 ± 58.8 4.2 ± 1.7 0.7 ± 0.4
CaSl Aug open 65.6 ± 104.4 6.9 ± 2.1 1 ± 0.5
CaSl July open 52.6 ± 75.4 10.7 ± 4.9 1.6 ± 0.7
CaSl Sept open 14.6 ± 28.6 3.6 ± 2 0.9 ± 0.6
Coal Aug open 16.5 ± 25.9 5 ± 1.7 1.3 ± 0.4
Coal July open 22.8 ± 24.8 6 ± 2.4 1.3 ± 0.6
Coal Sept open 9.3 ± 5.2 5.3 ± 2 1.4 ± 0.4
Lok Aug open 15.3 ± 26.1 4 ± 2.2 0.9 ± 0.6
Lok Aug shrub 31.3 ± 83.6 4.1 ± 1.6 1.2 ± 0.4
Lok July open 7.6 ± 9.6 3 ± 2.3 0.7 ± 0.7
Lok July shrub 9.8 ± 10.1 5.4 ± 2.7 1.4 ± 0.7
Lok Sept open 11.8 ± 13.9 3 ± 1.5 0.7 ± 0.5
Lok Sept shrub 13.8 ± 12.4 3.2 ± 1.7 0.7 ± 0.6
Mov Aug open 25.8 ± 39.1 4.8 ± 2 1.1 ± 0.5
Mov July open 19.2 ± 20.9 5.7 ± 2.2 1.3 ± 0.6
Mov Sept open 34.5 ± 34.7 6.1 ± 2.7 1.1 ± 0.5
PaPl Aug open 10 ± 7.9 2.7 ± 1.2 0.6 ± 0.5
PaPl Aug shrub 30.6 ± 29.8 4.6 ± 2.3 0.8 ± 0.6
PaPl July open 184.4 ± 569.9 3.8 ± 2.4 0.8 ± 0.7
PaPl July shrub 41.7 ± 31.2 5.4 ± 2.1 0.7 ± 0.3
PaPl Sept open 11.4 ± 11.4 3.1 ± 2 0.7 ± 0.5
PaPl Sept shrub 10.2 ± 8.3 2.9 ± 1.6 0.6 ± 0.4
SemiT Aug open 5.5 ± 3 3.5 ± 1.6 1.1 ± 0.6
SemiT Aug shrub 7.2 ± 4.8 4.7 ± 2.3 1.3 ± 0.5
SemiT July open 15 ± 10.5 3.5 ± 1.7 0.8 ± 0.4
SemiT July shrub 20.1 ± 19.8 5.2 ± 2.2 1.2 ± 0.4
SemiT Sept open 7.8 ± 8 2.8 ± 1.4 0.6 ± 0.4
SemiT Sept shrub 6.2 ± 5.2 2.4 ± 1.6 0.6 ± 0.6
SiCr Aug open 18.8 ± 11.4 6.2 ± 1.9 1.2 ± 0.4
SiCr Aug shrub 34.5 ± 28.2 5.9 ± 1.8 1.1 ± 0.3
SiCr July open 16.2 ± 8.1 4.5 ± 2.3 1 ± 0.6
SiCr July shrub 55.5 ± 34.8 7.1 ± 2.5 1.1 ± 0.4
SiCr Sept open 51.7 ± 104.4 4.9 ± 1.5 0.9 ± 0.5
SiCr Sept shrub 73.2 ± 128.7 5.7 ± 2.9 0.8 ± 0.5
sum(pit$abun)
## [1] 18542
arth.long <- read.csv("Clean Data/arth_long.csv")
sum(arth.long$quantity)
## [1] 18851
length(unique(arth.long$highest.rtu))
## [1] 177
sp.list <- unique(arth.long$highest.rtu)

# filter(arth.long, family == "Formicidae") %>% pull(quantity) %>% sum()
# filter(arth.long, family == "Formicidae") %>% pull(highest.rtu) %>% unique() %>% length()
# filter(arth.long, highest.rtu == "Solenopsisxyloni") %>% pull(quantity) %>% sum()
# filter(arth.long, highest.rtu == "Pheidolehyatti") %>% pull(quantity) %>% sum()
# formi <- filter(arth.long, family == "Formicidae") %>% group_by(highest.rtu) %>% summarise(abun = sum(quantity))


site.count <- arth.long %>% group_by(highest.rtu) %>% mutate(coun = n_distinct(as.character(site)))
mounth.count <-  arth.long %>% group_by(highest.rtu) %>% summarise(month = unique(month))
## Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
## dplyr 1.1.0.
## ℹ Please use `reframe()` instead.
## ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
##   always returns an ungrouped data frame and adjust accordingly.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `summarise()` has grouped output by 'highest.rtu'. You can override using the
## `.groups` argument.

join site-level covariates

sites <- read.csv("Clean Data/sites_joined.csv")
#nooo its broken
#ha nonsense 
sites$month <- as.character(sites$month)
pit <- left_join(pit, sites, by = c("Site", "month"))
str(pit)
## 'data.frame':    626 obs. of  45 variables:
##  $ X.x                 : int  340 349 350 351 341 342 343 344 345 346 ...
##  $ Site                : chr  "Aven" "Aven" "Aven" "Aven" ...
##  $ month               : chr  "Aug" "Aug" "Aug" "Aug" ...
##  $ Method              : chr  "pitfall" "pitfall" "pitfall" "pitfall" ...
##  $ Microsite           : chr  "open" "open" "open" "open" ...
##  $ Rep                 : int  1 10 11 12 2 3 4 5 6 7 ...
##  $ field.micro         : chr  "open1" "open10" "open11" "open12" ...
##  $ shrub.x             : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ shrub.y             : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ shrub.z             : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ dry.veg.percent     : int  100 100 100 16 90 97 3 0 0 19 ...
##  $ green.veg.percent   : int  0 0 0 0 0 0 0 0 0 4 ...
##  $ woody.debris.percent: int  0 0 0 0 10 0 0 3 0 0 ...
##  $ rocks.percent       : int  0 0 0 6 0 0 12 15 6 7 ...
##  $ bare.ground.percent : int  0 0 0 78 0 3 85 82 94 70 ...
##  $ sum_percent         : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ veg..height         : int  25 29 33 10 56 50 9 NA NA 9 ...
##  $ dominant.type       : chr  "grass" "grass" "grass" "herb" ...
##  $ dried.              : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
##  $ notes               : chr  "" "" "" "" ...
##  $ uniID               : chr  "AvenAugopen1" "AvenAugopen10" "AvenAugopen11" "AvenAugopen12" ...
##  $ abun                : int  9 9 10 4 16 3 7 8 12 11 ...
##  $ H                   : num  1.06 0 1.09 1.04 1.25 ...
##  $ Simpson             : num  0.642 0 0.58 0.625 0.656 ...
##  $ Species             : int  3 1 4 3 5 3 5 4 5 4 ...
##  $ Even                : num  0.966 NA 0.785 0.946 0.776 ...
##  $ site.shrub          : chr  "shrubbed" "shrubbed" "shrubbed" "shrubbed" ...
##  $ bnll                : chr  "absent" "absent" "absent" "absent" ...
##  $ X.1                 : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ X.y                 : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ mean.cover          : num  61 61 61 61 61 61 61 61 61 61 ...
##  $ var.cover           : num  1270 1270 1270 1270 1270 ...
##  $ mean.bare           : num  36.6 36.6 36.6 36.6 36.6 ...
##  $ var.bare            : num  1267 1267 1267 1267 1267 ...
##  $ mean.height         : num  17.5 17.5 17.5 17.5 17.5 ...
##  $ var.height          : num  157 157 157 157 157 ...
##  $ name                : chr  "MAL" "MAL" "MAL" "MAL" ...
##  $ year                : int  2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 ...
##  $ day                 : chr  "08 17:34:09.000" "08 17:34:09.000" "08 17:34:09.000" "08 17:34:09.000" ...
##  $ Lat                 : num  36.1 36.1 36.1 36.1 36.1 ...
##  $ Long                : num  -120 -120 -120 -120 -120 ...
##  $ Temp                : int  174 174 174 174 174 174 174 174 174 174 ...
##  $ Prec                : int  196 196 196 196 196 196 196 196 196 196 ...
##  $ Max                 : int  378 378 378 378 378 378 378 378 378 378 ...
##  $ arid                : num  1.07 1.07 1.07 1.07 1.07 ...
pit$bnll <- as.factor(pit$bnll)
#pit$bnll <- relevel(pit$bnll, "present") 

sites <- mutate(sites, site.shrub = ifelse(Site == "CaSl" | Site == "Coal" | Site == "Mov", "unshrubbed", "shrubbed"))

sites <- mutate(sites, bnll = ifelse(Site == "SiCr" | Site == "Coal" | Site == "Mov" | Site == "Aven", "absent", "present"))


sitesrem <- read.csv("Raw Data/sites_remotesensing.csv")
sitesrem <- select(sitesrem, month, site, NDVI)
sitesrem <- rename(sitesrem, Site = site)
sitesrem$Site <- gsub("MoV", "Mov", sitesrem$Site)
pit <- left_join(pit, sitesrem, by = c("Site", "month"))

#join to order dataset and family too
#order <- left_join(order, sites, by = c("Site", "month"))
#family <- left_join(family, sites, by = c("Site", "month"))

active.open <- left_join(active.open, sites, by = c("Site", "month"))
active.open <- left_join(active.open, sitesrem, by = c("Site", "month"))

active.shrub <- left_join(active.shrub, sites, by = c("Site", "month"))
active.shrub <- left_join(active.shrub, sitesrem, by = c("Site", "month"))
active.hoppers <- left_join(active.hoppers, sites, by = c("Site", "month"))
active.hoppers <- left_join(active.hoppers, sitesrem, by = c("Site", "month"))







mal <- left_join(mal, sites, by = c("Site", "month"))
mal <- left_join(mal, sitesrem, by = c("Site", "month"))

noants <- read.csv("Clean Data/by taxa/no_ants.csv")
noants <- left_join(noants, sites, by = c("Site", "month"))
noants <- left_join(noants, sitesrem, by = c("Site", "month"))
#ants <- left_join(ants, sites, by = c("Site", "month"))

nosings <- read.csv("Clean Data/by taxa/no_singles.csv")
nosings <- left_join(nosings, sites, by = c("Site", "month"))
nosings <- left_join(nosings, sitesrem, by = c("Site", "month"))


spids <- read.csv("Clean Data/by taxa/spids.csv")
spids <- left_join(spids, sites, by = c("Site", "month"))
spids <- left_join(spids, sitesrem, by = c("Site", "month"))


col <- read.csv("Clean Data/by taxa/coleo.csv")
col <- left_join(col, sites, by = c("Site", "month"))
col <- left_join(col, sitesrem, by = c("Site", "month"))

hops <- read.csv("Clean Data/by taxa/pit_hoppers.csv")
hops <- left_join(hops, sites, by = c("Site", "month"))
hops <- left_join(hops, sitesrem, by = c("Site", "month"))

#no_pit_meta <- left_join(no_pit_meta, sites, by = c("Site", "month"))
#no_shrub_meta <- left_join(no_shrub_meta, sites, by = c("Site", "month"))
#no_sweep_meta <- left_join(no_sweep_meta, sites, by = c("Site", "month"))

Environmental data

envsites <- left_join(sites, sitesrem, by = c("Site", "month"))
envsitescat <- select(envsites,3:10, 16:22)
envsites <- select(envsites,5:10, 16:19, 22)
library(corrplot)
## corrplot 0.92 loaded
c <- cor(envsites)
corrplot(c, method = "number")

Data Viz

environment

ggplot(envsitescat, aes(bnll, NDVI)) + geom_boxplot()

t.test(NDVI ~ bnll, envsitescat)
## 
##  Welch Two Sample t-test
## 
## data:  NDVI by bnll
## t = -0.0095635, df = 17.711, p-value = 0.9925
## alternative hypothesis: true difference in means between group absent and group present is not equal to 0
## 95 percent confidence interval:
##  -220.9373  218.9373
## sample estimates:
##  mean in group absent mean in group present 
##              2349.667              2350.667
ggplot(envsitescat, aes(bnll, mean.height)) + geom_boxplot()

t.test(mean.height ~ bnll, envsitescat)
## 
##  Welch Two Sample t-test
## 
## data:  mean.height by bnll
## t = -0.30102, df = 20.686, p-value = 0.7664
## alternative hypothesis: true difference in means between group absent and group present is not equal to 0
## 95 percent confidence interval:
##  -4.614423  3.448408
## sample estimates:
##  mean in group absent mean in group present 
##              14.82597              15.40898
ggplot(envsitescat, aes(bnll, mean.cover)) + geom_boxplot()

t.test(mean.cover ~ bnll, envsitescat)
## 
##  Welch Two Sample t-test
## 
## data:  mean.cover by bnll
## t = 1.5236, df = 24.519, p-value = 0.1404
## alternative hypothesis: true difference in means between group absent and group present is not equal to 0
## 95 percent confidence interval:
##  -3.232517 21.539739
## sample estimates:
##  mean in group absent mean in group present 
##              63.45139              54.29778
ggplot(envsitescat, aes(bnll, arid)) + geom_boxplot()

t.test(arid ~ bnll, envsitescat)
## 
##  Welch Two Sample t-test
## 
## data:  arid by bnll
## t = -3.4191, df = 14.441, p-value = 0.003991
## alternative hypothesis: true difference in means between group absent and group present is not equal to 0
## 95 percent confidence interval:
##  -1.4112773 -0.3251472
## sample estimates:
##  mean in group absent mean in group present 
##              1.243581              2.111793
# shrubbed sites have different veg 
ggplot(envsitescat, aes(site.shrub, mean.height)) + geom_boxplot()

t.test(mean.height ~ site.shrub, envsitescat)
## 
##  Welch Two Sample t-test
## 
## data:  mean.height by site.shrub
## t = 2.4661, df = 18.661, p-value = 0.02354
## alternative hypothesis: true difference in means between group shrubbed and group unshrubbed is not equal to 0
## 95 percent confidence interval:
##  0.632675 7.790152
## sample estimates:
##   mean in group shrubbed mean in group unshrubbed 
##                 16.55367                 12.34225
ggplot(envsitescat, aes(site.shrub, mean.cover)) + geom_boxplot()

t.test(mean.cover ~ site.shrub, envsitescat)
## 
##  Welch Two Sample t-test
## 
## data:  mean.cover by site.shrub
## t = -0.0081755, df = 15.918, p-value = 0.9936
## alternative hypothesis: true difference in means between group shrubbed and group unshrubbed is not equal to 0
## 95 percent confidence interval:
##  -14.70821  14.59525
## sample estimates:
##   mean in group shrubbed mean in group unshrubbed 
##                 58.34722                 58.40370
ggplot(envsitescat, aes(site.shrub, NDVI)) + geom_boxplot()

t.test(NDVI ~ site.shrub, envsitescat)
## 
##  Welch Two Sample t-test
## 
## data:  NDVI by site.shrub
## t = -0.97828, df = 24.875, p-value = 0.3374
## alternative hypothesis: true difference in means between group shrubbed and group unshrubbed is not equal to 0
## 95 percent confidence interval:
##  -257.78222   91.78222
## sample estimates:
##   mean in group shrubbed mean in group unshrubbed 
##                 2322.556                 2405.556
cor.test(pit$mean.cover, pit$var.cover)
## 
##  Pearson's product-moment correlation
## 
## data:  pit$mean.cover and pit$var.cover
## t = -12.989, df = 624, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5208658 -0.3973336
## sample estimates:
##        cor 
## -0.4613326
cor.test(pit$arid, pit$var.cover)
## 
##  Pearson's product-moment correlation
## 
## data:  pit$arid and pit$var.cover
## t = -14.538, df = 624, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5593083 -0.4420513
## sample estimates:
##        cor 
## -0.5029907
cor.test(pit$arid, pit$mean.cover)
## 
##  Pearson's product-moment correlation
## 
## data:  pit$arid and pit$mean.cover
## t = -2.9221, df = 624, p-value = 0.003602
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.19279480 -0.03817109
## sample estimates:
##        cor 
## -0.1161869
cor.test(pit$arid, pit$NDVI)
## 
##  Pearson's product-moment correlation
## 
## data:  pit$arid and pit$NDVI
## t = -1.5102, df = 624, p-value = 0.1315
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.13805518  0.01810419
## sample estimates:
##         cor 
## -0.06034472
ggplot(pit, aes(month, dry.veg.percent)) + geom_boxplot()

ggplot(pit, aes(site.shrub, NDVI)) + geom_boxplot()

ggplot(pit, aes(arid, mean.cover)) + geom_smooth(method = "lm")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(pit, aes(site.shrub, arid)) + geom_boxplot()

Pitfall species richness

ggplot(data = pit, aes(Microsite, Species, fill = Site)) + geom_boxplot()

ggplot(data = pit, aes(Site, Species, fill = Microsite)) + geom_boxplot()

labels <- levels(pit$bnll)
labels <- setNames(labels, labels)

levels(pit$bnll)
## [1] "absent"  "present"
pit$bnll <- factor(pit$bnll, levels = c("present", "absent"))

ggplot(data = filter(pit, bnll == "present")) + geom_boxplot(aes(bnll, Species,fill = Site)) + stat_summary(aes(bnll, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present") + new_scale_fill()  +
  geom_boxplot(data = filter(pit, bnll == "absent"), aes(bnll, Species,fill = Site)) + stat_summary(data = filter(pit, bnll == "absent"), aes(bnll, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 2)) + scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") + ylab("Arthropod Species Richness \n(species/pitfall trap)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) 
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.

#ok, the different sides need new colours but I can split the legend finally.

pit$month <- factor(pit$month, c("July", "Aug", "Sept"))

ggplot(data = filter(pit, bnll == "present")) + geom_boxplot(aes(bnll, Species,fill = Site)) + scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(pit, bnll == "absent"), aes(bnll, Species,fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + 
  labs(fill = "Absent") + facet_grid(~month) + ylab("Arthropod Species Richness \n(species/pitfall trap)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) 
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.

ggplot(data = pit, aes(Site, Species)) + geom_boxplot() + facet_grid(~month)

ggplot(data = pit, aes(Microsite, Species, fill = Site)) + geom_boxplot() + facet_grid(~month)

#this one looks too busy to split so many ways
#lets just order the sites the same ways as above

ggplot(data = pit, aes(Site, Species, color = Microsite, fill = Site)) + geom_boxplot()

ggplot(data = filter(pit, bnll == "present")) + geom_boxplot(aes(bnll, Species,color = Microsite, fill = Site)) + scale_fill_discrete(guide = guide_legend(order = 1))+ new_scale_fill() +
  geom_boxplot(data = filter(pit, bnll == "absent"), aes(bnll, Species, color = Microsite, fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + scale_x_discrete(limits = c("present", "absent")) + facet_grid(~month)

Pitfall - Abundance

pit$bnll <- relevel(pit$bnll, ref = "absent")


abundata <- filter(pit, abun < 1000)

ggplot(data = filter(abundata, bnll == "present")) + geom_boxplot(aes(bnll, abun,fill = Site)) + stat_summary(aes(bnll, abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(abundata, bnll == "absent"), aes(bnll, abun,fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + 
   stat_summary(data = filter(abundata, bnll == "absent"), aes(bnll, abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Arthropod Abundance (captures/pitfall trap)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) 
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.

ggplot(abundata, aes(Microsite, abun, fill = Site)) + geom_boxplot()

ggplot(data = abundata, aes(bnll, abun,
                            fill = Site)) + geom_boxplot()

ggplot(data = abundata, aes(Site, abun, fill = Microsite)) + geom_boxplot()

ggplot(data = abundata, aes(bnll, abun)) + geom_boxplot()

ggplot(data = abundata, aes(Microsite, abun, fill = Site)) + geom_boxplot() + facet_grid(~month)

ggplot(data = abundata, aes(Site, abun, fill = Microsite)) + geom_boxplot()+ facet_grid(~month)

ggplot(abundata, aes(arid, abun, fill = bnll)) + geom_smooth(method = "lm")
## `geom_smooth()` using formula = 'y ~ x'

GLMM for environmental drivers

Pitfalls

Abundance

sum(pit$abun)
## [1] 18542
sum(abundata$abun)
## [1] 16640
m1 <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site), family = poisson(link = "log"), data = abundata)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m1)
## # Overdispersion test
## 
##        dispersion ratio =    50.874
##   Pearson's Chi-Squared = 31338.579
##                 p-value =   < 0.001
## Overdispersion detected.
m1 <- glmmTMB(abun ~ bnll +   (1|Site), family = "nbinom2", data = abundata)
summary(m1)
##  Family: nbinom2  ( log )
## Formula:          abun ~ bnll + (1 | Site)
## Data: abundata
## 
##      AIC      BIC   logLik deviance df.resid 
##   5208.8   5226.6  -2600.4   5200.8      621 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.3341   0.578   
## Number of obs: 625, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 0.964 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  3.07465    0.29592  10.390   <2e-16 ***
## bnllpresent  0.09674    0.39687   0.244    0.807    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(m1)
## [1] 5208.824
m1.nb <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI +  (1|Site), family = "nbinom2", data = abundata)
summary(m1.nb)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + arid + Microsite + mean.height + mean.cover + dry.veg.percent +  
##     NDVI + (1 | Site)
## Data: abundata
## 
##      AIC      BIC   logLik deviance df.resid 
##   5176.2   5220.6  -2578.1   5156.2      615 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.05496  0.2344  
## Number of obs: 625, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.01 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      2.8624240  0.6026925   4.749 2.04e-06 ***
## bnllpresent     -0.4961149  0.2122171  -2.338   0.0194 *  
## arid             0.6222207  0.1271684   4.893 9.94e-07 ***
## Micrositeshrub   0.4388926  0.1049844   4.181 2.91e-05 ***
## mean.height     -0.0328309  0.0148368  -2.213   0.0269 *  
## mean.cover       0.0043418  0.0035863   1.211   0.2260    
## dry.veg.percent  0.0017713  0.0013437   1.318   0.1874    
## NDVI            -0.0002470  0.0002086  -1.184   0.2364    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(m1.nb, type = 2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: abun
##                   Chisq Df Pr(>Chisq)    
## bnll             5.4652  1    0.01940 *  
## arid            23.9403  1  9.937e-07 ***
## Microsite       17.4770  1  2.908e-05 ***
## mean.height      4.8965  1    0.02691 *  
## mean.cover       1.4657  1    0.22603    
## dry.veg.percent  1.7377  1    0.18743    
## NDVI             1.4019  1    0.23641    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#which variable to keep

msmall <- glmmTMB(abun ~ bnll+mean.height +Microsite + arid + NDVI  +(1|Site), family = "nbinom2", data = abundata)
summary(msmall)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + mean.height + Microsite + arid + NDVI + (1 | Site)
## Data: abundata
## 
##      AIC      BIC   logLik deviance df.resid 
##   5176.3   5211.8  -2580.1   5160.3      617 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.04125  0.2031  
## Number of obs: 625, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 0.998 
## 
## Conditional model:
##                  Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     3.3930242  0.5292287   6.411 1.44e-10 ***
## bnllpresent    -0.5359589  0.1909696  -2.807  0.00501 ** 
## mean.height    -0.0347232  0.0139836  -2.483  0.01302 *  
## Micrositeshrub  0.4917439  0.0998475   4.925 8.44e-07 ***
## arid            0.6273386  0.1155885   5.427 5.72e-08 ***
## NDVI           -0.0003035  0.0002089  -1.453  0.14626    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(msmall, type = 2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: abun
##               Chisq Df Pr(>Chisq)    
## bnll         7.8765  1   0.005008 ** 
## mean.height  6.1660  1   0.013023 *  
## Microsite   24.2551  1  8.438e-07 ***
## arid        29.4561  1  5.720e-08 ***
## NDVI         2.1108  1   0.146263    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m1.nbboth <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ site.shrub + mean.cover + dry.veg.percent + NDVI + (1|Site), family = "nbinom2", data = abundata)
summary(m1.nbboth)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + arid + Microsite + mean.height + site.shrub + mean.cover +  
##     dry.veg.percent + NDVI + (1 | Site)
## Data: abundata
## 
##      AIC      BIC   logLik deviance df.resid 
##   5178.1   5226.9  -2578.0   5156.1      614 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.05274  0.2296  
## Number of obs: 625, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.01 
## 
## Conditional model:
##                        Estimate Std. Error z value Pr(>|z|)    
## (Intercept)           2.8860626  0.6063467   4.760 1.94e-06 ***
## bnllpresent          -0.5376023  0.2432119  -2.210   0.0271 *  
## arid                  0.6420374  0.1388907   4.623 3.79e-06 ***
## Micrositeshrub        0.4303985  0.1080659   3.983 6.81e-05 ***
## mean.height          -0.0350902  0.0163375  -2.148   0.0317 *  
## site.shrubunshrubbed -0.0836598  0.2508122  -0.334   0.7387    
## mean.cover            0.0041661  0.0036150   1.152   0.2491    
## dry.veg.percent       0.0018003  0.0013467   1.337   0.1813    
## NDVI                 -0.0002304  0.0002145  -1.074   0.2828    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m1.nbs <- glmmTMB(abun ~ bnll + arid + Microsite+ site.shrub + mean.cover + dry.veg.percent + NDVI +  (1|Site), family = "nbinom2", data = abundata)
summary(m1.nbs)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + arid + Microsite + site.shrub + mean.cover + dry.veg.percent +  
##     NDVI + (1 | Site)
## Data: abundata
## 
##      AIC      BIC   logLik deviance df.resid 
##   5180.3   5224.7  -2580.2   5160.3      615 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.09327  0.3054  
## Number of obs: 625, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.01 
## 
## Conditional model:
##                        Estimate Std. Error z value Pr(>|z|)    
## (Intercept)           2.5090914  0.6035754   4.157 3.22e-05 ***
## bnllpresent          -0.4664656  0.3046587  -1.531 0.125743    
## arid                  0.6388620  0.1754252   3.642 0.000271 ***
## Micrositeshrub        0.4456415  0.1080009   4.126 3.69e-05 ***
## site.shrubunshrubbed  0.1353728  0.2870828   0.472 0.637251    
## mean.cover            0.0062807  0.0036157   1.737 0.082375 .  
## dry.veg.percent       0.0015115  0.0013341   1.133 0.257231    
## NDVI                 -0.0003895  0.0002145  -1.816 0.069376 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m1.nbbarid <- glmmTMB(abun ~ bnll  + Microsite+ mean.height + mean.cover + dry.veg.percent + NDVI + (1|Site), family = "nbinom2", data = abundata)
summary(m1.nbbarid)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + Microsite + mean.height + mean.cover + dry.veg.percent +  
##     NDVI + (1 | Site)
## Data: abundata
## 
##      AIC      BIC   logLik deviance df.resid 
##     5186     5226    -2584     5168      616 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.2691   0.5187  
## Number of obs: 625, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.01 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      3.2864781  0.5971811   5.503 3.73e-08 ***
## bnllpresent      0.0557141  0.3586369   0.155 0.876546    
## Micrositeshrub   0.4114203  0.1073036   3.834 0.000126 ***
## mean.height     -0.0272202  0.0176414  -1.543 0.122838    
## mean.cover       0.0063686  0.0037181   1.713 0.086742 .  
## dry.veg.percent  0.0017586  0.0013463   1.306 0.191458    
## NDVI            -0.0001827  0.0002253  -0.811 0.417462    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(m1.nb, m1.nbs, m1.nbboth, m1.nbbarid)
##            df      AIC
## m1.nb      10 5176.173
## m1.nbs     10 5180.331
## m1.nbboth  11 5178.064
## m1.nbbarid  9 5186.043
t.test(abun ~ bnll, data = abundata)
## 
##  Welch Two Sample t-test
## 
## data:  abun by bnll
## t = -1.4783, df = 622.92, p-value = 0.1398
## alternative hypothesis: true difference in means between group absent and group present is not equal to 0
## 95 percent confidence interval:
##  -13.028985   1.837676
## sample estimates:
##  mean in group absent mean in group present 
##              23.47253              29.06818
#mean height only

check_collinearity(m1.nb)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##             Term  VIF   VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##             bnll 1.43 [1.30, 1.59]         1.19      0.70     [0.63, 0.77]
##             arid 1.46 [1.33, 1.63]         1.21      0.69     [0.61, 0.75]
##        Microsite 1.13 [1.06, 1.28]         1.06      0.88     [0.78, 0.94]
##      mean.height 1.21 [1.13, 1.36]         1.10      0.83     [0.74, 0.89]
##       mean.cover 1.12 [1.05, 1.26]         1.06      0.89     [0.79, 0.95]
##  dry.veg.percent 1.18 [1.10, 1.32]         1.09      0.85     [0.76, 0.91]
##             NDVI 1.12 [1.05, 1.26]         1.06      0.90     [0.79, 0.95]
s <- as.data.frame(round(summary(m1.nb)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/ground_all_abun.csv")
car::Anova(m1.nb, type = 2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: abun
##                   Chisq Df Pr(>Chisq)    
## bnll             5.4652  1    0.01940 *  
## arid            23.9403  1  9.937e-07 ***
## Microsite       17.4770  1  2.908e-05 ***
## mean.height      4.8965  1    0.02691 *  
## mean.cover       1.4657  1    0.22603    
## dry.veg.percent  1.7377  1    0.18743    
## NDVI             1.4019  1    0.23641    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(abundata, aes(bnll, abun)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Pitfall Arthropod Abundance") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank())

mean(abundata$abun)
## [1] 26.624
sd(abundata$abun)
## [1] 48.41677
s <- abundata %>% group_by(Site) %>% summarise(s = sum(abun))
mean(s$s)
## [1] 1848.889
sd(s$s)
## [1] 1136.405

Richness

m1 <- glmmTMB(Species ~  bnll  +  (1|month) +  (1|Site), family = poisson(link = "log"), data = pit)
summary(m1)
##  Family: poisson  ( log )
## Formula:          Species ~ bnll + (1 | month) + (1 | Site)
## Data: pit
## 
##      AIC      BIC   logLik deviance df.resid 
##   2893.0   2910.8  -1442.5   2885.0      622 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  month  (Intercept) 0.02304  0.1518  
##  Site   (Intercept) 0.06169  0.2484  
## Number of obs: 626, groups:  month, 3; Site, 9
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  1.64097    0.15434  10.632   <2e-16 ***
## bnllpresent -0.07088    0.17054  -0.416    0.678    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mh <- glmmTMB(H ~  bnll  +  (1|month) +  (1|Site), data = pit)
summary(mh)
##  Family: gaussian  ( identity )
## Formula:          H ~ bnll + (1 | month) + (1 | Site)
## Data: pit
## 
##      AIC      BIC   logLik deviance df.resid 
##   1033.9   1056.1   -511.9   1023.9      621 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance Std.Dev.
##  month    (Intercept) 0.009732 0.09865 
##  Site     (Intercept) 0.018773 0.13701 
##  Residual             0.290919 0.53937 
## Number of obs: 626, groups:  month, 3; Site, 9
## 
## Dispersion estimate for gaussian family (sigma^2): 0.291 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  1.14800    0.09494  12.092   <2e-16 ***
## bnllpresent -0.18174    0.10173  -1.787    0.074 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
shapiro.test(resid(mh))
## 
##  Shapiro-Wilk normality test
## 
## data:  resid(mh)
## W = 0.99298, p-value = 0.004956
m2 <- glmmTMB(Species ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI +  (1|Site), family = poisson(link = "log"), data = pit)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
#m2.nb <- glmmTMB(Species ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI +  (1|Site), family = "nbinom2", data = pit)

AIC(m2)
## [1] 2842.149
#<2 difference AIC
#results the same too
check_overdispersion(m2)
## # Overdispersion test
## 
##        dispersion ratio =   1.081
##   Pearson's Chi-Squared = 667.279
##                 p-value =   0.079
## No overdispersion detected.
check_collinearity(m2)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##             Term  VIF   VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##             bnll 1.42 [1.30, 1.58]         1.19      0.71     [0.63, 0.77]
##             arid 1.41 [1.29, 1.57]         1.19      0.71     [0.63, 0.78]
##        Microsite 1.13 [1.06, 1.27]         1.06      0.89     [0.79, 0.94]
##      mean.height 1.24 [1.15, 1.39]         1.11      0.81     [0.72, 0.87]
##       mean.cover 1.14 [1.07, 1.28]         1.07      0.88     [0.78, 0.94]
##  dry.veg.percent 1.18 [1.10, 1.33]         1.09      0.84     [0.75, 0.91]
##             NDVI 1.16 [1.09, 1.30]         1.08      0.86     [0.77, 0.92]
diagnose(m2)
## Unusually large Z-statistics (|x|>5):
## 
##    mean.height theta_1|Site.1 
##      -8.375056      -6.375236 
## 
## Large Z-statistics (estimate/std err) suggest a *possible* failure of
## the Wald approximation - often also associated with parameters that are
## at or near the edge of their range (e.g. random-effects standard
## deviations approaching 0).  (Alternately, they may simply represent
## very well-estimated parameters; intercepts of non-centered models may
## fall in this category.) While the Wald p-values and standard errors
## listed in summary() may be unreliable, profile confidence intervals
## (see ?confint.glmmTMB) and likelihood ratio test p-values derived by
## comparing models (e.g. ?drop1) are probably still OK.  (Note that the
## LRT is conservative when the null value is on the boundary, e.g. a
## variance or zero-inflation value of 0 (Self and Liang 1987; Stram and
## Lee 1994; Goldman and Whelan 2000); in simple cases these p-values are
## approximately twice as large as they should be.)
summary(m2)
##  Family: poisson  ( log )
## Formula:          
## Species ~ bnll + arid + Microsite + mean.height + mean.cover +  
##     dry.veg.percent + NDVI + (1 | Site)
## Data: pit
## 
##      AIC      BIC   logLik deviance df.resid 
##   2842.1   2882.1  -1412.1   2824.1      617 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.02698  0.1643  
## Number of obs: 626, groups:  Site, 9
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      1.1326091  0.2802254   4.042 5.30e-05 ***
## bnllpresent     -0.2211261  0.1380661  -1.602    0.109    
## arid             0.1883350  0.0803187   2.345    0.019 *  
## Micrositeshrub   0.1924537  0.0476377   4.040 5.35e-05 ***
## mean.height     -0.0564753  0.0067433  -8.375  < 2e-16 ***
## mean.cover       0.0023991  0.0015465   1.551    0.121    
## dry.veg.percent -0.0000872  0.0005830  -0.150    0.881    
## NDVI             0.0003915  0.0001000   3.915 9.05e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(m2, type = 2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: Species
##                   Chisq Df Pr(>Chisq)    
## bnll             2.5651  1    0.10924    
## arid             5.4983  1    0.01903 *  
## Microsite       16.3212  1  5.346e-05 ***
## mean.height     70.1416  1  < 2.2e-16 ***
## mean.cover       2.4067  1    0.12081    
## dry.veg.percent  0.0224  1    0.88111    
## NDVI            15.3256  1  9.048e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s <- as.data.frame(round(summary(m2)[["coefficients"]][["cond"]] , 3))
write.csv(s,"modelresultscsv/ground_all_rich.csv")


ggplot(pit, aes(bnll, Species, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Pitfall Species Richness") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank())

mean(pit$Species)
## [1] 5.142173
sd(pit$Species)
## [1] 2.915434

Pitfall: Coleoptera

Beetle abundance

#abundance
m4 <- glmmTMB(abun ~ bnll+ arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI +(1|Site), family = "poisson", data = col)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m4)
## # Overdispersion test
## 
##        dispersion ratio =   1.395
##   Pearson's Chi-Squared = 860.593
##                 p-value = < 0.001
## Overdispersion detected.
m4 <- glmmTMB(abun ~ bnll +   (1|Site), family = "nbinom2", data = col)

summary(m4)
##  Family: nbinom2  ( log )
## Formula:          abun ~ bnll + (1 | Site)
## Data: col
## 
##      AIC      BIC   logLik deviance df.resid 
##   1666.0   1683.7   -829.0   1658.0      622 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.2637   0.5135  
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 2.66 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.1854     0.2654   0.698    0.485
## bnllpresent  -0.5661     0.3596  -1.574    0.115
m4.nb <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI +  (1|Site), family = "nbinom2", data = col)
summary(m4.nb)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + arid + Microsite + mean.height + mean.cover + dry.veg.percent +  
##     NDVI + (1 | Site)
## Data: col
## 
##      AIC      BIC   logLik deviance df.resid 
##   1656.1   1700.5   -818.1   1636.1      616 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.004007 0.0633  
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family ():  2.8 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     -6.629e-02  5.856e-01  -0.113  0.90987    
## bnllpresent     -1.134e+00  1.683e-01  -6.737 1.62e-11 ***
## arid             6.320e-01  9.937e-02   6.360 2.02e-10 ***
## Micrositeshrub   9.437e-03  1.267e-01   0.074  0.94062    
## mean.height     -3.589e-02  1.305e-02  -2.750  0.00596 ** 
## mean.cover      -1.284e-03  3.857e-03  -0.333  0.73917    
## dry.veg.percent -1.081e-03  1.504e-03  -0.718  0.47256    
## NDVI             6.952e-05  2.141e-04   0.325  0.74535    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#partial models
m4.bnl <- glmmTMB(abun ~ bnll+ (1|Site), family = "nbinom2", data = col)
m4.nbb <- glmmTMB(abun ~ bnll+ arid +(1|Site), family = "nbinom2", data = col)
m4.arid <- glmmTMB(abun ~  arid +(1|Site), family = "nbinom2", data = col)
AIC(m4.bnl, m4.nbb, m4.arid)
##         df      AIC
## m4.bnl   4 1665.983
## m4.nbb   5 1655.089
## m4.arid  4 1667.652
m4.nbbnl <- glmmTMB(abun ~ bnll  + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI +  (1|Site), family = "nbinom2", data = col)

m4.nbar <- glmmTMB(abun ~ arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI +  (1|Site), family = "nbinom2", data = col)

AIC(m4.nb, m4.nbbnl, m4.nbar)
##          df      AIC
## m4.nb    10 1656.138
## m4.nbbnl  9 1667.590
## m4.nbar   9 1669.631
#model with both a big improvement
knitr::kable(car::Anova(m4.nb, type = 2))
Chisq Df Pr(>Chisq)
bnll 45.3843528 1 0.0000000
arid 40.4449172 1 0.0000000
Microsite 0.0055494 1 0.9406172
mean.height 7.5613812 1 0.0059632
mean.cover 0.1108593 1 0.7391680
dry.veg.percent 0.5159897 1 0.4725574
NDVI 0.1054791 1 0.7453511
s <- as.data.frame(round(summary(m4.nb)[["coefficients"]][["cond"]], 3))

write.csv(s,"modelresultscsv/ground_beet_abun.csv")

ggplot(col, aes(arid, abun, color =bnll)) + geom_smooth(method = "lm")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(col, aes(bnll, abun)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Teneb Abundance") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

mean(col$abun)
## [1] 1.019169
sd(col$abun)
## [1] 1.333729
s <- col %>% group_by(Site) %>% summarise(sum(abun))
mean(s$`sum(abun)`)
## [1] 70.88889
sd(s$`sum(abun)`)
## [1] 38.1623
sum(col$abun)
## [1] 638
mean(col$Species)
## [1] 0.8083067
sd(col$Species)
## [1] 0.9320917

Pitfalls no ants

Abundance

# Abundance

m2 <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site), family = "poisson", data = noants)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m2)
## # Overdispersion test
## 
##        dispersion ratio =    2.146
##   Pearson's Chi-Squared = 1324.090
##                 p-value =  < 0.001
## Overdispersion detected.
m2 <- glmmTMB(abun ~ bnll +  (1|Site), family = "nbinom2", data = noants)

summary(m2)
##  Family: nbinom2  ( log )
## Formula:          abun ~ bnll + (1 | Site)
## Data: noants
## 
##      AIC      BIC   logLik deviance df.resid 
##   3144.5   3162.2  -1568.2   3136.5      622 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.05585  0.2363  
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 3.58 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   1.6148     0.1255  12.872   <2e-16 ***
## bnllpresent  -0.1238     0.1684  -0.735    0.462    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m2.nb <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site), family = "nbinom2", data = noants)
AIC(m2, m2.nb)
##       df      AIC
## m2     4 3144.492
## m2.nb 10 3073.857
summary(m2.nb)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + arid + Microsite + mean.height + mean.cover + dry.veg.percent +  
##     NDVI + (1 | Site)
## Data: noants
## 
##      AIC      BIC   logLik deviance df.resid 
##   3073.9   3118.3  -1526.9   3053.9      616 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.03458  0.186   
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 4.68 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      0.9606500  0.3876191   2.478 0.013200 *  
## bnllpresent     -0.2332713  0.1640728  -1.422 0.155097    
## arid             0.1256104  0.0989658   1.269 0.204359    
## Micrositeshrub   0.3057563  0.0695673   4.395 1.11e-05 ***
## mean.height     -0.0660522  0.0097044  -6.806 1.00e-11 ***
## mean.cover       0.0025249  0.0021814   1.158 0.247064    
## dry.veg.percent  0.0010124  0.0008630   1.173 0.240753    
## NDVI             0.0004925  0.0001473   3.344 0.000825 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m2.nb, type = 2))
Chisq Df Pr(>Chisq)
bnll 2.021388 1 0.1550973
arid 1.610945 1 0.2043590
Microsite 19.317023 1 0.0000111
mean.height 46.326932 1 0.0000000
mean.cover 1.339827 1 0.2470645
dry.veg.percent 1.376177 1 0.2407534
NDVI 11.183048 1 0.0008255
s <- summary(m2.nb)

s <- round(s[["coefficients"]][["cond"]], 3)

write.csv(s,"modelresultscsv/ground_noants_abun.csv")

ggplot(noants, aes(bnll, abun, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Pitfall Abundance without ants") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

Spiders

Abundance

# Abundance

m2 <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site), family = "poisson", data = spids)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m2)
## # Overdispersion test
## 
##        dispersion ratio =   1.612
##   Pearson's Chi-Squared = 994.631
##                 p-value = < 0.001
## Overdispersion detected.
m2 <- glmmTMB(abun ~ bnll + (1|Site), family = "nbinom2", data = spids)
summary(m2)
##  Family: nbinom2  ( log )
## Formula:          abun ~ bnll + (1 | Site)
## Data: spids
## 
##      AIC      BIC   logLik deviance df.resid 
##   1892.1   1909.9   -942.1   1884.1      622 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.1527   0.3908  
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.36 
## 
## Conditional model:
##              Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.0006394  0.2114433   0.003    0.998
## bnllpresent 0.2553805  0.2823705   0.904    0.366
m2.nb <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site), family = "nbinom2", data = spids)
AIC(m2, m2.nb)
##       df      AIC
## m2     4 1892.108
## m2.nb 10 1830.009
summary(m2.nb)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + arid + Microsite + mean.height + mean.cover + dry.veg.percent +  
##     NDVI + (1 | Site)
## Data: spids
## 
##      AIC      BIC   logLik deviance df.resid 
##   1830.0   1874.4   -905.0   1810.0      616 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.2338   0.4836  
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 2.07 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     -2.1747983  0.7962215  -2.731  0.00631 ** 
## bnllpresent      0.0857740  0.3984915   0.215  0.82957    
## arid             0.1681242  0.2312897   0.727  0.46729    
## Micrositeshrub   0.7369311  0.1255636   5.869 4.38e-09 ***
## mean.height     -0.0674879  0.0185749  -3.633  0.00028 ***
## mean.cover       0.0043735  0.0040121   1.090  0.27568    
## dry.veg.percent  0.0036545  0.0016111   2.268  0.02331 *  
## NDVI             0.0009229  0.0002892   3.191  0.00142 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m2.nb, type = 2))
Chisq Df Pr(>Chisq)
bnll 0.0463311 1 0.8295750
arid 0.5283817 1 0.4672880
Microsite 34.4449756 1 0.0000000
mean.height 13.2007117 1 0.0002798
mean.cover 1.1882425 1 0.2756844
dry.veg.percent 5.1453811 1 0.0233083
NDVI 10.1818430 1 0.0014183
s <- summary(m2.nb)

s <- round(s[["coefficients"]][["cond"]], 3)

write.csv(s,"modelresultscsv/ground_spids_abun.csv")

ggplot(spids, aes(bnll, abun, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Pitfall Abundance without ants") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))
## Warning: Removed 8 rows containing missing values (`stat_boxplot()`).

mean(spids$abun)
## [1] 1.242902
sd(spids$abun)
## [1] 1.714446
s <- spids %>% group_by(Site) %>% summarise(s = sum(abun))
mean(s$s)
## [1] 78.8
sd(s$s)
## [1] 42.07876
sum(spids$abun)
## [1] 788
mean(spids$Species)
## [1] 0.9258675
sd(spids$Species)
## [1] 1.02382

Pitfalls no singletons

Species richness

# Species richness
m1 <- glmmTMB(Species ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site), family = "poisson", data = nosings)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m1)
## # Overdispersion test
## 
##        dispersion ratio =   1.070
##   Pearson's Chi-Squared = 660.048
##                 p-value =   0.112
## No overdispersion detected.
summary(m1)
##  Family: poisson  ( log )
## Formula:          
## Species ~ bnll + arid + Microsite + mean.height + mean.cover +  
##     dry.veg.percent + NDVI + (1 | Site)
## Data: nosings
## 
##      AIC      BIC   logLik deviance df.resid 
##   2826.9   2866.8  -1404.4   2808.9      617 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.02755  0.166   
## Number of obs: 626, groups:  Site, 9
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      1.103e+00  2.825e-01   3.906 9.40e-05 ***
## bnllpresent     -2.229e-01  1.395e-01  -1.598   0.1100    
## arid             1.849e-01  8.120e-02   2.277   0.0228 *  
## Micrositeshrub   1.878e-01  4.800e-02   3.913 9.13e-05 ***
## mean.height     -5.684e-02  6.815e-03  -8.340  < 2e-16 ***
## mean.cover       2.420e-03  1.557e-03   1.554   0.1202    
## dry.veg.percent -4.895e-05  5.872e-04  -0.083   0.9336    
## NDVI             4.023e-04  1.009e-04   3.988 6.65e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(m1, type = 2)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: Species
##                   Chisq Df Pr(>Chisq)    
## bnll             2.5539  1    0.11002    
## arid             5.1859  1    0.02277 *  
## Microsite       15.3086  1  9.130e-05 ***
## mean.height     69.5530  1  < 2.2e-16 ***
## mean.cover       2.4152  1    0.12016    
## dry.veg.percent  0.0069  1    0.93357    
## NDVI            15.9067  1  6.654e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s <- as.data.frame(round(summary(m1)[["coefficients"]][["cond"]],3))
write.csv(s,"modelresultscsv/ground_nosingles_rich.csv")

Pitfall: Orthopteran in pitfalls

Orthoptera abundance

# Abundance

m8.bn <- glmmTMB(abun ~ bnll + (1|Site), family = "poisson", data = hops)
check_overdispersion(m8.bn)
## # Overdispersion test
## 
##        dispersion ratio =    1.679
##   Pearson's Chi-Squared = 1046.137
##                 p-value =  < 0.001
## Overdispersion detected.
m8.bnnb <- glmmTMB(abun ~ bnll + (1|Site), family = "nbinom2", data = hops)

summary(m8.bnnb)
##  Family: nbinom2  ( log )
## Formula:          abun ~ bnll + (1 | Site)
## Data: hops
## 
##      AIC      BIC   logLik deviance df.resid 
##    816.1    833.9   -404.1    808.1      622 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.8189   0.9049  
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 0.511 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)   
## (Intercept)  -1.3092     0.4764  -2.748  0.00599 **
## bnllpresent  -0.4333     0.6576  -0.659  0.51000   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m8 <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site),  family = "poisson", data = hops)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m8)
## # Overdispersion test
## 
##        dispersion ratio =   1.612
##   Pearson's Chi-Squared = 994.729
##                 p-value = < 0.001
## Overdispersion detected.
m8.nb <- glmmTMB(abun ~ bnll + arid + Microsite+ mean.height+ mean.cover + dry.veg.percent + NDVI + (1|Site), family = "nbinom2", data = hops)

AIC(m8, m8.nb)
##       df      AIC
## m8     9 877.1816
## m8.nb 10 819.9716
summary(m8.nb)
##  Family: nbinom2  ( log )
## Formula:          
## abun ~ bnll + arid + Microsite + mean.height + mean.cover + dry.veg.percent +  
##     NDVI + (1 | Site)
## Data: hops
## 
##      AIC      BIC   logLik deviance df.resid 
##    820.0    864.4   -400.0    800.0      616 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.7026   0.8382  
## Number of obs: 626, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 0.554 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)  
## (Intercept)     -1.8542529  1.4485410  -1.280   0.2005  
## bnllpresent     -0.2672522  0.7477473  -0.357   0.7208  
## arid            -0.0228044  0.4387062  -0.052   0.9585  
## Micrositeshrub  -0.6485160  0.2601943  -2.492   0.0127 *
## mean.height     -0.0277925  0.0376771  -0.738   0.4607  
## mean.cover       0.0030307  0.0081438   0.372   0.7098  
## dry.veg.percent  0.0030655  0.0031566   0.971   0.3315  
## NDVI             0.0003086  0.0005803   0.532   0.5949  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s <- as.data.frame(round(summary(m8.nb)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/ground_hoppers_abun.csv")

ggplot(hops, aes(bnll, abun, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Pitfall Orthoptera Abundance") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

sum(hops$abun)
## [1] 180
mean(hops$abun)
## [1] 0.2875399
sd(hops$abun)
## [1] 0.7799926
s <- hops %>% group_by(Site) %>% summarise(s = sum(abun))
mean(s$s)
## [1] 20
sd(s$s)
## [1] 14.10674
mean(hops$Species)
## [1] 0.201278
sd(hops$Species)
## [1] 0.4282784

Canopy sweep GLMM

active.shrub$month <- factor(active.shrub$month, c("July", "Aug", "Sept"))

m6 <- glmmTMB(act.abun ~ arid + bnll.x+ shrub.x + mean.cover+ mean.height + NDVI  +  (1|Site),  family = "poisson", data = active.shrub)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m6)
## # Overdispersion test
## 
##        dispersion ratio =   2.148
##   Pearson's Chi-Squared = 777.639
##                 p-value = < 0.001
## Overdispersion detected.
m6b <- glmmTMB(act.abun ~  bnll.x  + (1|Site), family = "nbinom2", data = active.shrub)
summary(m6b)
##  Family: nbinom2  ( log )
## Formula:          act.abun ~ bnll.x + (1 | Site)
## Data: active.shrub
## 
##      AIC      BIC   logLik deviance df.resid 
##   1370.9   1386.5   -681.4   1362.9      366 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.3301   0.5745  
## Number of obs: 370, groups:  Site, 6
## 
## Dispersion parameter for nbinom2 family (): 1.22 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)  
## (Intercept)     0.9102     0.4191   2.172   0.0299 *
## bnll.xpresent  -0.5319     0.5146  -1.034   0.3013  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m6.nb <- glmmTMB(act.abun ~  bnll.x + arid + mean.height + mean.cover + NDVI + shrub.x + (1|Site), family = "nbinom2", data = active.shrub)
AIC(m6, m6.nb)
##       df      AIC
## m6     8 1420.487
## m6.nb  9 1318.162
summary(m6.nb)
##  Family: nbinom2  ( log )
## Formula:          act.abun ~ bnll.x + arid + mean.height + mean.cover + NDVI +  
##     shrub.x + (1 | Site)
## Data: active.shrub
## 
##      AIC      BIC   logLik deviance df.resid 
##   1318.2   1353.4   -650.1   1300.2      361 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.7289   0.8538  
## Number of obs: 370, groups:  Site, 6
## 
## Dispersion parameter for nbinom2 family (): 2.04 
## 
## Conditional model:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   -1.4040701  1.0874584  -1.291    0.197    
## bnll.xpresent -0.6617650  0.8148307  -0.812    0.417    
## arid          -0.1778280  0.4927481  -0.361    0.718    
## mean.height   -0.0919412  0.0216202  -4.253 2.11e-05 ***
## mean.cover    -0.0053821  0.0044907  -1.199    0.231    
## NDVI           0.0014537  0.0002856   5.090 3.58e-07 ***
## shrub.x        0.0035751  0.0006190   5.776 7.66e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m6.nb, type = 2))
Chisq Df Pr(>Chisq)
bnll.x 0.6595881 1 0.4167054
arid 0.1302417 1 0.7181815
mean.height 18.0842581 1 0.0000211
mean.cover 1.4364123 1 0.2307208
NDVI 25.9069738 1 0.0000004
shrub.x 33.3598281 1 0.0000000
check_collinearity(m6.nb)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##         Term  VIF   VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##       bnll.x 1.18 [1.09, 1.38]         1.09      0.84     [0.72, 0.92]
##         arid 1.21 [1.11, 1.41]         1.10      0.83     [0.71, 0.90]
##  mean.height 1.30 [1.18, 1.51]         1.14      0.77     [0.66, 0.85]
##   mean.cover 1.05 [1.00, 1.48]         1.02      0.96     [0.68, 1.00]
##         NDVI 1.24 [1.13, 1.44]         1.11      0.81     [0.69, 0.88]
##      shrub.x 1.03 [1.00, 2.43]         1.01      0.97     [0.41, 1.00]
s <- as.data.frame(round(summary(m6.nb)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/canopy_abun.csv")

sum(active.shrub$act.abun)
## [1] 764
s <- active.shrub %>% group_by(Site) %>% summarise(s = sum(act.abun))
mean(s$s)
## [1] 127.3333
sd(s$s)
## [1] 78.53577
mean(active.shrub$Species)
## [1] 1.272973
sd(active.shrub$Species)
## [1] 1.360924
mean(active.shrub$act.abun)
## [1] 2.064865
sd(active.shrub$act.abun)
## [1] 2.933058
ggplot(active.shrub, aes(bnll.x, act.abun, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Canopy Arthropod Abundance") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

Canopy richness

m6 <- glmmTMB(Species ~ bnll.x+ arid +  shrub.x + mean.cover+ mean.height  + NDVI +   (1|Site),  family = "poisson", data = active.shrub)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m6)
## # Overdispersion test
## 
##        dispersion ratio =   1.089
##   Pearson's Chi-Squared = 394.078
##                 p-value =   0.118
## No overdispersion detected.
AIC(m6)
## [1] 1047.972
summary(m6)
##  Family: poisson  ( log )
## Formula:          
## Species ~ bnll.x + arid + shrub.x + mean.cover + mean.height +  
##     NDVI + (1 | Site)
## Data: active.shrub
## 
##      AIC      BIC   logLik deviance df.resid 
##   1048.0   1079.3   -516.0   1032.0      362 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.4269   0.6534  
## Number of obs: 370, groups:  Site, 6
## 
## Conditional model:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   -1.3579412  0.8978045  -1.513  0.13040    
## bnll.xpresent -0.5359217  0.6282545  -0.853  0.39364    
## arid          -0.1057266  0.3836087  -0.276  0.78285    
## shrub.x        0.0023844  0.0005020   4.750 2.04e-06 ***
## mean.cover    -0.0049395  0.0037698  -1.310  0.19009    
## mean.height   -0.0603603  0.0183524  -3.289  0.00101 ** 
## NDVI           0.0011055  0.0002447   4.518 6.24e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m6, type = 3))
Chisq Df Pr(>Chisq)
(Intercept) 2.2876964 1 0.1304033
bnll.x 0.7276649 1 0.3936411
arid 0.0759612 1 0.7828471
shrub.x 22.5592841 1 0.0000020
mean.cover 1.7168938 1 0.1900934
mean.height 10.8171926 1 0.0010056
NDVI 20.4138069 1 0.0000062
check_collinearity(m6)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##         Term  VIF   VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##       bnll.x 1.19 [1.10, 1.39]         1.09      0.84     [0.72, 0.91]
##         arid 1.21 [1.11, 1.41]         1.10      0.83     [0.71, 0.90]
##      shrub.x 1.04 [1.00, 1.62]         1.02      0.96     [0.62, 1.00]
##   mean.cover 1.08 [1.02, 1.34]         1.04      0.93     [0.75, 0.98]
##  mean.height 1.30 [1.18, 1.51]         1.14      0.77     [0.66, 0.85]
##         NDVI 1.21 [1.11, 1.41]         1.10      0.83     [0.71, 0.90]
s <- as.data.frame(round(summary(m6)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/canopy_rich.csv")


m6bn <- glmmTMB(Species ~ bnll.x + (1|Site),  family = "poisson", data = active.shrub)

summary(m6bn)
##  Family: poisson  ( log )
## Formula:          Species ~ bnll.x + (1 | Site)
## Data: active.shrub
## 
##      AIC      BIC   logLik deviance df.resid 
##   1091.6   1103.4   -542.8   1085.6      367 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.1899   0.4358  
## Number of obs: 370, groups:  Site, 6
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept)     0.4010     0.3174   1.263    0.206
## bnll.xpresent  -0.3877     0.3907  -0.992    0.321
#ggplot(active.shrub, aes(bnll, Species, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Canopy Species Richness") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

#open.wide <- read.csv("Clean Data/")
shrub.long <- read.csv("Clean Data/active.shrub.long.csv")
grp_shrub <- shrub.long %>% group_by(highest.rtu) %>% summarise(sum = sum(quantity))
sum(grp_shrub$sum)
## [1] 764

No singles

shrub_nosingles <- read.csv("Clean Data/active.shrub.cleaned.nosings.csv")
shrub_nosingles$Site <- gsub("LoK", "Lok", shrub_nosingles$Site)
shrub_nosingles <- left_join(shrub_nosingles, sites, by = c("Site", "month"))
shrub_nosingles <- left_join(shrub_nosingles, sitesrem, by = c("Site", "month"))
shrub_nosingles <- rename(shrub_nosingles, day = day.x)

shrub_nosingles <- left_join(shrub_nosingles, temp, by = c("Site", "month", "day"))

m7 <- glmmTMB(Species ~ bnll+ arid +  shrub.x + mean.cover+ mean.height + NDVI +   (1|Site),  family = "poisson", data = shrub_nosingles)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m7)
## # Overdispersion test
## 
##        dispersion ratio =   1.032
##   Pearson's Chi-Squared = 373.563
##                 p-value =   0.326
## No overdispersion detected.
AIC(m7)
## [1] 1004.822
summary(m7)
##  Family: poisson  ( log )
## Formula:          Species ~ bnll + arid + shrub.x + mean.cover + mean.height +  
##     NDVI + (1 | Site)
## Data: shrub_nosingles
## 
##      AIC      BIC   logLik deviance df.resid 
##   1004.8   1036.1   -494.4    988.8      362 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.4484   0.6696  
## Number of obs: 370, groups:  Site, 6
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.4069373  0.9255937  -1.520  0.12850    
## bnllpresent -0.4926953  0.6440348  -0.765  0.44426    
## arid        -0.1987783  0.3959372  -0.502  0.61564    
## shrub.x      0.0024690  0.0005198   4.750 2.03e-06 ***
## mean.cover  -0.0044168  0.0038630  -1.143  0.25289    
## mean.height -0.0607460  0.0190838  -3.183  0.00146 ** 
## NDVI         0.0011250  0.0002541   4.428 9.51e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sum(shrub_nosingles$act.abun.no)
## [1] 734
m7.nb <- glmmTMB(Species ~ bnll+ arid +  shrub.x + mean.cover+   NDVI +  (1|Site),  family = "nbinom2", data = shrub_nosingles)
summary(m7.nb)
##  Family: nbinom2  ( log )
## Formula:          
## Species ~ bnll + arid + shrub.x + mean.cover + NDVI + (1 | Site)
## Data: shrub_nosingles
## 
##      AIC      BIC   logLik deviance df.resid 
##   1015.3   1046.6   -499.7    999.3      362 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.3194   0.5651  
## Number of obs: 370, groups:  Site, 6
## 
## Dispersion parameter for nbinom2 family ():  235 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.8499124  0.8303871  -2.228 0.025896 *  
## bnllpresent -0.3315383  0.5467452  -0.606 0.544259    
## arid        -0.2964241  0.3454346  -0.858 0.390827    
## shrub.x      0.0027173  0.0005146   5.281 1.29e-07 ***
## mean.cover  -0.0018072  0.0037146  -0.487 0.626608    
## NDVI         0.0008123  0.0002261   3.593 0.000327 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m6, type = 3))
Chisq Df Pr(>Chisq)
(Intercept) 2.2876964 1 0.1304033
bnll.x 0.7276649 1 0.3936411
arid 0.0759612 1 0.7828471
shrub.x 22.5592841 1 0.0000020
mean.cover 1.7168938 1 0.1900934
mean.height 10.8171926 1 0.0010056
NDVI 20.4138069 1 0.0000062
check_collinearity(m6)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##         Term  VIF   VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##       bnll.x 1.19 [1.10, 1.39]         1.09      0.84     [0.72, 0.91]
##         arid 1.21 [1.11, 1.41]         1.10      0.83     [0.71, 0.90]
##      shrub.x 1.04 [1.00, 1.62]         1.02      0.96     [0.62, 1.00]
##   mean.cover 1.08 [1.02, 1.34]         1.04      0.93     [0.75, 0.98]
##  mean.height 1.30 [1.18, 1.51]         1.14      0.77     [0.66, 0.85]
##         NDVI 1.21 [1.11, 1.41]         1.10      0.83     [0.71, 0.90]
s <- as.data.frame(round(summary(m7.nb)[["coefficients"]][["cond"]],3))
write.csv(s,"modelresultscsv/shrub_nosingles_rich.csv")

Open sweep GLMM

Abundance

active.open$month <- factor(active.open$month, c("July", "Aug", "Sept"))

m3 <- glmmTMB(wide.sweep.abun ~ arid + bnll.x+ mean.cover+ mean.height + NDVI + (1|Site), family = "poisson", data = active.open)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
m3b <- glmmTMB(wide.sweep.abun ~ bnll.x+  (1|Site),family = "nbinom2", data = active.open)

summary(m3b)
##  Family: nbinom2  ( log )
## Formula:          wide.sweep.abun ~ bnll.x + (1 | Site)
## Data: active.open
## 
##      AIC      BIC   logLik deviance df.resid 
##   1630.6   1647.9   -811.3   1622.6      556 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.7647   0.8745  
## Number of obs: 560, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.27 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept)   -0.03963    0.44763  -0.089    0.929
## bnll.xpresent -0.04232    0.60078  -0.070    0.944
check_overdispersion(m3)
## # Overdispersion test
## 
##        dispersion ratio =    2.317
##   Pearson's Chi-Squared = 1281.396
##                 p-value =  < 0.001
## Overdispersion detected.
m3.nb <- glmmTMB(wide.sweep.abun ~ bnll.x+ arid +  mean.height+ mean.cover + NDVI + (1|Site),family = "nbinom2", data = active.open)
AIC(m3, m3.nb)
##       df      AIC
## m3     7 1851.797
## m3.nb  8 1622.716
summary(m3.nb)
##  Family: nbinom2  ( log )
## Formula:          wide.sweep.abun ~ bnll.x + arid + mean.height + mean.cover +  
##     NDVI + (1 | Site)
## Data: active.open
## 
##      AIC      BIC   logLik deviance df.resid 
##   1622.7   1657.3   -803.4   1606.7      552 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.6514   0.8071  
## Number of obs: 560, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.33 
## 
## Conditional model:
##                 Estimate Std. Error z value Pr(>|z|)  
## (Intercept)   -1.409e+00  1.100e+00  -1.281   0.2003  
## bnll.xpresent -6.403e-01  6.523e-01  -0.982   0.3263  
## arid           7.982e-01  3.737e-01   2.136   0.0327 *
## mean.height   -2.721e-02  2.443e-02  -1.114   0.2654  
## mean.cover     1.193e-02  4.802e-03   2.484   0.0130 *
## NDVI           3.658e-06  3.684e-04   0.010   0.9921  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m3.nb, type = 3))
Chisq Df Pr(>Chisq)
(Intercept) 1.6403361 1 0.2002794
bnll.x 0.9634073 1 0.3263299
arid 4.5606661 1 0.0327143
mean.height 1.2401889 1 0.2654346
mean.cover 6.1724823 1 0.0129752
NDVI 0.0000986 1 0.9920783
check_collinearity(m3.nb)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##         Term  VIF   VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##       bnll.x 1.37 [1.25, 1.55]         1.17      0.73     [0.65, 0.80]
##         arid 1.38 [1.26, 1.56]         1.18      0.72     [0.64, 0.79]
##  mean.height 1.19 [1.11, 1.34]         1.09      0.84     [0.74, 0.90]
##   mean.cover 1.12 [1.05, 1.28]         1.06      0.90     [0.78, 0.95]
##         NDVI 1.08 [1.03, 1.26]         1.04      0.92     [0.79, 0.97]
s <- as.data.frame(round(summary(m3.nb)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/open_abun.csv")

ggplot(active.open, aes(bnll.x, wide.sweep.abun, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Open Arthropod Abundance") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

s <- active.open %>% group_by(Site) %>% summarise(s = sum(wide.sweep.abun))
mean(s$s)
## [1] 85.44444
sd(s$s)
## [1] 84.50608
sum(active.open$wide.sweep.abun)
## [1] 769
mean(active.open$wide.sweep.abun)
## [1] 1.373214
sd(active.open$wide.sweep.abun)
## [1] 2.58764
mean(active.open$Species)
## [1] 0.85
sd(active.open$Species)
## [1] 1.047529

Richness

m3 <- glmmTMB(Species~ bnll.x+ arid +mean.height+ mean.cover+  NDVI  + (1|Site), family = "poisson", data = active.open)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m3)
## # Overdispersion test
## 
##        dispersion ratio =   1.054
##   Pearson's Chi-Squared = 582.608
##                 p-value =   0.185
## No overdispersion detected.
summary(m3)
##  Family: poisson  ( log )
## Formula:          
## Species ~ bnll.x + arid + mean.height + mean.cover + NDVI + (1 |      Site)
## Data: active.open
## 
##      AIC      BIC   logLik deviance df.resid 
##   1313.7   1344.0   -649.9   1299.7      553 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.276    0.5253  
## Number of obs: 560, groups:  Site, 9
## 
## Conditional model:
##                 Estimate Std. Error z value Pr(>|z|)  
## (Intercept)   -1.407e+00  8.780e-01  -1.602   0.1091  
## bnll.xpresent -2.628e-01  4.347e-01  -0.605   0.5454  
## arid           4.827e-01  2.448e-01   1.972   0.0487 *
## mean.height   -1.618e-02  1.873e-02  -0.864   0.3877  
## mean.cover     8.870e-03  3.971e-03   2.234   0.0255 *
## NDVI           3.527e-05  3.177e-04   0.111   0.9116  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s <- as.data.frame(round(summary(m3)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/open_rich.csv")

m3b <- glmmTMB(Species~ bnll.x  + (1|Site), family = "poisson", data = active.open)
summary(m3b)
##  Family: poisson  ( log )
## Formula:          Species ~ bnll.x + (1 | Site)
## Data: active.open
## 
##      AIC      BIC   logLik deviance df.resid 
##   1317.3   1330.3   -655.6   1311.3      557 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.3847   0.6202  
## Number of obs: 560, groups:  Site, 9
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)
## (Intercept)   -0.39595    0.32107  -1.233    0.217
## bnll.xpresent  0.08481    0.43068   0.197    0.844
#ggplot(active.open, aes(bnll, Species, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Open Arthropod Species Richness") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))


#open.wide <- read.csv("Clean Data/")
open.long <- read.csv("Clean Data/active_sweeps_long.csv")
grp_open <- open.long %>% group_by(highest.rtu) %>% summarise(sum = sum(abun))
sum(grp_open$sum)
## [1] 769
sum(active.open$wide.sweep.abun)
## [1] 769

Richness no singles

openno <- read.csv("Clean Data/active_sweeps_nosingles.csv")
openno <- rename(openno, Site = site)
openno <- left_join(openno, sites, by = c("Site", "month"))
openno <- left_join(openno, sitesrem, by = c("Site", "month"))
openno <- rename(openno, day = day.x)

openno <- left_join(openno, temp, by = c("Site", "month", "day"))


m4 <- glmmTMB(Species~ bnll+ arid +mean.height+ mean.cover+  NDVI  + (1|Site), family = "poisson", data = openno)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m4)
## # Overdispersion test
## 
##        dispersion ratio =   0.988
##   Pearson's Chi-Squared = 546.311
##                 p-value =   0.572
## No overdispersion detected.
summary(m4)
##  Family: poisson  ( log )
## Formula:          
## Species ~ bnll + arid + mean.height + mean.cover + NDVI + (1 |      Site)
## Data: openno
## 
##      AIC      BIC   logLik deviance df.resid 
##   1266.1   1296.4   -626.1   1252.1      553 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.2888   0.5374  
## Number of obs: 560, groups:  Site, 9
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)  
## (Intercept) -1.484e+00  9.114e-01  -1.628   0.1036  
## bnllpresent -2.539e-01  4.451e-01  -0.570   0.5684  
## arid         4.858e-01  2.515e-01   1.932   0.0534 .
## mean.height -2.097e-02  1.920e-02  -1.092   0.2749  
## mean.cover   8.945e-03  4.100e-03   2.182   0.0291 *
## NDVI         6.583e-05  3.297e-04   0.200   0.8417  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s <- as.data.frame(round(summary(m4)[["coefficients"]][["cond"]],3))
write.csv(s,"modelresultscsv/open_nosingles_rich.csv")

Active - grasshoppers

Sweep net grasshopper abundance

active.hoppers$month <- factor(active.hoppers$month, c("July", "Aug", "Sept"))
# Abundance 
m13 <- glmmTMB(wide.hop.abun ~arid + bnll.x+ mean.cover+ mean.height + NDVI +(1|Site), family = "poisson", data = active.hoppers)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m13)
## # Overdispersion test
## 
##        dispersion ratio =    2.055
##   Pearson's Chi-Squared = 1136.521
##                 p-value =  < 0.001
## Overdispersion detected.
m13.nb <- glmmTMB(wide.hop.abun ~ bnll.x + arid + mean.height+ mean.cover + NDVI  + (1|Site), family = "nbinom2", data = active.hoppers)

AIC(m13, m13.nb)
##        df      AIC
## m13     7 1173.465
## m13.nb  8 1068.364
summary(m13.nb)
##  Family: nbinom2  ( log )
## Formula:          
## wide.hop.abun ~ bnll.x + arid + mean.height + mean.cover + NDVI +  
##     (1 | Site)
## Data: active.hoppers
## 
##      AIC      BIC   logLik deviance df.resid 
##   1068.4   1103.0   -526.2   1052.4      552 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.9782   0.989   
## Number of obs: 560, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family ():  1.2 
## 
## Conditional model:
##                 Estimate Std. Error z value Pr(>|z|)  
## (Intercept)   -3.236e-01  1.486e+00  -0.218   0.8276  
## bnll.xpresent -2.888e-01  8.035e-01  -0.359   0.7193  
## arid           2.451e-01  4.587e-01   0.534   0.5931  
## mean.height   -6.484e-02  3.256e-02  -1.991   0.0465 *
## mean.cover     2.478e-03  6.202e-03   0.400   0.6895  
## NDVI          -2.871e-05  5.188e-04  -0.055   0.9559  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m13.bnnl <- glmmTMB(wide.hop.abun ~ bnll.x +  (1|Site), family = "nbinom2", data = active.hoppers)
summary(m13.bnnl)
##  Family: nbinom2  ( log )
## Formula:          wide.hop.abun ~ bnll.x + (1 | Site)
## Data: active.hoppers
## 
##      AIC      BIC   logLik deviance df.resid 
##   1066.6   1083.9   -529.3   1058.6      556 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.9552   0.9773  
## Number of obs: 560, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 1.14 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)  
## (Intercept)    -0.8711     0.5107  -1.706   0.0881 .
## bnll.xpresent  -0.1230     0.6812  -0.180   0.8567  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(active.hoppers, aes(bnll.x, wide.hop.abun, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Open Grasshopper Abundance") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

sum(active.hoppers$wide.hop.abun)
## [1] 377

Malaise GLMM

Abundance

mal$month <- factor(mal$month, c("July", "Aug", "Sept"))

m3 <- glmmTMB(wide.mal.abun~ bnll+ arid +  mean.height+ mean.cover + NDVI + (1|Site), family = "poisson", data = mal)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m3)
## # Overdispersion test
## 
##        dispersion ratio =  22.626
##   Pearson's Chi-Squared = 452.522
##                 p-value = < 0.001
## Overdispersion detected.
m3.nb <- glmmTMB(wide.mal.abun ~ bnll+ arid +  mean.height+ mean.cover + NDVI + (1|Site), family = "nbinom2", data = mal)
AIC(m3, m3.nb)
##       df      AIC
## m3     7 656.1214
## m3.nb  8 297.9362
summary(m3.nb)
##  Family: nbinom2  ( log )
## Formula:          
## wide.mal.abun ~ bnll + arid + mean.height + mean.cover + NDVI +      (1 | Site)
## Data: mal
## 
##      AIC      BIC   logLik deviance df.resid 
##    297.9    308.3   -141.0    281.9       19 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.09969  0.3157  
## Number of obs: 27, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 5.17 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  4.6707203  1.0696336   4.367 1.26e-05 ***
## bnllpresent  0.2001823  0.3378356   0.593    0.553    
## arid         0.2166418  0.2062801   1.050    0.294    
## mean.height -0.1208385  0.0268920  -4.493 7.01e-06 ***
## mean.cover  -0.0006959  0.0069713  -0.100    0.920    
## NDVI         0.0005237  0.0004267   1.227    0.220    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m3.nb, type = 3))
Chisq Df Pr(>Chisq)
(Intercept) 19.0676701 1 0.0000126
bnll 0.3511078 1 0.5534867
arid 1.1029854 1 0.2936119
mean.height 20.1913572 1 0.0000070
mean.cover 0.0099646 1 0.9204849
NDVI 1.5063607 1 0.2196953
check_collinearity(m3.nb)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##         Term  VIF    VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##         bnll 1.48 [1.17,  2.35]         1.22      0.67     [0.43, 0.85]
##         arid 1.58 [1.23,  2.48]         1.26      0.63     [0.40, 0.82]
##  mean.height 1.30 [1.08,  2.15]         1.14      0.77     [0.46, 0.93]
##   mean.cover 1.05 [1.00, 10.59]         1.03      0.95     [0.09, 1.00]
##         NDVI 1.15 [1.02,  2.32]         1.07      0.87     [0.43, 0.98]
m3.bnl <- glmmTMB(wide.mal.abun ~ bnll+  (1|Site), family = "nbinom2", data = mal)

summary(m3.bnl)
##  Family: nbinom2  ( log )
## Formula:          wide.mal.abun ~ bnll + (1 | Site)
## Data: mal
## 
##      AIC      BIC   logLik deviance df.resid 
##    308.0    313.2   -150.0    300.0       23 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.3944   0.628   
## Number of obs: 27, groups:  Site, 9
## 
## Dispersion parameter for nbinom2 family (): 3.35 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   4.3621     0.3545  12.303   <2e-16 ***
## bnllpresent   0.3790     0.4760   0.796    0.426    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s <- as.data.frame(round(summary(m3.nb)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/mal_abun.csv")





ggplot(mal, aes(bnll, wide.mal.abun, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Malaise Abundance") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

s <- mal %>% group_by(Site) %>% summarise(s = sum(wide.mal.abun))
mean(s$s)
## [1] 380.5556
sd(s$s)
## [1] 407.9489
mean(mal$wide.mal.abun)
## [1] 126.8519
sd(mal$wide.mal.abun)
## [1] 170.8323
mean(mal$Species)
## [1] 21.55556
sd(mal$Species)
## [1] 6.302218

Richness

m4 <- glmmTMB(Species~ bnll+ arid +  mean.height+ mean.cover + NDVI + (1|Site), family = "poisson", data = mal)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m4)
## # Overdispersion test
## 
##        dispersion ratio =  0.978
##   Pearson's Chi-Squared = 19.566
##                 p-value =  0.485
## No overdispersion detected.
summary(m4)
##  Family: poisson  ( log )
## Formula:          
## Species ~ bnll + arid + mean.height + mean.cover + NDVI + (1 |      Site)
## Data: mal
## 
##      AIC      BIC   logLik deviance df.resid 
##    170.4    179.5    -78.2    156.4       20 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.006041 0.07772 
## Number of obs: 27, groups:  Site, 9
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  3.8278599  0.4886875   7.833 4.77e-15 ***
## bnllpresent -0.1802356  0.1278134  -1.410  0.15850    
## arid         0.1258564  0.0738943   1.703  0.08853 .  
## mean.height -0.0294452  0.0113862  -2.586  0.00971 ** 
## mean.cover  -0.0022127  0.0031415  -0.704  0.48121    
## NDVI        -0.0001364  0.0001843  -0.740  0.45920    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m4, type = 3))
Chisq Df Pr(>Chisq)
(Intercept) 61.3549600 1 0.0000000
bnll 1.9885125 1 0.1584965
arid 2.9008739 1 0.0885315
mean.height 6.6876041 1 0.0097086
mean.cover 0.4961125 1 0.4812133
NDVI 0.5478517 1 0.4591968
check_collinearity(m4)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##         Term  VIF    VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##         bnll 1.67 [1.26,  2.69]         1.29      0.60     [0.37, 0.79]
##         arid 1.65 [1.25,  2.66]         1.28      0.61     [0.38, 0.80]
##  mean.height 1.17 [1.02,  2.39]         1.08      0.86     [0.42, 0.98]
##   mean.cover 1.11 [1.01,  3.14]         1.05      0.90     [0.32, 0.99]
##         NDVI 1.04 [1.00, 43.88]         1.02      0.96     [0.02, 1.00]
s <- as.data.frame(round(summary(m4)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/mal_rich.csv")
m4bnl <- glmmTMB(Species~ bnll+ (1|Site), family = "poisson", data = mal)
summary(m4bnl)
##  Family: poisson  ( log )
## Formula:          Species ~ bnll + (1 | Site)
## Data: mal
## 
##      AIC      BIC   logLik deviance df.resid 
##    176.7    180.6    -85.3    170.7       24 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  Site   (Intercept) 0.02748  0.1658  
## Number of obs: 27, groups:  Site, 9
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  3.09218    0.10321  29.960   <2e-16 ***
## bnllpresent -0.06447    0.13938  -0.463    0.644    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
cor.test(sites$mean.height, sites$arid)
## 
##  Pearson's product-moment correlation
## 
## data:  sites$mean.height and sites$arid
## t = -1.1475, df = 25, p-value = 0.262
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5564005  0.1708552
## sample estimates:
##        cor 
## -0.2236818
ggplot(mal, aes(bnll, Species, fill = month)) + geom_boxplot() + scale_fill_brewer(palette="Paired") + ylab("Malaise Richness") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank()) + labs(fill = element_blank()) + scale_x_discrete(limits = c("present", "absent"))

### No singles

malno <- read.csv("Clean Data/mal_nosingles.csv")
malno$Site <- gsub("LoK", "Lok", malno$Site)
malno$Site <- gsub("PaPL", "PaPl", malno$Site)
malno <- left_join(malno, sites, by = c("Site", "month"))
malno <- left_join(malno, sitesrem, by = c("Site", "month"))



m5 <- glmmTMB(Species~ bnll+ arid +  mean.height+ mean.cover + NDVI + (1|Site), family = "poisson", data = malno)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation

## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
check_overdispersion(m5)
## # Overdispersion test
## 
##        dispersion ratio =  1.035
##   Pearson's Chi-Squared = 20.697
##                 p-value =  0.415
## No overdispersion detected.
summary(m5)
##  Family: poisson  ( log )
## Formula:          
## Species ~ bnll + arid + mean.height + mean.cover + NDVI + (1 |      Site)
## Data: malno
## 
##      AIC      BIC   logLik deviance df.resid 
##    164.4    173.5    -75.2    150.4       20 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance  Std.Dev.
##  Site   (Intercept) 0.0002094 0.01447 
## Number of obs: 27, groups:  Site, 9
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  3.8249427  0.4852532   7.882 3.21e-15 ***
## bnllpresent -0.1877633  0.1171949  -1.602   0.1091    
## arid         0.1441664  0.0671540   2.147   0.0318 *  
## mean.height -0.0246801  0.0109567  -2.253   0.0243 *  
## mean.cover  -0.0036065  0.0031929  -1.130   0.2587    
## NDVI        -0.0001737  0.0001834  -0.947   0.3436    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
knitr::kable(car::Anova(m5, type = 3))
Chisq Df Pr(>Chisq)
(Intercept) 62.1316858 1 0.0000000
bnll 2.5668695 1 0.1091235
arid 4.6087606 1 0.0318090
mean.height 5.0738435 1 0.0242895
mean.cover 1.2758468 1 0.2586727
NDVI 0.8969998 1 0.3435875
check_collinearity(m5)
## # Check for Multicollinearity
## 
## Low Correlation
## 
##         Term  VIF       VIF 95% CI Increased SE Tolerance Tolerance 95% CI
##         bnll 1.78 [1.33,     2.86]         1.33      0.56     [0.35, 0.75]
##         arid 1.75 [1.31,     2.81]         1.32      0.57     [0.36, 0.76]
##  mean.height 1.19 [1.03,     2.32]         1.09      0.84     [0.43, 0.97]
##   mean.cover 1.15 [1.02,     2.47]         1.07      0.87     [0.40, 0.98]
##         NDVI 1.02 [1.00, 40501.06]         1.01      0.98     [0.00, 1.00]
s <- as.data.frame(round(summary(m5)[["coefficients"]][["cond"]], 3))
write.csv(s,"modelresultscsv/mal_richnosings.csv")

Figures

#ground active
#abundance

a <- ggplot(data = filter(abundata, bnll == "present")) + geom_boxplot(aes(bnll, abun,fill = Site)) + stat_summary(aes(bnll, abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(abundata, bnll == "absent"), aes(bnll, abun,fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + 
   stat_summary(data = filter(abundata, bnll == "absent"), aes(bnll, abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Ground Active Arthropod Abundance \n(captures/pitfall trap)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) + theme(legend.position = "none")
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
a

#richness

b <- ggplot(data = filter(pit, bnll == "present")) + geom_boxplot(aes(bnll, Species,fill = Site)) + stat_summary(aes(bnll, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present") + new_scale_fill()  +
  geom_boxplot(data = filter(pit, bnll == "absent"), aes(bnll, Species,fill = Site)) + stat_summary(data = filter(pit, bnll == "absent"), aes(bnll, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 2)) + scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") + ylab("Ground Active Arthropod Species \nRichness (species/pitfall trap)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) 
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
#shrubs
#abundance


c <- ggplot(data = filter(active.shrub, bnll.x == "present")) + geom_boxplot(aes(bnll.x, act.abun,fill = Site)) + stat_summary(aes(bnll.x, act.abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) + scale_fill_manual(values = c("#F8766D", "#37BF7C", "#37B2F8", "#E16DF4"), guide = guide_legend(order = 1))+ labs(fill = "Present") + new_scale_fill() +
  geom_boxplot(data = filter(active.shrub, bnll.x == "absent"), aes(bnll.x, act.abun,fill = Site))+ 
   stat_summary(data = filter(active.shrub, bnll.x == "absent"), aes(bnll.x, act.abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_manual(values = c("#CF1311", "#3288BD"), guide = guide_legend(order = 2)) + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Canopy Active Arthropod Abundance \n(captures/shrub)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) + theme(legend.position = "none")

c

active.shrub$bnll.x <- factor(active.shrub$bnll.x, levels = c("present", "absent"))
#richness
d <- ggplot(data = filter(active.shrub, bnll.x == "present")) + geom_boxplot(aes(bnll.x, Species,fill = Site)) + stat_summary(aes(bnll.x, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) + scale_fill_manual(values = c("#F8766D", "#37BF7C", "#37B2F8", "#E16DF4"), guide = guide_legend(order = 1)) + labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(active.shrub, bnll.x == "absent"), aes(bnll.x, Species,fill = Site))+ 
   stat_summary(data = filter(active.shrub, bnll.x == "absent"), aes(bnll.x, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_manual(values = c("#CF1311", "#3288BD"), guide = guide_legend(order = 2)) + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Canopy Active Species Richness \n(species/shrub)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) 

d

#opens

#abundance
e <- ggplot(data = filter(active.open, bnll.x == "present")) + geom_boxplot(aes(bnll.x, wide.sweep.abun,fill = Site)) + stat_summary(aes(bnll.x, wide.sweep.abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(active.open, bnll.x == "absent"), aes(bnll.x, wide.sweep.abun,fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + 
   stat_summary(data = filter(active.open, bnll.x == "absent"), aes(bnll.x, wide.sweep.abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Open Area Arthropod Abundance \n(captures/transect)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) + theme(legend.position = "none")
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
#richness
f <- ggplot(data = filter(active.open, bnll.x == "present")) + geom_boxplot(aes(bnll.x, Species,fill = Site)) + stat_summary(aes(bnll.x, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(active.open, bnll.x == "absent"), aes(bnll.x, Species,fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + 
   stat_summary(data = filter(active.open, bnll.x == "absent"), aes(bnll.x, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Open Area Species Richness \n(species/transect)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) 
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
#malaise

#abundance
g <- ggplot(data = filter(mal, bnll == "present")) + geom_boxplot(aes(bnll, wide.mal.abun,fill = Site)) + stat_summary(aes(bnll, wide.mal.abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(mal, bnll == "absent"), aes(bnll, wide.mal.abun,fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + 
   stat_summary(data = filter(mal, bnll == "absent"), aes(bnll, wide.mal.abun,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Flying Arthropod Abundance \n(captures/malaise trap)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) + theme(legend.position = "none")
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
#species richness

h <- ggplot(data = filter(mal, bnll == "present")) + geom_boxplot(aes(bnll, Species,fill = Site)) + stat_summary(aes(bnll, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75))+ scale_fill_discrete(guide = guide_legend(order = 1))+ labs(fill = "Present")+ new_scale_fill() +
  geom_boxplot(data = filter(mal, bnll == "absent"), aes(bnll, Species,fill = Site))+ scale_fill_discrete(guide = guide_legend(order = 2)) + 
   stat_summary(data = filter(mal, bnll == "absent"), aes(bnll, Species,fill = Site), fun=mean, colour="black", geom="point", shape=18, size=3, position=position_dodge(.75)) +
  scale_fill_brewer(palette="Spectral") + scale_x_discrete(limits = c("present", "absent")) + labs(fill = "Absent") +  ylab("Flying Arthropod Species Richness \n(species/malaise trap)") + xlab("BNLL Status") + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), text = element_text(size = 13)) 
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
p <- ggarrange(a, b, c, d, e, f, g, h, nrow = 4, ncol = 2, widths = c(0.85,1))
p

db-RDA

beta <- read.csv("Clean Data/by taxa/no_singles_wide.csv")
beta <- select(beta, -X)
pitcov <- select(pit, uniID, Site)
pitcov <- left_join(pitcov, beta, by = "uniID")

pitcov <- pitcov %>% group_by(Site) %>% summarise(across((2:130), sum))

sites.ag <- sites %>% group_by(bnll, Site) %>% summarise(mean.cover = mean(mean.cover), mean.height = mean(mean.height), arid = mean(arid))
## `summarise()` has grouped output by 'bnll'. You can override using the
## `.groups` argument.
sitesrem.ag <- sitesrem %>% group_by(Site) %>% summarise(NDVI = mean(NDVI))



env <- right_join(sites.ag, pitcov, by = c("Site"))
env <- right_join(sitesrem.ag, env, by = c("Site"))
env <- select(env, 1:6)

cor.test(env$arid, env$NDVI)
## 
##  Pearson's product-moment correlation
## 
## data:  env$arid and env$NDVI
## t = -0.17692, df = 7, p-value = 0.8646
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.6998326  0.6250994
## sample estimates:
##         cor 
## -0.06672106
comm <- pitcov %>% ungroup() %>% select(2:130)




c1 <- capscale(comm ~ arid + bnll + mean.height + mean.cover + NDVI, env, distance = "bray")
plot(c1)

dist(env$arid)
##            1          2          3          4          5          6          7
## 2 1.80870734                                                                  
## 3 2.24732499 0.43861765                                                       
## 4 0.27000988 1.53869746 1.97731511                                            
## 5 0.05837811 1.75032923 2.18894688 0.21163177                                 
## 6 0.22890026 1.57980708 2.01842474 0.04110963 0.17052214                      
## 7 1.24446003 0.56424731 1.00286496 0.97445015 1.18608191 1.01555977           
## 8 0.12599087 1.93469821 2.37331586 0.39600075 0.18436899 0.35489113 1.37045090
## 9 0.21454451 1.59416283 2.03278048 0.05546537 0.15616640 0.01435574 1.02991551
##            8
## 2           
## 3           
## 4           
## 5           
## 6           
## 7           
## 8           
## 9 0.34053539
summary(c1)
## 
## Call:
## capscale(formula = comm ~ arid + bnll + mean.height + mean.cover +      NDVI, data = env, distance = "bray") 
## 
## Partitioning of squared Bray distance:
##               Inertia Proportion
## Total          1.4743     1.0000
## Constrained    1.1678     0.7921
## Unconstrained  0.3066     0.2079
## 
## Eigenvalues, and their contribution to the squared Bray distance 
## 
## Importance of components:
##                         CAP1   CAP2    CAP3    CAP4    CAP5   MDS1   MDS2
## Eigenvalue            0.6459 0.3119 0.09861 0.07937 0.03193 0.2062 0.0693
## Proportion Explained  0.4381 0.2116 0.06689 0.05383 0.02166 0.1398 0.0470
## Cumulative Proportion 0.4381 0.6497 0.71657 0.77040 0.79206 0.9319 0.9789
##                          MDS3
## Eigenvalue            0.03111
## Proportion Explained  0.02110
## Cumulative Proportion 1.00000
## 
## Accumulated constrained eigenvalues
## Importance of components:
##                         CAP1   CAP2    CAP3    CAP4    CAP5
## Eigenvalue            0.6459 0.3119 0.09861 0.07937 0.03193
## Proportion Explained  0.5531 0.2671 0.08445 0.06796 0.02735
## Cumulative Proportion 0.5531 0.8202 0.90469 0.97265 1.00000
## 
## Scaling 2 for species and site scores
## * Species are scaled proportional to eigenvalues
## * Sites are unscaled: weighted dispersion equal on all dimensions
## * General scaling constant of scores:  1.850033 
## 
## 
## Species scores
## 
##                                          CAP1       CAP2       CAP3       CAP4
## Ageniellaaccepta                   -6.132e-04  1.924e-04 -2.131e-03  2.729e-03
## Agenioideusbirkmanni               -3.204e-04 -1.121e-05 -5.889e-04 -2.335e-03
## Alaephus                            3.393e-03 -1.318e-04 -4.965e-03 -4.267e-03
## Alaudes                             4.813e-04  7.614e-05 -5.773e-04 -3.649e-04
## Alopecosakochi                      9.405e-03 -1.878e-03 -5.084e-03 -1.474e-02
## Amarainsignis                       6.729e-04 -1.634e-04 -1.243e-03 -2.082e-03
## Anepsiusdeliculatus                 3.650e-03  7.546e-04 -3.744e-03 -1.772e-03
## Anthomyiidae                        1.215e-03 -1.243e-03 -1.428e-03 -9.784e-04
## Aphoebantus                         2.397e-04  4.723e-05  9.669e-05  2.419e-04
## Apristus                            1.350e-04  1.459e-04  8.430e-04 -6.259e-06
## Arenigena                           2.997e-03  5.603e-04 -3.185e-03 -2.544e-03
## Arenivaga                           7.771e-03  1.390e-03 -9.276e-03 -3.920e-04
## Athysanella                         3.139e-03  2.750e-04 -4.556e-03 -3.624e-03
## Auchmobius                          3.176e-03  5.933e-04 -4.410e-03 -3.021e-04
## Bethylidae                          4.153e-03  1.900e-03 -9.806e-04  6.375e-03
## Blapstinus                          2.010e-03  2.356e-03 -1.796e-02  1.341e-02
## Brachycistidinae.large              7.079e-04 -1.459e-04 -6.822e-05 -8.998e-04
## Brachycistidinae.small              3.842e-03  1.037e-03 -3.354e-03  6.801e-04
## Brevitrichia                        2.501e-04  1.359e-04  1.448e-03  1.836e-03
## Calilena.Hololena                  -1.754e-03  1.376e-03  3.986e-04 -6.537e-03
## Callilepis                          1.243e-02  6.204e-03  1.108e-02 -8.533e-03
## Caponiidae                          3.338e-04  2.883e-04  6.550e-04  6.303e-04
## Carpophilushemipterus               3.867e-05  6.731e-04  2.012e-03  8.572e-03
## Ceratagallia                        1.281e-03  4.683e-04 -1.551e-03 -1.595e-03
## Ceuthophilus                        4.412e-03  1.284e-03 -8.364e-03  4.593e-03
## Chyphotes                          -3.992e-03  2.496e-03  9.614e-04 -1.403e-02
## Cicadellidae.palemanyspots          6.083e-04  1.258e-04 -6.240e-04 -2.954e-04
## Conibiosomaelongatum                5.134e-03  2.325e-03  7.161e-03  1.998e-02
## Conibiusseriatus                   -7.454e-04 -6.487e-05 -4.586e-04  3.522e-03
## Culicidae                           2.097e-04  3.069e-05 -1.585e-04 -9.282e-04
## Cydnidae                            3.682e-04  2.797e-04 -6.152e-04 -1.152e-03
## Cyphomyrmexwheeleri                -7.240e-04 -1.435e-03 -8.975e-05  3.943e-03
## Dasymutillacalifornica             -5.167e-03 -7.504e-05 -2.375e-03  1.153e-02
## Dasymutillacoccineohirta           -2.963e-03  3.281e-04 -1.344e-03  5.724e-03
## Dasymutillasackenii                -8.978e-04  1.822e-04 -5.981e-04  1.173e-03
## Dasymutillasatanas.flammifera      -4.801e-04  3.079e-04  1.776e-05 -1.713e-03
## Dictynidae                          2.919e-04  2.121e-04  1.051e-03  1.233e-03
## Dolichopodidae                      4.667e-04  1.923e-05 -3.055e-03  1.819e-03
## Dorymyrmexbicolor                  -2.057e-02  6.534e-03  9.249e-03  3.072e-02
## Dorymyrmexinsanus                   2.409e-02  3.807e-03 -2.922e-02 -1.776e-02
## Drassyllus                          5.740e-03  8.265e-04 -8.779e-03  1.622e-03
## Drosophilamelanogasterspeciesgroup -4.677e-03 -9.704e-04 -2.250e-03  1.756e-02
## Eleodes                            -3.955e-05 -2.611e-04  9.030e-04  1.901e-03
## Eleodesarmata                      -5.592e-04 -7.404e-04 -7.648e-03 -1.877e-02
## Eleodesdentipes                     1.022e-03 -1.852e-03 -9.525e-04 -1.781e-03
## Eleodesgigantea                    -9.468e-05 -7.803e-04  5.778e-05  4.263e-04
## Emblethisvicarius                   4.881e-03  1.793e-04  1.557e-03  3.988e-03
## Entiminae                           7.086e-04  5.302e-05 -1.061e-03 -8.690e-04
## Ephydridae                          3.035e-04 -3.498e-04 -2.699e-03  2.295e-03
## Eremobatidae                        7.652e-03  3.317e-03 -5.660e-03 -7.499e-03
## Eupnigodessierranus                -3.144e-03  3.204e-04 -2.784e-04  2.487e-02
## Foreliuspruinosus                  -9.230e-03  4.414e-03 -1.984e-02  4.485e-02
## Geocorisatricolor                  -3.762e-04 -3.760e-04 -2.746e-04  1.228e-03
## Geocorispallens                     5.923e-03  1.284e-03 -4.485e-03  2.581e-03
## Glyptinaatriventris                 5.652e-03  1.145e-03 -5.882e-03 -2.876e-03
## Gnaphosa                            1.314e-04 -3.450e-04  2.889e-03 -1.453e-03
## Gryllus                            -9.197e-03  1.964e-04  3.070e-03 -3.401e-02
## Haploembiasolieri                   5.439e-05 -7.673e-04  1.495e-04 -2.781e-04
## Hoplosphyrumboreale                -6.291e-05  1.672e-04 -2.564e-04 -1.074e-03
## Hymenorus                          -8.743e-05  1.648e-04  6.988e-05  9.775e-04
## Kibramoamadrona                    -1.504e-03  5.057e-04  1.231e-04 -6.224e-03
## Kukulcania                         -1.293e-04  8.856e-05  4.663e-04  1.580e-03
## Lasioglossum                        4.184e-04  2.433e-04 -8.337e-04 -1.439e-03
## Latrodectushesperus                 1.666e-03  5.306e-04 -1.204e-03 -1.892e-03
## Lepidocnemeplatiasericea           -2.402e-05  5.497e-05  6.322e-04  1.623e-03
## Litaneutriaminor                   -3.183e-03  7.757e-04  1.738e-03 -5.045e-03
## Loxoscelesdeserta                  -1.330e-03  3.332e-04 -6.631e-04  4.570e-03
## Machilinusaurantiacus              -1.005e-04 -7.712e-04  7.154e-04 -2.713e-03
## Melyridae.redunicolor              -1.136e-03  1.163e-04  4.961e-04  8.737e-03
## Mesomachilis                       -5.263e-05  1.038e-03  1.337e-03 -1.309e-03
## Messorandrei                        8.744e-02 -7.419e-01  1.056e-01 -2.952e-01
## Messorpergandei                     4.152e-03  2.681e-03  2.930e-02  3.452e-02
## Metoponium                          5.498e-03  1.674e-03 -1.664e-03  6.236e-03
## Micaria                             7.270e-04  1.603e-04 -9.761e-04  1.138e-03
## Miridae                             3.041e-04  6.288e-05 -3.120e-04 -1.477e-04
## Mirolepismadeserticola              3.347e-03  1.283e-03  1.625e-03  7.762e-03
## Miscophus                           7.086e-04  5.302e-05 -1.061e-03 -8.690e-04
## Muscidae                            2.324e-04  5.535e-04  2.063e-03  9.549e-03
## Myrmecocystuskennedyi               4.842e-02  6.241e-03 -3.572e-02 -1.674e-02
## Myrmecophilusmanni.oregonensis     -2.271e-04 -3.630e-04 -1.829e-04  5.232e-04
## Mythicomyia                         5.438e-04  1.101e-04 -2.153e-04  9.416e-05
## Neoanagraphischamberlini            6.356e-04  5.361e-04 -1.636e-04 -8.149e-04
## Niptus                              1.551e-03 -7.214e-05  2.960e-03  3.745e-03
## Notibiuspuncticollis                1.232e-03  2.920e-04  1.835e-03 -1.566e-03
## Nysiusraphanus                      1.523e-04  2.120e-04  1.666e-04  1.219e-03
## Odontophotopsis                     6.085e-03  4.138e-04 -4.894e-03 -4.347e-03
## Oedaleonotusenigma                 -1.121e-03 -5.695e-05 -1.165e-03  5.376e-03
## Oligotomanigra                     -1.954e-03  7.215e-05 -1.385e-03  7.293e-03
## Oonopidae                           5.007e-04  4.325e-04  9.826e-04  9.455e-04
## Opatroidespunctulatus              -1.918e-04  5.458e-05  1.043e-04  1.121e-03
## Orgerius                            9.094e-04 -3.083e-04  6.016e-04  2.329e-04
## Osbornellus                         3.276e-03 -5.113e-04 -4.518e-03 -4.899e-03
## Oxyopesscalaris                    -3.380e-04 -7.737e-05  2.154e-04 -8.566e-04
## Paravaejovis                       -7.836e-03 -3.304e-04  1.040e-03  1.064e-02
## Parcoblatta                         1.461e-03 -2.433e-05 -1.064e-03 -7.015e-04
## Pheidolehyatti                      1.922e-01 -1.958e-01  5.634e-02  1.452e-01
## Pherocera                          -1.889e-04 -6.439e-05  3.071e-04 -1.561e-03
## Phoridae                           -5.104e-03 -5.790e-03 -3.994e-03 -9.055e-03
## Phthiria                            6.585e-04  8.939e-05 -8.425e-04 -5.822e-04
## Platygastridae.black                2.503e-03 -3.024e-05 -3.542e-03 -1.387e-03
## Plectreurys                        -4.801e-04  3.079e-04  1.776e-05 -1.713e-03
## Pogonomyrmexhoelldobleri            7.299e-03  1.509e-03 -7.488e-03 -3.545e-03
## Pompilus                            6.197e-04  3.575e-05 -1.542e-03 -2.202e-03
## Pompilusphoenix                    -1.183e-03  3.186e-04  1.488e-03  4.430e-03
## Porcellionidespruinosis            -5.294e-03  1.072e-02  9.539e-03 -2.001e-02
## Pseudoscorpiones                    2.336e-05 -3.816e-04  2.333e-04  2.673e-05
## Psilochorus                         2.053e-03 -3.075e-03 -4.945e-03 -2.763e-02
## Rhagodera                           5.439e-05 -7.673e-04  1.495e-04 -2.781e-04
## Salticidae                          1.730e-03 -3.512e-03 -1.490e-03 -5.678e-03
## Sarcophagidae                       2.832e-04  5.181e-04  3.728e-04  7.987e-05
## Scelioninae                        -1.272e-03  1.030e-04 -1.288e-03  3.312e-03
## Scolopendrapolymorpha              -4.801e-04  3.079e-04  1.776e-05 -1.713e-03
## Scopoides                          -7.696e-04  1.772e-04  4.907e-04 -2.469e-03
## Solenopsisxyloni                    1.208e+00  3.740e-01 -4.581e-01 -2.397e-01
## Sphaeropthalma                      3.543e-03  7.707e-04 -3.918e-03 -4.591e-03
## Steatoda                           -1.918e-04  5.458e-05  1.043e-04  1.121e-03
## Tachinidae                          1.157e-03 -1.111e-04 -9.031e-04  4.337e-04
## Tachysphex                         -2.356e-04  8.025e-06  1.785e-04  1.868e-03
## Temnothoraxandrei                   1.904e-04 -2.685e-03  5.233e-04 -9.734e-04
## Tetragonoderuspallidus              2.472e-03  4.155e-04 -2.673e-03 -3.247e-03
## Theridiidae                         8.331e-03  7.850e-04  1.684e-03  8.160e-04
## Thermobiadomestica                 -8.656e-03  3.948e-03  3.583e-02  8.326e-02
## Titanebo                            1.941e-04 -2.395e-04  4.023e-04  1.761e-04
## Tolliussetosus                      4.324e-03 -2.026e-04 -4.646e-03  1.144e-03
## Trimerotropispseudofasciata        -8.655e-05  2.100e-05  2.702e-04  1.164e-03
## Triorophus                         -1.092e-02 -8.134e-04 -5.958e-03  3.852e-02
## Typhaeastercorea                    4.755e-03  3.624e-03  3.566e-03  1.095e-02
## Urophorushumeralis                  2.678e-03  3.114e-03  1.156e-02  2.166e-02
## Xysticus                           -3.775e-04 -3.108e-05 -3.694e-04  4.270e-04
##                                          CAP5       MDS1
## Ageniellaaccepta                   -1.766e-03 -1.170e-04
## Agenioideusbirkmanni                2.200e-04  2.219e-04
## Alaephus                            1.525e-03  2.578e-03
## Alaudes                             1.454e-04 -7.739e-05
## Alopecosakochi                     -9.922e-03  1.198e-02
## Amarainsignis                       9.676e-04  1.100e-03
## Anepsiusdeliculatus                 8.447e-04 -2.413e-03
## Anthomyiidae                       -2.720e-04  2.357e-03
## Aphoebantus                         6.333e-04 -2.361e-04
## Apristus                           -5.475e-04 -3.570e-04
## Arenigena                           1.700e-04 -1.967e-03
## Arenivaga                           2.421e-03 -1.561e-03
## Athysanella                         1.271e-03  1.779e-03
## Auchmobius                          1.629e-03 -1.236e-03
## Bethylidae                          8.757e-03 -5.982e-03
## Blapstinus                         -9.425e-03 -5.807e-03
## Brachycistidinae.large             -8.654e-04 -1.722e-04
## Brachycistidinae.small              1.349e-03 -2.974e-03
## Brevitrichia                        2.233e-03 -1.439e-03
## Calilena.Hololena                   3.451e-03  2.444e-03
## Callilepis                         -2.932e-02 -2.568e-02
## Caponiidae                         -9.843e-04  8.145e-04
## Carpophilushemipterus               2.821e-03 -1.189e-03
## Ceratagallia                        8.449e-04 -7.511e-04
## Ceuthophilus                       -4.501e-03 -1.602e-03
## Chyphotes                           3.655e-03  1.692e-03
## Cicadellidae.palemanyspots          1.408e-04 -4.022e-04
## Conibiosomaelongatum                1.930e-02 -1.545e-02
## Conibiusseriatus                    1.034e-03 -7.380e-05
## Culicidae                          -5.432e-04 -6.056e-04
## Cydnidae                            6.337e-04 -1.477e-04
## Cyphomyrmexwheeleri                 5.427e-04  1.210e-03
## Dasymutillacalifornica              3.388e-04 -2.249e-03
## Dasymutillacoccineohirta            2.345e-03  1.315e-04
## Dasymutillasackenii                -9.473e-05  1.745e-04
## Dasymutillasatanas.flammifera       9.858e-04  5.091e-04
## Dictynidae                          6.245e-04 -3.124e-04
## Dolichopodidae                     -1.783e-03  1.136e-03
## Dorymyrmexbicolor                   3.076e-02 -2.011e-02
## Dorymyrmexinsanus                   7.552e-03 -3.761e-03
## Drassyllus                         -2.562e-03 -5.724e-03
## Drosophilamelanogasterspeciesgroup  5.168e-04 -1.270e-03
## Eleodes                             1.377e-03 -8.848e-04
## Eleodesarmata                       4.448e-03  4.476e-03
## Eleodesdentipes                     8.730e-04  1.755e-03
## Eleodesgigantea                     4.059e-04  4.398e-04
## Emblethisvicarius                   8.609e-03 -6.906e-03
## Entiminae                           3.001e-04  4.949e-04
## Ephydridae                         -1.435e-03 -7.144e-04
## Eremobatidae                        1.533e-02 -7.665e-03
## Eupnigodessierranus                 9.933e-03 -5.061e-03
## Foreliuspruinosus                  -3.402e-02  8.789e-03
## Geocorisatricolor                  -9.086e-05  1.799e-04
## Geocorispallens                     6.903e-03 -7.610e-03
## Glyptinaatriventris                 1.342e-03 -3.496e-03
## Gnaphosa                            4.116e-03 -1.227e-03
## Gryllus                             1.832e-02  1.908e-02
## Haploembiasolieri                   1.992e-04  4.546e-04
## Hoplosphyrumboreale                 5.679e-04  3.783e-04
## Hymenorus                          -8.894e-04  3.746e-04
## Kibramoamadrona                     2.217e-03  2.005e-03
## Kukulcania                          7.194e-04 -7.523e-04
## Lasioglossum                        7.133e-04  3.009e-04
## Latrodectushesperus                 1.498e-03 -1.628e-03
## Lepidocnemeplatiasericea            1.323e-03 -7.344e-04
## Litaneutriaminor                    9.004e-04 -3.035e-03
## Loxoscelesdeserta                  -3.170e-03  2.172e-04
## Machilinusaurantiacus               9.678e-04  2.611e-03
## Melyridae.redunicolor               3.250e-03 -8.198e-04
## Mesomachilis                       -4.899e-04  2.393e-03
## Messorandrei                        2.040e-01  4.339e-01
## Messorpergandei                     4.106e-02 -3.178e-02
## Metoponium                          7.762e-03 -9.391e-03
## Micaria                             1.263e-03 -5.441e-04
## Miridae                             7.039e-05 -2.011e-04
## Mirolepismadeserticola              8.143e-03 -8.416e-03
## Miscophus                           3.001e-04  4.949e-04
## Muscidae                            2.022e-03 -1.237e-03
## Myrmecocystuskennedyi               3.737e-02 -3.041e-02
## Myrmecophilusmanni.oregonensis     -2.976e-04  1.946e-04
## Mythicomyia                         7.037e-04 -4.372e-04
## Neoanagraphischamberlini           -6.825e-04  3.713e-04
## Niptus                             -4.639e-03  5.058e-03
## Notibiuspuncticollis                1.201e-03 -4.897e-03
## Nysiusraphanus                     -2.560e-04  1.385e-04
## Odontophotopsis                     1.320e-03 -1.058e-03
## Oedaleonotusenigma                  1.125e-03 -1.225e-05
## Oligotomanigra                     -3.939e-04 -5.969e-04
## Oonopidae                          -1.477e-03  1.222e-03
## Opatroidespunctulatus               1.611e-04 -3.925e-04
## Orgerius                           -1.127e-03  1.924e-03
## Osbornellus                         9.312e-04  1.952e-03
## Oxyopesscalaris                    -1.020e-03 -8.236e-04
## Paravaejovis                       -4.119e-03  3.470e-03
## Parcoblatta                        -3.137e-05  2.786e-04
## Pheidolehyatti                     -1.442e-01  5.213e-01
## Pherocera                          -1.227e-03 -8.089e-04
## Phoridae                            4.836e-03  5.303e-03
## Phthiria                            2.204e-04  4.634e-05
## Platygastridae.black                1.067e-03  2.012e-03
## Plectreurys                         9.858e-04  5.091e-04
## Pogonomyrmexhoelldobleri            1.689e-03 -4.827e-03
## Pompilus                           -1.174e-03 -9.914e-05
## Pompilusphoenix                     5.594e-03 -1.528e-03
## Porcellionidespruinosis             1.488e-03  2.280e-02
## Pseudoscorpiones                    3.261e-04 -4.280e-04
## Psilochorus                        -1.979e-02 -1.158e-02
## Rhagodera                           1.992e-04  4.546e-04
## Salticidae                         -2.661e-03  4.596e-04
## Sarcophagidae                       3.420e-03 -2.433e-04
## Scelioninae                        -1.986e-03 -1.633e-04
## Scolopendrapolymorpha               9.858e-04  5.091e-04
## Scopoides                           6.793e-04  9.789e-04
## Solenopsisxyloni                    3.971e-02 -1.222e-01
## Sphaeropthalma                     -3.724e-03  2.517e-03
## Steatoda                            1.611e-04 -3.925e-04
## Tachinidae                          1.146e-03 -9.518e-04
## Tachysphex                          9.718e-04 -3.893e-04
## Temnothoraxandrei                   6.972e-04  1.591e-03
## Tetragonoderuspallidus             -5.094e-04 -1.846e-03
## Theridiidae                        -6.870e-03  1.071e-02
## Thermobiadomestica                  4.553e-02 -3.832e-02
## Titanebo                           -3.926e-04  6.345e-04
## Tolliussetosus                      3.487e-03 -2.462e-03
## Trimerotropispseudofasciata         7.651e-04 -3.746e-04
## Triorophus                          7.442e-03  6.293e-04
## Typhaeastercorea                   -9.088e-03  4.430e-03
## Urophorushumeralis                 -1.007e-05  2.169e-03
## Xysticus                           -6.190e-04  9.475e-04
## 
## 
## Site scores (weighted sums of species scores)
## 
##       CAP1     CAP2     CAP3     CAP4       CAP5     MDS1
## 1 -0.78109  0.15948 -0.87107  0.39703 -0.7599079 -0.07599
## 2  0.87257 -0.10692 -0.68535  0.08519  0.0001693  0.28786
## 3  0.80866  0.55558 -0.75666 -0.44625  0.0907892 -0.46790
## 4 -0.61593 -0.06634  0.08901  1.26968  0.4909413 -0.03434
## 5 -0.31873  0.49991  0.70181 -0.84235 -1.2988516 -0.94090
## 6  0.29526  0.72901  1.01356  0.27541  0.4487022 -0.83709
## 7  0.05458 -1.95347  0.01492 -0.21792  0.3770217  0.52877
## 8 -0.83885  0.23368 -0.15574 -0.99995  1.0256096  0.59218
## 9  0.52353 -0.05093  0.64953  0.47916 -0.3744739  0.94741
## 
## 
## Site constraints (linear combinations of constraining variables)
## 
##       CAP1     CAP2     CAP3    CAP4    CAP5     MDS1
## 1 -0.84527  0.08556 -0.66742  0.7490 -0.6223 -0.07599
## 2  0.58880  0.05503 -0.68714 -0.2457  0.1175  0.28786
## 3  1.01084  0.26106 -0.80828 -0.1670  0.1103 -0.46790
## 4 -0.49545 -0.05386 -0.23762  0.7967  0.3239 -0.03434
## 5 -0.31392 -0.13367  0.39775 -0.8827 -0.9613 -0.94090
## 6  0.20781  0.14105  0.93762  0.5192  0.8747 -0.83709
## 7  0.09039 -1.59275  0.19364 -0.1573  0.1560  0.52877
## 8 -0.79788  0.63910  0.02301 -0.9686  0.7722  0.59218
## 9  0.55468  0.59847  0.84844  0.3564 -0.7711  0.94741
## 
## 
## Biplot scores for constraining variables
## 
##                 CAP1    CAP2    CAP3     CAP4     CAP5 MDS1
## arid         0.77796 -0.2702 -0.5382 -0.11667  0.13608    0
## bnllpresent  0.20967 -0.2796 -0.3195 -0.87795  0.07061    0
## mean.height -0.62322 -0.3865 -0.3066 -0.05195 -0.60460    0
## mean.cover  -0.05249 -0.6828  0.4743  0.51647 -0.19826    0
## NDVI        -0.51199 -0.1548 -0.3754  0.11970  0.74744    0
## 
## 
## Centroids for factor constraints
## 
##                CAP1    CAP2    CAP3    CAP4     CAP5 MDS1
## bnllabsent  -0.1446  0.1928  0.2203  0.6053 -0.04868    0
## bnllpresent  0.1156 -0.1542 -0.1762 -0.4843  0.03895    0
anova(c1)
## Permutation test for capscale under reduced model
## Permutation: free
## Number of permutations: 999
## 
## Model: capscale(formula = comm ~ arid + bnll + mean.height + mean.cover + NDVI, data = env, distance = "bray")
##          Df SumOfSqs      F Pr(>F)  
## Model     5  1.16775 2.2854   0.05 *
## Residual  3  0.30658                
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(c1, by = "terms", permu = 999)
## Permutation test for capscale under reduced model
## Terms added sequentially (first to last)
## Permutation: free
## Number of permutations: 999
## 
## Model: capscale(formula = comm ~ arid + bnll + mean.height + mean.cover + NDVI, data = env, distance = "bray")
##             Df SumOfSqs      F Pr(>F)  
## arid         1  0.44393 4.3440  0.011 *
## bnll         1  0.11576 1.1328  0.355  
## mean.height  1  0.19012 1.8605  0.163  
## mean.cover   1  0.24060 2.3544  0.090 .
## NDVI         1  0.17734 1.7354  0.199  
## Residual     3  0.30658                
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(c1, by = "margin", permu = 999)
## Permutation test for capscale under reduced model
## Marginal effects of terms
## Permutation: free
## Number of permutations: 999
## 
## Model: capscale(formula = comm ~ arid + bnll + mean.height + mean.cover + NDVI, data = env, distance = "bray")
##             Df SumOfSqs      F Pr(>F)  
## arid         1  0.25006 2.4470  0.092 .
## bnll         1  0.12088 1.1828  0.349  
## mean.height  1  0.14954 1.4633  0.325  
## mean.cover   1  0.24220 2.3700  0.098 .
## NDVI         1  0.17734 1.7354  0.215  
## Residual     3  0.30658                
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

db-RDA shrub

shrubno <- read.csv("Clean Data/active.shrub.wide.nosings.csv")
betashrub <- select(shrubno, -X)
shrubcov <- select(active.shrub, uniID, Site)
shrubcov <- left_join(shrubcov, betashrub, by = "uniID")
shrubcov <- select(shrubcov, -uniID)
shrubcov[is.na(shrubcov)] <- 0
shrubcov <- shrubcov %>% group_by(Site) %>% summarise(across((1:60), sum))



envshrub <- right_join(sites.ag, shrubcov, by = c("Site"))
envshrub <- right_join(sitesrem.ag, envshrub, by = c("Site"))
commshrub <- select(envshrub, 7:66)
envshrub <- select(envshrub, 1:6)


c1 <- dbrda(commshrub ~ bnll + arid + mean.height + mean.cover + NDVI, envshrub, dist = "bray")
plot(c1)

#ggplot(c1)
summary(c1)
## 
## Call:
## dbrda(formula = commshrub ~ bnll + arid + mean.height + mean.cover +      NDVI, data = envshrub, distance = "bray") 
## 
## Partitioning of squared Bray distance:
##               Inertia Proportion
## Total           1.639          1
## Constrained     1.639          1
## Unconstrained   0.000          0
## 
## Eigenvalues, and their contribution to the squared Bray distance 
## 
## Importance of components:
##                       dbRDA1 dbRDA2 dbRDA3 dbRDA4  dbRDA5
## Eigenvalue            0.5859 0.4221 0.3177 0.1821 0.13126
## Proportion Explained  0.3575 0.2575 0.1938 0.1111 0.08009
## Cumulative Proportion 0.3575 0.6150 0.8088 0.9199 1.00000
## 
## Accumulated constrained eigenvalues
## Importance of components:
##                       dbRDA1 dbRDA2 dbRDA3 dbRDA4  dbRDA5
## Eigenvalue            0.5859 0.4221 0.3177 0.1821 0.13126
## Proportion Explained  0.3575 0.2575 0.1938 0.1111 0.08009
## Cumulative Proportion 0.3575 0.6150 0.8088 0.9199 1.00000
## 
## Scaling 2 for species and site scores
## * Species are scaled proportional to eigenvalues
## * Sites are unscaled: weighted dispersion equal on all dimensions
## * General scaling constant of scores:  1.69195 
## 
## 
## Site scores (weighted sums of species scores)
## 
##    dbRDA1  dbRDA2  dbRDA3  dbRDA4  dbRDA5
## 1  0.5917 -0.1538 -0.2333 -0.2082  1.3835
## 2 -0.4824 -0.1968  1.4359  0.1995  0.1118
## 3  0.5622  0.3003  0.1210 -1.2067 -0.7131
## 4 -1.1842  0.7550 -0.6219 -0.1046  0.1250
## 5 -0.2073 -1.3249 -0.5733  0.1903 -0.4715
## 6  0.7200  0.6202 -0.1284  1.1297 -0.4355
## 
## 
## Site constraints (linear combinations of constraining variables)
## 
##    dbRDA1  dbRDA2  dbRDA3  dbRDA4  dbRDA5
## 1  0.5917 -0.1538 -0.2333 -0.2082  1.3835
## 2 -0.4824 -0.1968  1.4359  0.1995  0.1118
## 3  0.5622  0.3003  0.1210 -1.2067 -0.7131
## 4 -1.1842  0.7550 -0.6219 -0.1046  0.1250
## 5 -0.2073 -1.3249 -0.5733  0.1903 -0.4715
## 6  0.7200  0.6202 -0.1284  1.1297 -0.4355
## 
## 
## Biplot scores for constraining variables
## 
##              dbRDA1  dbRDA2  dbRDA3   dbRDA4   dbRDA5
## bnllpresent -0.6714 -0.2388  0.1851 -0.47167 -0.48520
## arid        -0.7071  0.2987  0.6216  0.12555  0.09348
## mean.height  0.1872  0.1865 -0.2692 -0.76040  0.52871
## mean.cover  -0.1603  0.8945 -0.3375 -0.05519  0.23922
## NDVI        -0.5628 -0.6702 -0.2042 -0.13182  0.41827
## 
## 
## Centroids for factor constraints
## 
##              dbRDA1  dbRDA2   dbRDA3  dbRDA4 dbRDA5
## bnllabsent   0.6559  0.2332 -0.18086  0.4608  0.474
## bnllpresent -0.3279 -0.1166  0.09043 -0.2304 -0.237
anova(c1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## No residual component
## 
## Model: dbrda(formula = commshrub ~ bnll + arid + mean.height + mean.cover + NDVI, data = envshrub, distance = "bray")
##          Df SumOfSqs F Pr(>F)
## Model     5    1.639         
## Residual  0    0.000
anova(c1, by = "terms", permu = 999)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## No residual component
## 
## Model: dbrda(formula = commshrub ~ bnll + arid + mean.height + mean.cover + NDVI, data = envshrub, distance = "bray")
##          Df SumOfSqs F Pr(>F)
## Model     5    1.639         
## Residual  0    0.000
anova(c1, by = "margin", permu = 999)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## No residual component
## 
## Model: dbrda(formula = commshrub ~ bnll + arid + mean.height + mean.cover + NDVI, data = envshrub, distance = "bray")
##          Df SumOfSqs F Pr(>F)
## Model     5    1.639         
## Residual  0    0.000

db-RDA open

opennobeta <- read.csv("Clean Data/active_sweeps_wide_nosingles.csv")
betaopen <- select(opennobeta, -X)
opencov <- select(active.open, uniID, Site)
opencov <- left_join(opencov, betaopen, by = "uniID")
opencov <- select(opencov, -uniID)
opencov[is.na(opencov)] <- 0
opencov <- opencov %>% group_by(Site) %>% summarise(across((1:46), sum))


opencov <- right_join(sites.ag, opencov, by = c("Site"))
opencov <- right_join(sitesrem.ag, opencov, by = c("Site"))
commopen <- select(opencov, 7:50)
envopen <- select(opencov, 1:6)

c1 <- dbrda(commopen ~ bnll + arid + mean.height + mean.cover + NDVI, envopen, dist = "bray")
plot(c1)

#ggplot(c1)
summary(c1)
## 
## Call:
## dbrda(formula = commopen ~ bnll + arid + mean.height + mean.cover +      NDVI, data = envopen, distance = "bray") 
## 
## Partitioning of squared Bray distance:
##               Inertia Proportion
## Total           2.660     1.0000
## Constrained     1.715     0.6447
## Unconstrained   0.945     0.3553
## 
## Eigenvalues, and their contribution to the squared Bray distance 
## 
## Importance of components:
##                       dbRDA1 dbRDA2 dbRDA3 dbRDA4  dbRDA5   MDS1   MDS2   MDS3
## Eigenvalue            0.5749 0.4129 0.3205 0.2437 0.16301 0.4401 0.2932 0.2117
## Proportion Explained  0.2161 0.1552 0.1205 0.0916 0.06128 0.1654 0.1102 0.0796
## Cumulative Proportion 0.2161 0.3714 0.4918 0.5834 0.64473 0.8102 0.9204 1.0000
## 
## Accumulated constrained eigenvalues
## Importance of components:
##                       dbRDA1 dbRDA2 dbRDA3 dbRDA4  dbRDA5
## Eigenvalue            0.5749 0.4129 0.3205 0.2437 0.16301
## Proportion Explained  0.3352 0.2408 0.1869 0.1421 0.09505
## Cumulative Proportion 0.3352 0.5760 0.7629 0.9049 1.00000
## 
## Scaling 2 for species and site scores
## * Species are scaled proportional to eigenvalues
## * Sites are unscaled: weighted dispersion equal on all dimensions
## * General scaling constant of scores:  2.147804 
## 
## 
## Site scores (weighted sums of species scores)
## 
##    dbRDA1   dbRDA2   dbRDA3  dbRDA4  dbRDA5     MDS1
## 1 -0.8089  0.02106  0.87703 -0.5932 -0.6868  0.65991
## 2  0.2598 -0.90553 -0.16937  1.4150 -0.1205  0.08301
## 3  0.3762 -1.43101  0.14933  0.1180  0.3401 -0.27186
## 4  0.9474 -0.13191  0.15797 -0.8384 -1.5055 -1.08543
## 5 -0.8578  0.36406  0.01616  1.2201  0.0897 -1.13499
## 6  0.8815  0.19162 -0.49672 -0.4694  1.2039 -0.36324
## 7  0.8106  1.34099  0.22965  0.6825 -0.1929  0.65736
## 8 -0.8464  0.21800 -1.65033 -0.6137 -0.2642  0.66649
## 9 -0.7623  0.33272  0.88627 -0.9209  1.1362  0.78876
## 
## 
## Site constraints (linear combinations of constraining variables)
## 
##    dbRDA1    dbRDA2   dbRDA3  dbRDA4   dbRDA5     MDS1
## 1 -0.4896 -0.077191  0.85534 -0.5969 -1.23194  0.65991
## 2  0.2361 -0.896105 -0.05544  0.5867 -0.04149  0.08301
## 3  0.3399 -1.358866  0.08284  0.6130  0.24263 -0.27186
## 4  0.4509  0.049598  0.18685 -0.8033 -0.72232 -1.08543
## 5 -1.2225  0.715815  0.09407  0.7783  0.21063 -1.13499
## 6  0.8556  0.404214 -0.43630 -0.9479  0.82472 -0.36324
## 7  1.0262  1.130469  0.16828  1.0570 -0.26485  0.65736
## 8 -0.6375 -0.004807 -1.71431 -0.2132 -0.29468  0.66649
## 9 -0.5592  0.036874  0.81866 -0.4737  1.27732  0.78876
## 
## 
## Biplot scores for constraining variables
## 
##               dbRDA1     dbRDA2  dbRDA3   dbRDA4   dbRDA5 MDS1
## bnllpresent -0.08048 -0.1291460 -0.4449  0.88134 -0.04615    0
## arid         0.50287 -0.5850160  0.1209  0.61875  0.08608    0
## mean.height -0.43238  0.3655283  0.3654  0.25096 -0.69493    0
## mean.cover   0.39923  0.7261371  0.5530 -0.07369  0.04622    0
## NDVI         0.42913  0.0002574 -0.5254 -0.25800 -0.68793    0
## 
## 
## Centroids for factor constraints
## 
##               dbRDA1  dbRDA2  dbRDA3  dbRDA4   dbRDA5 MDS1
## bnllabsent   0.06442  0.1034  0.3561 -0.7055  0.03694    0
## bnllpresent -0.05154 -0.0827 -0.2849  0.5644 -0.02955    0
anova(c1)
## Permutation test for dbrda under reduced model
## Permutation: free
## Number of permutations: 999
## 
## Model: dbrda(formula = commopen ~ bnll + arid + mean.height + mean.cover + NDVI, data = envopen, distance = "bray")
##          Df SumOfSqs      F Pr(>F)
## Model     5  1.71501 1.0889  0.353
## Residual  3  0.94503
anova(c1, by = "terms", permu = 999)
## Permutation test for dbrda under reduced model
## Terms added sequentially (first to last)
## Permutation: free
## Number of permutations: 999
## 
## Model: dbrda(formula = commopen ~ bnll + arid + mean.height + mean.cover + NDVI, data = envopen, distance = "bray")
##             Df SumOfSqs      F Pr(>F)
## bnll         1  0.26367 0.8370  0.663
## arid         1  0.45323 1.4388  0.131
## mean.height  1  0.24930 0.7914  0.743
## mean.cover   1  0.41472 1.3165  0.155
## NDVI         1  0.33409 1.0606  0.377
## Residual     3  0.94503
anova(c1, by = "margin", permu = 999)
## Permutation test for dbrda under reduced model
## Marginal effects of terms
## Permutation: free
## Number of permutations: 999
## 
## Model: dbrda(formula = commopen ~ bnll + arid + mean.height + mean.cover + NDVI, data = envopen, distance = "bray")
##             Df SumOfSqs      F Pr(>F)
## bnll         1  0.31121 0.9879  0.509
## arid         1  0.39399 1.2507  0.228
## mean.height  1  0.27619 0.8768  0.621
## mean.cover   1  0.44544 1.4140  0.124
## NDVI         1  0.33409 1.0606  0.431
## Residual     3  0.94503

db-RDA malaise

malbeta <- read.csv("Clean Data/malaise_wide.csv")
malbeta <- malbeta %>% select(-month) %>%group_by(site) %>% summarise(across((1:147), sum))
str(malbeta)
## tibble [9 × 148] (S3: tbl_df/tbl/data.frame)
##  $ site                              : chr [1:9] "Aven" "CaS" "CaSl" "Coal" ...
##  $ X                                 : int [1:9] 6 15 24 33 42 51 60 69 78
##  $ Acrolophusvariabilis              : int [1:9] 0 0 0 0 0 0 0 1 0
##  $ Aeoloplidescalifornicus           : int [1:9] 0 0 0 1 14 0 0 0 0
##  $ Ageniella                         : int [1:9] 0 0 0 0 0 0 0 0 1
##  $ Agenioideusbirkmanni              : int [1:9] 4 2 4 0 0 0 2 1 3
##  $ Agromyzidae                       : int [1:9] 0 1 0 3 0 2 0 0 0
##  $ Anagyrus                          : int [1:9] 1 0 0 0 1 0 0 1 2
##  $ Anomalon                          : int [1:9] 0 0 14 0 0 0 0 0 0
##  $ Anthocoridae                      : int [1:9] 0 0 1 1 0 0 0 0 0
##  $ Anthomyiidae                      : int [1:9] 0 1 0 0 1 19 1 9 2
##  $ Anthonomus                        : int [1:9] 0 0 0 0 0 0 1 0 0
##  $ Aphididae                         : int [1:9] 1 6 4 2 2 4 0 0 11
##  $ Aphoebantus                       : int [1:9] 1 2 1 0 3 0 0 0 0
##  $ Apollophanes                      : int [1:9] 0 0 0 0 1 0 0 1 0
##  $ Apolysis                          : int [1:9] 0 0 0 0 1 0 1 0 0
##  $ Arenigena                         : int [1:9] 0 2 9 0 0 0 0 0 0
##  $ Arhyssuslateralis                 : int [1:9] 0 0 0 0 0 1 0 0 0
##  $ Aristotelia                       : int [1:9] 1 0 0 0 0 0 0 0 0
##  $ Arogaparaplutella                 : int [1:9] 0 208 842 0 0 0 0 0 0
##  $ Ashmeadiella                      : int [1:9] 0 1 0 0 2 0 0 0 0
##  $ Attalus                           : int [1:9] 0 0 2 0 0 0 0 0 0
##  $ Aufeiusimpressicollis             : int [1:9] 1 0 0 0 0 0 0 0 0
##  $ Bembecinae                        : int [1:9] 0 0 1 0 0 0 0 0 0
##  $ Bethylidae                        : int [1:9] 16 19 208 38 4 176 31 36 18
##  $ Brachycistidinae.large            : int [1:9] 0 0 10 0 15 8 0 0 0
##  $ Brachycistidinae.medium           : int [1:9] 0 1 8 0 0 0 0 0 0
##  $ Brachycistidinae.small            : int [1:9] 4 1 12 6 0 47 0 1 0
##  $ Brachynemurini                    : int [1:9] 0 0 1 0 0 0 0 0 0
##  $ Brachynemurus                     : int [1:9] 0 0 1 0 0 0 0 0 0
##  $ Braconidae.patternedwings         : int [1:9] 1 0 0 0 0 0 0 0 0
##  $ Braconidae.tiny                   : int [1:9] 0 0 0 0 1 0 0 0 0
##  $ Calilena.Hololena                 : int [1:9] 0 0 0 0 0 0 0 1 1
##  $ Carpophilushemipterus             : int [1:9] 2 0 0 0 0 0 0 0 0
##  $ Catharosia                        : int [1:9] 0 0 2 0 0 0 0 0 0
##  $ Cecidomyiidae                     : int [1:9] 0 0 2 2 0 3 1 1 0
##  $ Ceraphronidae                     : int [1:9] 1 1 0 0 0 0 0 0 2
##  $ Ceratagglia                       : int [1:9] 0 0 0 0 2 0 0 0 0
##  $ Chalcididae                       : int [1:9] 1 0 0 4 9 13 0 20 3
##  $ Chamaemyiidae                     : int [1:9] 0 0 1 0 0 3 1 46 0
##  $ Chaoboridae                       : int [1:9] 0 0 0 0 0 1 0 0 0
##  $ Chelonus                          : int [1:9] 0 0 0 0 0 1 0 0 0
##  $ Chironomidae                      : int [1:9] 6 16 24 14 20 0 1 30 2
##  $ Chloropidae                       : int [1:9] 1 1 0 0 0 0 0 2 0
##  $ Chrysopidae                       : int [1:9] 0 0 0 1 0 0 0 0 0
##  $ Chyphotes                         : int [1:9] 0 0 2 5 0 1 0 0 0
##  $ Cicadellidae.palemanyspots        : int [1:9] 1 0 0 0 1 1 0 0 3
##  $ Cicadellidae.palePhlepsanus       : int [1:9] 2 0 0 1 11 0 0 0 2
##  $ Circulifertenellus                : int [1:9] 2 1 0 1 0 0 0 1 0
##  $ Coniopterygidae                   : int [1:9] 13 1 5 12 6 7 3 1 12
##  $ Conozoarebellis                   : int [1:9] 0 0 1 0 0 0 0 0 0
##  $ Corixidae                         : int [1:9] 0 0 0 0 0 0 0 1 0
##  $ Culicidae                         : int [1:9] 0 0 0 1 0 0 0 8 0
##  $ Curculionidae                     : int [1:9] 0 0 0 0 0 0 0 1 0
##  $ Dasymutillacalifornica            : int [1:9] 0 0 0 1 0 0 0 0 0
##  $ Dermestidae                       : int [1:9] 1 0 0 1 0 0 0 0 0
##  $ Dictynidae                        : int [1:9] 3 0 0 0 2 0 0 20 4
##  $ Dolichopodidae                    : int [1:9] 3 1 2 0 0 5 0 0 0
##  $ Dorymyrmexbicolor                 : int [1:9] 0 0 0 2 0 0 0 0 0
##  $ Drosophilamelanogasterspeciesgroup: int [1:9] 4 1 6 3 2 5 5 1 3
##  $ Elasmus                           : int [1:9] 0 0 0 0 0 0 0 0 1
##  $ Encrytidae                        : int [1:9] 0 0 1 0 0 0 0 1 0
##  $ Ephydridae                        : int [1:9] 1 0 0 0 0 0 1 0 1
##  $ Eremochrysa                       : int [1:9] 0 0 2 0 1 0 0 0 0
##  $ Eucharitidae                      : int [1:9] 1 0 0 0 0 0 0 0 0
##  $ Eulophidae                        : int [1:9] 0 0 0 0 0 1 0 1 0
##  $ Eupelmidae                        : int [1:9] 0 1 1 0 0 0 0 0 0
##  $ Eupnigodessierranus               : int [1:9] 0 0 0 0 0 3 0 0 0
##  $ Exitianus                         : int [1:9] 0 0 1 0 0 0 0 0 0
##  $ Faculta                           : int [1:9] 0 0 0 0 0 0 0 0 1
##  $ Foreliuspruinosis                 : int [1:9] 7 1 0 0 0 0 0 0 0
##  $ Geocorisatricolor                 : int [1:9] 1 0 0 0 0 0 0 0 0
##  $ Geocorispallens                   : int [1:9] 0 1 6 1 1 1 0 0 1
##  $ Geron                             : int [1:9] 0 0 0 0 1 0 0 0 1
##  $ Glyptinaatriventris               : int [1:9] 1 18 26 2 3 1 0 9 1
##  $ Gnaphosa                          : int [1:9] 0 0 0 0 0 1 0 0 0
##  $ Heleomyzidae                      : int [1:9] 0 1 1 0 0 0 0 0 0
##  $ Hemerobiidae                      : int [1:9] 0 1 2 0 0 0 0 0 0
##  $ Hoplinusechinatus                 : int [1:9] 1 0 0 0 0 0 0 0 0
##  $ Hymenorus                         : int [1:9] 0 0 2 0 0 0 0 0 1
##  $ Hyperaspidius                     : int [1:9] 1 0 0 0 0 4 0 0 0
##  $ Ichneumoidae                      : int [1:9] 0 1 0 1 0 0 0 0 0
##  $ Irisoratoria                      : int [1:9] 0 0 0 0 0 1 0 0 0
##  $ Ischyropalpus                     : int [1:9] 0 0 0 0 0 0 0 0 1
##  $ Lasioglossum                      : int [1:9] 0 0 1 0 0 0 0 0 0
##  $ Lepidoptera                       : int [1:9] 12 10 14 55 18 8 1 37 7
##  $ Limoniidae                        : int [1:9] 3 1 1 1 0 0 0 0 1
##  $ Litaneutriaminor                  : int [1:9] 0 1 0 0 0 0 1 0 0
##  $ Lygus                             : int [1:9] 0 0 1 0 0 0 0 0 0
##  $ Mecaphesa                         : int [1:9] 0 0 0 2 1 0 0 0 1
##  $ Mellisodes                        : int [1:9] 0 0 0 0 0 0 0 0 1
##  $ Melyridae.redunicolor             : int [1:9] 1 0 0 2 0 0 0 0 0
##  $ Mestobregmaimpexum                : int [1:9] 0 0 0 0 0 0 0 1 0
##  $ Meteipera                         : int [1:9] 0 0 0 0 0 0 0 1 0
##  $ Metoponium                        : int [1:9] 5 0 0 1 0 9 0 1 0
##  $ Micaria                           : int [1:9] 0 0 0 0 0 0 0 4 0
##  $ Miridae                           : int [1:9] 3 3 4 3 0 2 1 0 1
##  $ Mordellistena                     : int [1:9] 0 0 0 1 0 0 0 0 1
##  $ Muscidae                          : int [1:9] 0 0 1 0 0 14 0 0 2
##   [list output truncated]
malsite <- malbeta$site
malbeta<- select(malbeta, -1)
malbeta <- malbeta[, colSums(malbeta) > 1]
malbeta$Site <- malsite

malbeta$Site <- gsub("LoK", "Lok", malbeta$Site)
malbeta$Site <- gsub("PaPL", "PaPl", malbeta$Site)


malbeta <- right_join(sites.ag, malbeta, by = c("Site"))
malbeta <- right_join(sitesrem.ag, malbeta, by = c("Site"))
commmal <- select(malbeta, 7:111)
envmal <- select(malbeta, 1:6)


c1 <- dbrda(commmal ~ bnll + arid + mean.height + mean.cover + NDVI, envmal, dist = "bray")
plot(c1)

summary(c1)
## 
## Call:
## dbrda(formula = commmal ~ bnll + arid + mean.height + mean.cover +      NDVI, data = envmal, distance = "bray") 
## 
## Partitioning of squared Bray distance:
##               Inertia Proportion
## Total          1.8285     1.0000
## Constrained    1.3462     0.7363
## Unconstrained  0.4822     0.2637
## 
## Eigenvalues, and their contribution to the squared Bray distance 
## 
## Importance of components:
##                       dbRDA1 dbRDA2 dbRDA3  dbRDA4  dbRDA5   MDS1    MDS2
## Eigenvalue            0.5873 0.2876 0.1913 0.17105 0.10903 0.2287 0.14786
## Proportion Explained  0.3212 0.1573 0.1046 0.09355 0.05963 0.1251 0.08086
## Cumulative Proportion 0.3212 0.4785 0.5831 0.67662 0.73625 0.8613 0.94218
##                          MDS3
## Eigenvalue            0.10573
## Proportion Explained  0.05782
## Cumulative Proportion 1.00000
## 
## Accumulated constrained eigenvalues
## Importance of components:
##                       dbRDA1 dbRDA2 dbRDA3 dbRDA4  dbRDA5
## Eigenvalue            0.5873 0.2876 0.1913 0.1710 0.10903
## Proportion Explained  0.4362 0.2136 0.1421 0.1271 0.08099
## Cumulative Proportion 0.4362 0.6499 0.7920 0.9190 1.00000
## 
## Scaling 2 for species and site scores
## * Species are scaled proportional to eigenvalues
## * Sites are unscaled: weighted dispersion equal on all dimensions
## * General scaling constant of scores:  1.955661 
## 
## 
## Site scores (weighted sums of species scores)
## 
##      dbRDA1   dbRDA2   dbRDA3   dbRDA4   dbRDA5    MDS1
## 1  0.298115 -1.31030 -0.63468 -0.43252  0.03597  0.2311
## 2 -0.968017 -0.61035  0.50797 -0.06488 -0.51856 -0.7873
## 3 -1.419063  0.30241  0.03441 -0.16022  0.48984  0.8223
## 4  0.327705 -0.45084 -0.68466  0.24377 -0.47376 -0.1521
## 5  0.544293 -0.16488  1.22591  0.44476  0.47948  0.8107
## 6  0.004288  1.06887 -0.98624 -0.60337  0.97107  0.8066
## 7  0.470418  0.74919  0.31843 -0.49506 -1.60808 -0.3879
## 8  0.169434  0.38785 -0.32118  1.66369 -0.09426 -0.4579
## 9  0.572827  0.02805  0.54004 -0.59616  0.71829 -0.8855
## 
## 
## Site constraints (linear combinations of constraining variables)
## 
##     dbRDA1   dbRDA2  dbRDA3   dbRDA4   dbRDA5    MDS1
## 1  0.40742 -1.39946 -0.4315 -0.13067 -0.19028  0.2311
## 2 -0.95851 -0.09456  0.2207  0.01701 -0.15694 -0.7873
## 3 -1.36739 -0.08764  0.2710 -0.18576  0.08587  0.8223
## 4  0.19163 -0.37474 -0.9460 -0.19642 -0.23768 -0.1521
## 5  0.71458 -0.15753  1.2195  0.42796  0.06646  0.8107
## 6  0.24928  1.05592 -0.8425 -0.33574  0.45754  0.8066
## 7  0.36466  0.67863  0.3560 -0.50191 -1.40304 -0.3879
## 8  0.04373  0.32533 -0.3017  1.63098  0.15607 -0.4579
## 9  0.35460  0.05404  0.4545 -0.72545  1.22200 -0.8855
## 
## 
## Biplot scores for constraining variables
## 
##               dbRDA1   dbRDA2   dbRDA3  dbRDA4  dbRDA5 MDS1
## bnllpresent -0.41262  0.22784  0.60561  0.4762 -0.4293    0
## arid        -0.85315  0.11945  0.24978 -0.3051 -0.3200    0
## mean.height  0.47163 -0.67481  0.27745  0.1072 -0.4835    0
## mean.cover   0.61347  0.16683 -0.04779 -0.6998 -0.3222    0
## NDVI        -0.08812  0.01498 -0.74680  0.4050 -0.5199    0
## 
## 
## Centroids for factor constraints
## 
##              dbRDA1  dbRDA2  dbRDA3  dbRDA4  dbRDA5 MDS1
## bnllabsent   0.3007 -0.1661 -0.4414 -0.3471  0.3129    0
## bnllpresent -0.2406  0.1328  0.3531  0.2777 -0.2503    0
anova(c1)
## Permutation test for dbrda under reduced model
## Permutation: free
## Number of permutations: 999
## 
## Model: dbrda(formula = commmal ~ bnll + arid + mean.height + mean.cover + NDVI, data = envmal, distance = "bray")
##          Df SumOfSqs      F Pr(>F)  
## Model     5  1.34621 1.6749  0.041 *
## Residual  3  0.48225                
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(c1, by = "terms", permu = 999)
## Permutation test for dbrda under reduced model
## Terms added sequentially (first to last)
## Permutation: free
## Number of permutations: 999
## 
## Model: dbrda(formula = commmal ~ bnll + arid + mean.height + mean.cover + NDVI, data = envmal, distance = "bray")
##             Df SumOfSqs      F Pr(>F)  
## bnll         1  0.24395 1.5176  0.141  
## arid         1  0.40312 2.5077  0.023 *
## mean.height  1  0.24272 1.5099  0.140  
## mean.cover   1  0.29225 1.8180  0.073 .
## NDVI         1  0.16417 1.0213  0.403  
## Residual     3  0.48225                
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(c1, by = "margin", permu = 999)
## Permutation test for dbrda under reduced model
## Marginal effects of terms
## Permutation: free
## Number of permutations: 999
## 
## Model: dbrda(formula = commmal ~ bnll + arid + mean.height + mean.cover + NDVI, data = envmal, distance = "bray")
##             Df SumOfSqs      F Pr(>F)  
## bnll         1  0.23309 1.4500  0.184  
## arid         1  0.37487 2.3320  0.024 *
## mean.height  1  0.26638 1.6571  0.120  
## mean.cover   1  0.28174 1.7527  0.070 .
## NDVI         1  0.16417 1.0213  0.402  
## Residual     3  0.48225                
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Figure 1

p1 <- ggplot(abundata, aes(bnll, abun)) + geom_boxplot()
p1

p2 <- ggplot(abundata, aes(arid, abun)) + geom_smooth() + geom_point()
p2
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

p3 <- ggplot(abundata, aes(Microsite, abun)) + geom_boxplot()
p3

p4 <- ggplot(abundata, aes(mean.height, abun)) + geom_smooth() + geom_point()
p4
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

p5 <- ggplot(abundata, aes(mean.cover, abun)) + geom_smooth() + geom_point()
p5
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

p6 <- ggplot(abundata, aes(NDVI, abun)) + geom_smooth() + geom_point()
p6
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Site-level beta diversity

library(betapart)

#ground 
# incidence-based

betasite_wide <- comm %>% mutate_if(is.numeric, ~1 * (. > 0))


ground.oc <- beta.multi(betasite_wide)
ground.abun <- beta.multi.abund(comm)



beta_distsor <- beta.pair(betasite_wide, index.family = "sor")

gsim_dist1 <- beta_distsor[[1]]
gsne_dist1 <- beta_distsor[[2]]
gsor_dist1 <- beta_distsor[[3]]




b1 <- betadisper(gsim_dist1, env$bnll)
boxplot(b1)

anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df    Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.0000019 0.0000019   5e-04 0.9831
## Residuals  7 0.0268136 0.0038305
b2 <- betadisper(gsne_dist1, env$bnll)
## Warning in betadisper(gsne_dist1, env$bnll): some squared distances are
## negative and changed to zero
boxplot(b2)

anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df    Sum Sq    Mean Sq F value Pr(>F)
## Groups     1 0.0024964 0.00249642   3.456 0.1054
## Residuals  7 0.0050564 0.00072235
b3 <- betadisper(gsor_dist1, env$bnll)
boxplot(b3)

anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.002019 0.0020190  0.8291 0.3928
## Residuals  7 0.017046 0.0024352
arid_dist <- select(env,Site, arid)
arid_dist <- select(arid_dist, arid)
arid_dist <- dist(arid_dist, method = "euclidean")

mantel(arid_dist, gsor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = gsor_dist1) 
## 
## Mantel statistic r:  0.22 
##       Significance: 0.138 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.246 0.287 0.321 0.354 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, gsne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = gsne_dist1) 
## 
## Mantel statistic r: 0.4154 
##       Significance: 0.033 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.272 0.365 0.437 0.524 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, gsim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = gsim_dist1) 
## 
## Mantel statistic r: -0.03229 
##       Significance: 0.582 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.212 0.304 0.371 0.472 
## Permutation: free
## Number of permutations: 999
#abundance based


beta_distbray <- beta.pair.abund(comm, index.family = "bray")

gsim_adist1 <- beta_distbray[[1]]
gsne_adist1 <- beta_distbray[[2]]
gsor_adist1 <- beta_distbray[[3]]



mantel(arid_dist, gsor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = gsor_adist1) 
## 
## Mantel statistic r: 0.3866 
##       Significance: 0.031 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.300 0.348 0.395 0.480 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, gsne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = gsne_adist1) 
## 
## Mantel statistic r: 0.4433 
##       Significance: 0.017 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.230 0.301 0.385 0.500 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, gsim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = gsim_adist1) 
## 
## Mantel statistic r: 0.002848 
##       Significance: 0.382 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.330 0.450 0.544 0.611 
## Permutation: free
## Number of permutations: 999
b1 <- betadisper(gsim_adist1, env$bnll)
boxplot(b1)

anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.005089 0.0050891   0.212 0.6592
## Residuals  7 0.168053 0.0240076
b2 <- betadisper(gsne_adist1, env$bnll)
## Warning in betadisper(gsne_adist1, env$bnll): some squared distances are
## negative and changed to zero
boxplot(b2)

anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.009215 0.0092147  0.6983  0.431
## Residuals  7 0.092374 0.0131963
b3 <- betadisper(gsor_adist1, env$bnll)
boxplot(b3)

anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.020308 0.0203080  2.1983 0.1817
## Residuals  7 0.064667 0.0092382
height_dist <- select(env, mean.height)
height_dist <- dist(height_dist, method = "euclidean")

mantel(height_dist, gsor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = gsor_dist1) 
## 
## Mantel statistic r: -0.04684 
##       Significance: 0.596 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.233 0.305 0.374 0.441 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, gsne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = gsne_dist1) 
## 
## Mantel statistic r: -0.1653 
##       Significance: 0.763 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.250 0.356 0.441 0.518 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, gsim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = gsim_dist1) 
## 
## Mantel statistic r: 0.04971 
##       Significance: 0.365 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.226 0.312 0.378 0.442 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, gsor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = gsor_adist1) 
## 
## Mantel statistic r: 0.09111 
##       Significance: 0.296 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.254 0.333 0.391 0.437 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, gsne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = gsne_adist1) 
## 
## Mantel statistic r: 0.07697 
##       Significance: 0.265 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.189 0.273 0.345 0.406 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, gsim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = gsim_adist1) 
## 
## Mantel statistic r: 0.02373 
##       Significance: 0.369 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.345 0.395 0.461 0.515 
## Permutation: free
## Number of permutations: 999
NDVI_dist <- select(env, NDVI)
NDVI_dist <- dist(NDVI_dist, method = "euclidean")

mantel(NDVI_dist, gsor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = gsor_dist1) 
## 
## Mantel statistic r: -0.04943 
##       Significance: 0.588 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.244 0.300 0.344 0.392 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, gsne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = gsne_dist1) 
## 
## Mantel statistic r: -0.09423 
##       Significance: 0.622 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.286 0.375 0.441 0.568 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, gsim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = gsim_dist1) 
## 
## Mantel statistic r: 0.007756 
##       Significance: 0.473 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.233 0.311 0.369 0.421 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, gsor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = gsor_adist1) 
## 
## Mantel statistic r: -0.1567 
##       Significance: 0.754 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.318 0.379 0.452 0.509 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, gsne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = gsne_adist1) 
## 
## Mantel statistic r: -0.009503 
##       Significance: 0.461 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.223 0.290 0.357 0.433 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, gsim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = gsim_adist1) 
## 
## Mantel statistic r: -0.1438 
##       Significance: 0.672 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.331 0.468 0.552 0.604 
## Permutation: free
## Number of permutations: 999
cover_dist <- select(env, mean.cover)
cover_dist <- dist(cover_dist, method = "euclidean")

mantel(cover_dist, gsor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = gsor_dist1) 
## 
## Mantel statistic r: 0.2541 
##       Significance: 0.075 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.214 0.300 0.360 0.430 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, gsne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = gsne_dist1) 
## 
## Mantel statistic r: 0.01377 
##       Significance: 0.465 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.267 0.356 0.448 0.530 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, gsim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = gsim_dist1) 
## 
## Mantel statistic r: 0.2223 
##       Significance: 0.113 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.234 0.325 0.386 0.467 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, gsor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = gsor_adist1) 
## 
## Mantel statistic r: 0.2928 
##       Significance: 0.069 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.255 0.315 0.367 0.450 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, gsne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = gsne_adist1) 
## 
## Mantel statistic r: -0.03594 
##       Significance: 0.545 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.215 0.303 0.383 0.453 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, gsim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = gsim_adist1) 
## 
## Mantel statistic r: 0.3138 
##       Significance: 0.115 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.337 0.395 0.451 0.514 
## Permutation: free
## Number of permutations: 999

Shrub

# incidence-based

betasite_wideshrub <- commshrub %>% mutate_if(is.numeric, ~1 * (. > 0))

beta_distsor <- beta.pair(betasite_wideshrub, index.family = "sor")

ssim_dist1 <- beta_distsor[[1]]

ssne_dist1 <- beta_distsor[[2]]

ssor_dist1 <- beta_distsor[[3]]



b1 <- betadisper(ssim_dist1, envshrub$bnll)
boxplot(b1)

anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.013815 0.0138150  1.8396 0.2465
## Residuals  4 0.030039 0.0075097
b2 <- betadisper(ssne_dist1, envshrub$bnll)
anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df    Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.0092916 0.0092916   1.535 0.2831
## Residuals  4 0.0242134 0.0060533
b3 <- betadisper(ssor_dist1, envshrub$bnll)
anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq  Mean Sq F value  Pr(>F)  
## Groups     1 0.040989 0.040989  4.6717 0.09674 .
## Residuals  4 0.035095 0.008774                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sarid_dist <- select(envshrub,Site, arid)
sarid_dist <- select(sarid_dist, arid)
sarid_dist <- dist(sarid_dist, method = "euclidean")
height_dist <- select(envshrub, mean.height)
height_dist <- dist(height_dist, method = "euclidean")

mantel(sarid_dist, ssor_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = sarid_dist, ydis = ssor_dist1) 
## 
## Mantel statistic r: 0.4459 
##       Significance: 0.13056 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.493 0.643 0.670 0.696 
## Permutation: free
## Number of permutations: 719
mantel(sarid_dist, ssne_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = sarid_dist, ydis = ssne_dist1) 
## 
## Mantel statistic r: -0.2157 
##       Significance: 0.82917 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.379 0.579 0.781 0.821 
## Permutation: free
## Number of permutations: 719
mantel(sarid_dist, ssim_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = sarid_dist, ydis = ssim_dist1) 
## 
## Mantel statistic r: 0.565 
##       Significance: 0.0013889 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.366 0.437 0.480 0.518 
## Permutation: free
## Number of permutations: 719
shrub.oc <- beta.multi.abund(commshrub)
shrub.abun <- beta.multi(betasite_wideshrub)




beta_distbray <- beta.pair.abund(commshrub, index.family = "bray")

ssim_adist1 <- beta_distbray[[1]]

ssne_adist1 <- beta_distbray[[2]]

ssor_adist1 <- beta_distbray[[3]]



b1 <- betadisper(ssim_adist1, envshrub$bnll)
anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df  Sum Sq  Mean Sq F value Pr(>F)
## Groups     1 0.10671 0.106711  3.5802 0.1314
## Residuals  4 0.11922 0.029806
b2 <- betadisper(ssne_adist1, envshrub$bnll)
## Warning in betadisper(ssne_adist1, envshrub$bnll): some squared distances are
## negative and changed to zero
anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df    Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.0058499 0.0058499  1.0048 0.3729
## Residuals  4 0.0232886 0.0058221
b3 <- betadisper(ssor_adist1, envshrub$bnll)
anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq  Mean Sq F value   Pr(>F)   
## Groups     1 0.064946 0.064946  23.859 0.008134 **
## Residuals  4 0.010888 0.002722                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mantel(sarid_dist, ssor_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = sarid_dist, ydis = ssor_adist1) 
## 
## Mantel statistic r:  0.52 
##       Significance: 0.073611 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.472 0.632 0.673 0.717 
## Permutation: free
## Number of permutations: 719
mantel(sarid_dist, ssne_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = sarid_dist, ydis = ssne_adist1) 
## 
## Mantel statistic r: -0.535 
##       Significance: 0.95 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.390 0.474 0.528 0.563 
## Permutation: free
## Number of permutations: 719
mantel(sarid_dist, ssim_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = sarid_dist, ydis = ssim_adist1) 
## 
## Mantel statistic r: 0.6395 
##       Significance: 0.043056 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.493 0.628 0.806 0.833 
## Permutation: free
## Number of permutations: 719
mantel(height_dist, ssor_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = ssor_dist1) 
## 
## Mantel statistic r: -0.5012 
##       Significance: 0.99444 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.327 0.421 0.527 0.582 
## Permutation: free
## Number of permutations: 719
mantel(height_dist, ssne_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = ssne_dist1) 
## 
## Mantel statistic r: -0.1516 
##       Significance: 0.72083 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.363 0.504 0.614 0.670 
## Permutation: free
## Number of permutations: 719
mantel(height_dist, ssim_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = ssim_dist1) 
## 
## Mantel statistic r: -0.2788 
##       Significance: 0.8375 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.405 0.550 0.607 0.661 
## Permutation: free
## Number of permutations: 719
mantel(height_dist, ssor_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = ssor_adist1) 
## 
## Mantel statistic r: -0.4035 
##       Significance: 0.99444 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.334 0.440 0.538 0.681 
## Permutation: free
## Number of permutations: 719
mantel(height_dist, ssne_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = ssne_adist1) 
## 
## Mantel statistic r: 0.06218 
##       Significance: 0.39583 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.320 0.451 0.539 0.610 
## Permutation: free
## Number of permutations: 719
mantel(height_dist, ssim_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = ssim_adist1) 
## 
## Mantel statistic r: -0.2699 
##       Significance: 0.87917 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.327 0.435 0.521 0.611 
## Permutation: free
## Number of permutations: 719
NDVI_dist <- select(envshrub, NDVI)
NDVI_dist <- dist(NDVI_dist, method = "euclidean")

mantel(NDVI_dist, ssor_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = ssor_dist1) 
## 
## Mantel statistic r: -0.04164 
##       Significance: 0.51667 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.437 0.541 0.608 0.667 
## Permutation: free
## Number of permutations: 719
mantel(NDVI_dist, ssne_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = ssne_dist1) 
## 
## Mantel statistic r: 0.2765 
##       Significance: 0.14167 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.423 0.556 0.664 0.769 
## Permutation: free
## Number of permutations: 719
mantel(NDVI_dist, ssim_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = ssim_dist1) 
## 
## Mantel statistic r: -0.2845 
##       Significance: 0.88194 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.371 0.455 0.510 0.562 
## Permutation: free
## Number of permutations: 719
mantel(NDVI_dist, ssor_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = ssor_adist1) 
## 
## Mantel statistic r: 0.01535 
##       Significance: 0.45556 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.453 0.527 0.610 0.706 
## Permutation: free
## Number of permutations: 719
mantel(NDVI_dist, ssne_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = ssne_adist1) 
## 
## Mantel statistic r: 0.674 
##       Significance: 0.0125 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.365 0.481 0.575 0.674 
## Permutation: free
## Number of permutations: 719
mantel(NDVI_dist, ssim_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = ssim_adist1) 
## 
## Mantel statistic r: -0.4236 
##       Significance: 0.94583 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.420 0.559 0.679 0.735 
## Permutation: free
## Number of permutations: 719
cover_dist <- select(envshrub, mean.cover)
cover_dist <- dist(cover_dist, method = "euclidean")

mantel(cover_dist, ssor_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = ssor_dist1) 
## 
## Mantel statistic r: 0.5832 
##       Significance: 0.027778 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.425 0.518 0.586 0.683 
## Permutation: free
## Number of permutations: 719
mantel(cover_dist, ssne_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = ssne_dist1) 
## 
## Mantel statistic r: 0.2889 
##       Significance: 0.17778 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.381 0.483 0.589 0.674 
## Permutation: free
## Number of permutations: 719
mantel(cover_dist, ssim_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = ssim_dist1) 
## 
## Mantel statistic r: 0.2228 
##       Significance: 0.17083 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.321 0.384 0.438 0.508 
## Permutation: free
## Number of permutations: 719
mantel(cover_dist, ssor_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = ssor_adist1) 
## 
## Mantel statistic r: 0.678 
##       Significance: 0.011111 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.430 0.522 0.596 0.669 
## Permutation: free
## Number of permutations: 719
mantel(cover_dist, ssne_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = ssne_adist1) 
## 
## Mantel statistic r: -0.1471 
##       Significance: 0.66389 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.419 0.485 0.573 0.724 
## Permutation: free
## Number of permutations: 719
mantel(cover_dist, ssim_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = ssim_adist1) 
## 
## Mantel statistic r: 0.4808 
##       Significance: 0.1 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.480 0.595 0.623 0.651 
## Permutation: free
## Number of permutations: 719

Open

# incidence-based

betasite_wideopen <- commopen %>% mutate_if(is.numeric, ~1 * (. > 0))

open.oc <- beta.multi(betasite_wideopen)
open.abun <- beta.multi.abund(commopen)


beta_distsor <- beta.pair(betasite_wideopen, index.family = "sor")

osim_dist1 <- beta_distsor[[1]]

osne_dist1 <- beta_distsor[[2]]

osor_dist1 <- beta_distsor[[3]]



b1 <- betadisper(osim_dist1, envopen$bnll)
## Warning in betadisper(osim_dist1, envopen$bnll): some squared distances are
## negative and changed to zero
boxplot(b1)

anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.003192 0.0031915  0.1242 0.7349
## Residuals  7 0.179826 0.0256894
b2 <- betadisper(osne_dist1, envopen$bnll)
## Warning in betadisper(osne_dist1, envopen$bnll): some squared distances are
## negative and changed to zero
boxplot(b2)

anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq  Mean Sq F value Pr(>F)
## Groups     1 0.011556 0.011557  0.6728 0.4391
## Residuals  7 0.120245 0.017178
b3 <- betadisper(osor_dist1, env$bnll)
boxplot(b3)

anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df  Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.00209 0.0020895  0.1015 0.7594
## Residuals  7 0.14418 0.0205967
mantel(arid_dist, osor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = osor_dist1) 
## 
## Mantel statistic r: -0.0977 
##       Significance: 0.641 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.281 0.341 0.383 0.420 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, osne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = osne_dist1) 
## 
## Mantel statistic r: 0.04211 
##       Significance: 0.431 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.268 0.351 0.496 0.562 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, osim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = osim_dist1) 
## 
## Mantel statistic r: -0.1019 
##       Significance: 0.729 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.227 0.344 0.420 0.464 
## Permutation: free
## Number of permutations: 999
#abundance-based

beta_distbray <- beta.pair.abund(commopen, index.family = "bray")

osim_adist1 <- beta_distbray[[1]]

osne_adist1 <- beta_distbray[[2]]

osor_adist1 <- beta_distbray[[3]]




b1 <- betadisper(osim_adist1, envopen$bnll)
## Warning in betadisper(osim_adist1, envopen$bnll): some squared distances are
## negative and changed to zero
boxplot(b1)

anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df  Sum Sq  Mean Sq F value Pr(>F)
## Groups     1 0.00062 0.000625  0.0129 0.9127
## Residuals  7 0.33833 0.048333
b2 <- betadisper(osne_adist1, envopen$bnll)
## Warning in betadisper(osne_adist1, envopen$bnll): some squared distances are
## negative and changed to zero
boxplot(b2)

anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq  Mean Sq F value Pr(>F)
## Groups     1 0.002857 0.002857  0.0773  0.789
## Residuals  7 0.258639 0.036948
b3 <- betadisper(osor_adist1, env$bnll)
boxplot(b3)

anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.000536 0.0005359  0.0583 0.8161
## Residuals  7 0.064354 0.0091934
mantel(arid_dist, osor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = osor_adist1) 
## 
## Mantel statistic r: 0.03328 
##       Significance: 0.42 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.231 0.295 0.333 0.404 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, osne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = osne_adist1) 
## 
## Mantel statistic r: 0.06877 
##       Significance: 0.322 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.311 0.394 0.436 0.493 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, osim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = osim_adist1) 
## 
## Mantel statistic r: -0.05045 
##       Significance: 0.662 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.204 0.263 0.304 0.392 
## Permutation: free
## Number of permutations: 999
height_dist <- select(env, mean.height)
height_dist <- dist(height_dist, method = "euclidean")

mantel(height_dist, osor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = osor_dist1) 
## 
## Mantel statistic r: -0.1837 
##       Significance: 0.808 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.264 0.340 0.408 0.508 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, osne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = osne_dist1) 
## 
## Mantel statistic r: -0.09957 
##       Significance: 0.647 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.290 0.370 0.458 0.513 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, osim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = osim_dist1) 
## 
## Mantel statistic r: -0.04535 
##       Significance: 0.593 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.237 0.302 0.347 0.394 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, osor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = osor_adist1) 
## 
## Mantel statistic r: -0.2641 
##       Significance: 0.943 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.211 0.277 0.346 0.449 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, osne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = osne_adist1) 
## 
## Mantel statistic r: -0.2696 
##       Significance: 0.938 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.247 0.314 0.387 0.460 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, osim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = osim_adist1) 
## 
## Mantel statistic r: 0.1305 
##       Significance: 0.217 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.214 0.279 0.328 0.402 
## Permutation: free
## Number of permutations: 999
NDVI_dist <- select(env, NDVI)
NDVI_dist <- dist(NDVI_dist, method = "euclidean")

mantel(NDVI_dist, osor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = osor_dist1) 
## 
## Mantel statistic r: -0.0957 
##       Significance: 0.646 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.317 0.388 0.434 0.490 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, osne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = osne_dist1) 
## 
## Mantel statistic r: -0.009225 
##       Significance: 0.46 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.312 0.391 0.460 0.556 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, osim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = osim_dist1) 
## 
## Mantel statistic r: -0.05854 
##       Significance: 0.62 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.244 0.303 0.362 0.420 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, osor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = osor_adist1) 
## 
## Mantel statistic r: 0.03149 
##       Significance: 0.424 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.215 0.281 0.344 0.411 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, osne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = osne_adist1) 
## 
## Mantel statistic r: -0.002643 
##       Significance: 0.452 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.296 0.381 0.440 0.534 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, osim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = osim_adist1) 
## 
## Mantel statistic r: 0.01843 
##       Significance: 0.474 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.213 0.271 0.303 0.337 
## Permutation: free
## Number of permutations: 999
cover_dist <- select(env, mean.cover)
cover_dist <- dist(cover_dist, method = "euclidean")

mantel(cover_dist, osor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = osor_dist1) 
## 
## Mantel statistic r: 0.5878 
##       Significance: 0.003 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.264 0.344 0.422 0.477 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, osne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = osne_dist1) 
## 
## Mantel statistic r: -0.06623 
##       Significance: 0.593 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.261 0.357 0.440 0.498 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, osim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = osim_dist1) 
## 
## Mantel statistic r: 0.4601 
##       Significance: 0.004 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.229 0.283 0.359 0.404 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, osor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = osor_adist1) 
## 
## Mantel statistic r: 0.1223 
##       Significance: 0.228 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.233 0.292 0.357 0.400 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, osne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = osne_adist1) 
## 
## Mantel statistic r: -0.04212 
##       Significance: 0.542 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.252 0.345 0.418 0.529 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, osim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = osim_adist1) 
## 
## Mantel statistic r: 0.1027 
##       Significance: 0.263 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.212 0.279 0.324 0.390 
## Permutation: free
## Number of permutations: 999

Malaise

# incidence-based

betasite_widemal <- commmal %>% mutate_if(is.numeric, ~1 * (. > 0))

mal.oc <- beta.multi(betasite_widemal)
mal.abun <- beta.multi.abund(commmal)


beta_distsor <- beta.pair(betasite_widemal, index.family = "sor")

msim_dist1 <- beta_distsor[[1]]

msne_dist1 <- beta_distsor[[2]]

msor_dist1 <- beta_distsor[[3]]



b1 <- betadisper(msim_dist1, env$bnll)
boxplot(b1)

anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df    Sum Sq    Mean Sq F value Pr(>F)
## Groups     1 0.0006175 0.00061748   0.232 0.6447
## Residuals  7 0.0186311 0.00266159
b2 <- betadisper(msne_dist1, env$bnll)
## Warning in betadisper(msne_dist1, env$bnll): some squared distances are
## negative and changed to zero
boxplot(b2)

anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df    Sum Sq   Mean Sq F value  Pr(>F)  
## Groups     1 0.0061328 0.0061328  5.0188 0.06005 .
## Residuals  7 0.0085539 0.0012220                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
b3 <- betadisper(msor_dist1, env$bnll)
boxplot(b3)

anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value  Pr(>F)  
## Groups     1 0.011303 0.0113025  5.7819 0.04715 *
## Residuals  7 0.013684 0.0019548                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mantel(arid_dist, msim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = msim_dist1) 
## 
## Mantel statistic r: 0.3266 
##       Significance: 0.014 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.213 0.263 0.290 0.336 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, msne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = msne_dist1) 
## 
## Mantel statistic r: 0.3345 
##       Significance: 0.078 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.317 0.378 0.551 0.660 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, msor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = msor_dist1) 
## 
## Mantel statistic r: 0.525 
##       Significance: 0.007 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.240 0.312 0.378 0.458 
## Permutation: free
## Number of permutations: 999
beta_distbray <- beta.pair.abund(commmal, index.family = "bray")

msim_adist1 <- beta_distbray[[1]]

msne_adist1 <- beta_distbray[[2]]

msor_adist1 <- beta_distbray[[3]]


b1 <- betadisper(msim_adist1, env$bnll)
anova(b1)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.003441 0.0034407  0.5737 0.4735
## Residuals  7 0.041983 0.0059976
b2 <- betadisper(msne_adist1, env$bnll)
## Warning in betadisper(msne_adist1, env$bnll): some squared distances are
## negative and changed to zero
anova(b2)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq  Mean Sq F value Pr(>F)
## Groups     1 0.017793 0.017793  1.5787 0.2493
## Residuals  7 0.078896 0.011271
plot(b2)

b3 <- betadisper(msor_adist1, env$bnll)
anova(b3)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value  Pr(>F)  
## Groups     1 0.023888 0.0238881  3.5915 0.09992 .
## Residuals  7 0.046559 0.0066512                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mantel(arid_dist, msim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = msim_adist1) 
## 
## Mantel statistic r: 0.2029 
##       Significance: 0.093 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.193 0.236 0.294 0.386 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, msne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = msne_adist1) 
## 
## Mantel statistic r: 0.3313 
##       Significance: 0.112 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.359 0.446 0.507 0.541 
## Permutation: free
## Number of permutations: 999
mantel(arid_dist, msor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = arid_dist, ydis = msor_adist1) 
## 
## Mantel statistic r: 0.6545 
##       Significance: 0.018 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.301 0.462 0.610 0.692 
## Permutation: free
## Number of permutations: 999
mean(rowSums(betasite_widemal))
## [1] 40.11111
sd(rowSums(betasite_widemal))
## [1] 7.149204
height_dist <- select(env, mean.height)
height_dist <- dist(height_dist, method = "euclidean")


mantel(height_dist, msne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = msne_dist1) 
## 
## Mantel statistic r: -0.02486 
##       Significance: 0.497 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.312 0.372 0.439 0.520 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, msim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = msim_dist1) 
## 
## Mantel statistic r: -0.1551 
##       Significance: 0.825 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.175 0.242 0.301 0.339 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, msor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = msor_dist1) 
## 
## Mantel statistic r: -0.1589 
##       Significance: 0.808 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.239 0.301 0.361 0.450 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, msne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = msne_adist1) 
## 
## Mantel statistic r: 0.2784 
##       Significance: 0.145 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.324 0.377 0.444 0.511 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, msim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = msim_adist1) 
## 
## Mantel statistic r: -0.2062 
##       Significance: 0.9 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.230 0.296 0.348 0.427 
## Permutation: free
## Number of permutations: 999
mantel(height_dist, msor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = height_dist, ydis = msor_adist1) 
## 
## Mantel statistic r: 0.1001 
##       Significance: 0.301 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.287 0.375 0.418 0.490 
## Permutation: free
## Number of permutations: 999
NDVI_dist <- select(env, NDVI)
NDVI_dist <- dist(NDVI_dist, method = "euclidean")


mantel(NDVI_dist, msne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = msne_dist1) 
## 
## Mantel statistic r: -0.2664 
##       Significance: 0.905 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.376 0.442 0.533 0.656 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, msim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = msim_dist1) 
## 
## Mantel statistic r: 0.1641 
##       Significance: 0.134 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.189 0.234 0.273 0.313 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, msor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = msor_dist1) 
## 
## Mantel statistic r: -0.02938 
##       Significance: 0.507 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.266 0.342 0.400 0.451 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, msne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = msne_adist1) 
## 
## Mantel statistic r: -0.2505 
##       Significance: 0.919 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.404 0.498 0.567 0.618 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, msim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = msim_adist1) 
## 
## Mantel statistic r: 0.0522 
##       Significance: 0.393 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.239 0.302 0.364 0.404 
## Permutation: free
## Number of permutations: 999
mantel(NDVI_dist, msor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = NDVI_dist, ydis = msor_adist1) 
## 
## Mantel statistic r: -0.2494 
##       Significance: 0.896 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.281 0.410 0.566 0.684 
## Permutation: free
## Number of permutations: 999
cover_dist <- select(env, mean.cover)
cover_dist <- dist(cover_dist, method = "euclidean")


mantel(cover_dist, msne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = msne_dist1) 
## 
## Mantel statistic r: 0.4505 
##       Significance: 0.026 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.329 0.390 0.449 0.534 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, msim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = msim_dist1) 
## 
## Mantel statistic r: 0.05772 
##       Significance: 0.326 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.191 0.257 0.308 0.341 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, msor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = msor_dist1) 
## 
## Mantel statistic r: 0.3569 
##       Significance: 0.04 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.244 0.323 0.400 0.465 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, msne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = msne_adist1) 
## 
## Mantel statistic r: 0.2531 
##       Significance: 0.192 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.342 0.374 0.410 0.478 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, msim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = msim_adist1) 
## 
## Mantel statistic r: -0.03724 
##       Significance: 0.584 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.218 0.288 0.353 0.406 
## Permutation: free
## Number of permutations: 999
mantel(cover_dist, msor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## mantel(xdis = cover_dist, ydis = msor_adist1) 
## 
## Mantel statistic r: 0.2705 
##       Significance: 0.148 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.321 0.395 0.466 0.523 
## Permutation: free
## Number of permutations: 999

Beta-div figure

dat <- rbind(ground.oc, ground.abun, shrub.oc, shrub.abun, open.oc, open.abun, mal.oc, mal.abun)

dat <- as.data.frame(dat)
arth <- row.names(dat)
str(arth)
##  chr [1:8] "ground.oc" "ground.abun" "shrub.oc" "shrub.abun" "open.oc" ...
arth <- unlist(arth)
dat <- cbind(arth, dat)
dat$beta.SIM <- unlist(dat$beta.SIM)
dat$beta.SNE <- unlist(dat$beta.SNE)
dat$beta.SOR <- unlist(dat$beta.SOR)
arth <- row.names(dat)
dat <- dat %>% pivot_longer(2:4, names_to = "div", values_to = "value")
str(dat)
## tibble [24 × 3] (S3: tbl_df/tbl/data.frame)
##  $ arth : chr [1:24] "ground.oc" "ground.oc" "ground.oc" "ground.abun" ...
##  $ div  : chr [1:24] "beta.SIM" "beta.SNE" "beta.SOR" "beta.SIM" ...
##  $ value: num [1:24] 0.6444 0.0472 0.6916 0.6119 0.1827 ...
ggplot(dat, aes(arth, value, fill = div)) + geom_bar(stat = "identity")

dat <- filter(dat, div != "beta.SOR")
dat <- dat %>% separate_wider_delim(arth, ".", names = c("comm", "index"))

beta.oc <- filter(dat, index == "oc")
beta.abun <- filter(dat, index == "abun")

beta.oc$comm <- factor(beta.oc$comm, levels = c("ground", "shrub", "open", "mal"))
a <- ggplot(beta.oc, aes(comm, value, fill = div)) + geom_bar(position = "stack", stat = "identity", color = "black") + xlab("Arthropod community") + ylab("Sorenson's dissimilarity") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + scale_fill_manual(values = c("#94B49F", "#DF7861"), labels = c("Turnover", "Nestedness")) + scale_x_discrete(labels = c("Ground-active", "Canopy", "Open area", "Flying")) + theme(legend.title= element_blank()) + theme(legend.position="top")

a

beta.abun$comm <- factor(beta.abun$comm, levels = c("ground", "shrub", "open", "mal"))
b <- ggplot(beta.abun, aes(comm, value, fill = div)) + geom_bar(position = "stack", stat = "identity", color = "black") + xlab("Arthropod community") + ylab("Bray-Curtis dissimilarity") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + scale_fill_manual(values = c("#94B49F", "#DF7861"), labels = c("Balanced", "Gradient")) + scale_x_discrete(labels = c("Ground-active", "Canopy", "Open area", "Flying")) + theme(legend.title= element_blank()) + theme(legend.position="top")


plots <- list(a,b)
grobs <- list()
widths <- list()

for (i in 1:length(plots)){
    grobs[[i]] <- ggplotGrob(plots[[i]])
    widths[[i]] <- grobs[[i]]$widths[2:5]
}

maxwidth <- do.call(grid::unit.pmax, widths)
for (i in 1:length(grobs)){
     grobs[[i]]$widths[2:5] <- as.list(maxwidth)
}

p <- do.call("grid.arrange", c(grobs, ncol = 2))

p
## TableGrob (1 x 2) "arrange": 2 grobs
##   z     cells    name           grob
## 1 1 (1-1,1-1) arrange gtable[layout]
## 2 2 (1-1,2-2) arrange gtable[layout]

Decay models aridity

#ground active

library(ggtext)
## Warning: package 'ggtext' was built under R version 4.3.2
gsordata <- as.data.frame(cbind(gsor_dist1, gsor_adist1, arid_dist))
vegan::mantel(arid_dist, gsor_dist1, permutations = 999)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = gsor_dist1, permutations = 999) 
## 
## Mantel statistic r:  0.22 
##       Significance: 0.125 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.246 0.294 0.341 0.399 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, gsor_adist1, permutations = 999)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = gsor_adist1, permutations = 999) 
## 
## Mantel statistic r: 0.3866 
##       Significance: 0.026 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.278 0.341 0.384 0.476 
## Permutation: free
## Number of permutations: 999
a <- ggplot(gsordata, aes(arid_dist, gsor_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", se = FALSE, linetype="dashed") + 
  geom_smooth(aes(arid_dist, gsor_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", alpha = 0.15) + geom_point(aes(arid_dist, gsor_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Beta-diversity")  + 
  labs(subtitle = "<span style=color:#040D12;>r = 0.22, p = 0.126</span>, <span style=color:#9FBB73;>r = 0.39, p = 0.025 *</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11)) + xlab("")
a
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

#sig
gsimdata <- as.data.frame(cbind(gsim_dist1, gsim_adist1, arid_dist))
vegan::mantel(arid_dist, gsim_dist1, permutations = 999)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = gsim_dist1, permutations = 999) 
## 
## Mantel statistic r: -0.03229 
##       Significance: 0.604 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.217 0.303 0.365 0.459 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, gsim_adist1, permutations = 999)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = gsim_adist1, permutations = 999) 
## 
## Mantel statistic r: 0.002848 
##       Significance: 0.371 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.326 0.428 0.467 0.596 
## Permutation: free
## Number of permutations: 999
b <- ggplot(gsimdata, aes(arid_dist, gsim_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", linetype="dashed", se = FALSE, color = "black") + 
  geom_smooth(aes(arid_dist, gsim_adist1), color = "#9FBB73", method = "lm", linetype="dashed", se = FALSE) + geom_point(aes(arid_dist, gsim_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Turnover") + xlab("") + labs(subtitle = "<span style=color:#040D12;>r = -0.03, p = 0.58</span>, <span style=color:#9FBB73;>r = 0.003, p = 0.37 </span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))
b
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

#sig
gsnedata <- as.data.frame(cbind(gsne_dist1, gsne_adist1, arid_dist))
vegan::mantel(arid_dist, gsne_dist1, permutations = 9999)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = gsne_dist1, permutations = 9999) 
## 
## Mantel statistic r: 0.4154 
##       Significance: 0.0314 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.285 0.379 0.436 0.517 
## Permutation: free
## Number of permutations: 9999
vegan::mantel(arid_dist, gsne_adist1, permutations = 9999)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = gsne_adist1, permutations = 9999) 
## 
## Mantel statistic r: 0.4433 
##       Significance: 0.019 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.232 0.314 0.401 0.506 
## Permutation: free
## Number of permutations: 9999
c <- ggplot(gsnedata, aes(arid_dist, gsne_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", alpha = 0.15) + 
  geom_smooth(aes(arid_dist, gsne_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", alpha = 0.15) + geom_point(aes(arid_dist, gsne_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Nestedness") + xlab("") + labs(subtitle = "<span style=color:#040D12;>r = 42, p = 0.03 *</span>, <span style=color:#9FBB73;>r = 0.44, p = 0.02 *</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))

c
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

#scale_color_manual(name = "",values = c("black", "#9FBB73"), labels = c("Incidence-based", "Abundance-based")) +
 # theme(legend.position="top")


ssordata <- as.data.frame(cbind(ssor_dist1, sarid_dist, ssor_adist1))
vegan::mantel(sarid_dist, ssor_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = sarid_dist, ydis = ssor_dist1) 
## 
## Mantel statistic r: 0.4459 
##       Significance: 0.13056 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.493 0.643 0.670 0.696 
## Permutation: free
## Number of permutations: 719
vegan::mantel(sarid_dist, ssor_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = sarid_dist, ydis = ssor_adist1) 
## 
## Mantel statistic r:  0.52 
##       Significance: 0.073611 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.472 0.632 0.673 0.717 
## Permutation: free
## Number of permutations: 719
ggplot(ssordata, aes(sarid_dist, ssor_dist1)) + geom_point() + geom_smooth(method = "lm")
## `geom_smooth()` using formula = 'y ~ x'

ssimdata <- as.data.frame(cbind(ssim_dist1, sarid_dist, ssim_adist1))
vegan::mantel(sarid_dist, ssim_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = sarid_dist, ydis = ssim_dist1) 
## 
## Mantel statistic r: 0.565 
##       Significance: 0.0013889 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.366 0.437 0.480 0.518 
## Permutation: free
## Number of permutations: 719
vegan::mantel(sarid_dist, ssim_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = sarid_dist, ydis = ssim_adist1) 
## 
## Mantel statistic r: 0.6395 
##       Significance: 0.043056 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.493 0.628 0.806 0.833 
## Permutation: free
## Number of permutations: 719
ggplot(ssimdata, aes(sarid_dist, ssim_dist1)) + geom_point() + geom_smooth(method = "lm")
## `geom_smooth()` using formula = 'y ~ x'

ssnedata <- as.data.frame(cbind(ssne_dist1, sarid_dist, ssne_adist1))
vegan::mantel(sarid_dist, ssne_dist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = sarid_dist, ydis = ssne_dist1) 
## 
## Mantel statistic r: -0.2157 
##       Significance: 0.82917 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.379 0.579 0.781 0.821 
## Permutation: free
## Number of permutations: 719
vegan::mantel(sarid_dist, ssne_adist1)
## 'nperm' >= set of all permutations: complete enumeration.
## Set of permutations < 'minperm'. Generating entire set.
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = sarid_dist, ydis = ssne_adist1) 
## 
## Mantel statistic r: -0.535 
##       Significance: 0.95 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.390 0.474 0.528 0.563 
## Permutation: free
## Number of permutations: 719
ggplot(ssnedata, aes(sarid_dist, ssne_dist1)) + geom_point() + geom_smooth(method = "lm")
## `geom_smooth()` using formula = 'y ~ x'

#not sig
d <- ggplot(ssordata, aes(sarid_dist, ssor_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", se = FALSE, linetype="dashed") + 
  geom_smooth(aes(sarid_dist, ssor_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", se = FALSE, linetype="dashed") + geom_point(aes(sarid_dist, ssor_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Beta-diversity") + xlab("") + labs(subtitle = "<span style=color:#040D12;>r = 0.45, p = 0.13</span>, <span style=color:#9FBB73;>r = 0.52, p = 0.07 </span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11)) 
d
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

#sig
e <- ggplot(ssimdata, aes(sarid_dist, ssim_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", alpha = 0.15) + 
  geom_smooth(aes(sarid_dist, ssim_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", alpha = 0.15) + geom_point(aes(sarid_dist, ssim_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Turnover") + xlab("") + labs(subtitle = "<span style=color:#040D12;>r = 0.565, p = 0.001 ***</span>, <span style=color:#9FBB73;>r = 0.64, p = 0.04 *</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))  

e
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

f <- ggplot(ssnedata, aes(sarid_dist, ssne_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", se = FALSE, linetype="dashed") + 
  geom_smooth(aes(sarid_dist, ssne_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73",se = FALSE, linetype="dashed") + geom_point(aes(sarid_dist, ssne_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Nestedness") + xlab("")  + labs(subtitle = "<span style=color:#040D12;>r = -0.21, p = 0.83</span>, <span style=color:#9FBB73;>r = 0.535, p = 0.95</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))

f
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

osordata <- as.data.frame(cbind(osor_dist1, arid_dist, osor_adist1))
vegan::mantel(arid_dist, osor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = osor_dist1) 
## 
## Mantel statistic r: -0.0977 
##       Significance: 0.662 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.270 0.333 0.369 0.404 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, osor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = osor_adist1) 
## 
## Mantel statistic r: 0.03328 
##       Significance: 0.415 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.231 0.318 0.385 0.437 
## Permutation: free
## Number of permutations: 999
osimdata <- as.data.frame(cbind(osim_dist1, arid_dist, osim_adist1))
vegan::mantel(arid_dist, osim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = osim_dist1) 
## 
## Mantel statistic r: -0.1019 
##       Significance: 0.719 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.223 0.311 0.393 0.434 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, osim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = osim_adist1) 
## 
## Mantel statistic r: -0.05045 
##       Significance: 0.661 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.204 0.262 0.345 0.388 
## Permutation: free
## Number of permutations: 999
osnedata <- as.data.frame(cbind(osne_dist1, arid_dist, osne_adist1))
vegan::mantel(arid_dist, osne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = osne_dist1) 
## 
## Mantel statistic r: 0.04211 
##       Significance: 0.38 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.270 0.353 0.470 0.544 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, osne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = osne_adist1) 
## 
## Mantel statistic r: 0.06877 
##       Significance: 0.323 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.285 0.367 0.425 0.471 
## Permutation: free
## Number of permutations: 999
g <- ggplot(osordata, aes(arid_dist, osor_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", se = FALSE, linetype="dashed") + 
  geom_smooth(aes(arid_dist, osor_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", se = FALSE, linetype="dashed") + geom_point(aes(arid_dist, osor_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Beta-diversity") + xlab("")  + labs(subtitle = "<span style=color:#040D12;>r = -0.097, p = 0.66</span>, <span style=color:#9FBB73;>r = 0.65, p = 0.014 *</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))
g
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

h <- ggplot(osimdata, aes(arid_dist, osim_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", linetype="dashed", se = FALSE, color = "black") + 
  geom_smooth(aes(arid_dist, osim_adist1), color = "#9FBB73", method = "lm", linetype="dashed", se = FALSE) + geom_point(aes(arid_dist, osim_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Turnover") + xlab("") + labs(subtitle = "<span style=color:#040D12;>r = -0.10, p = 0.722</span>, <span style=color:#9FBB73;>r = 0.2, p = 0.09</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))   
h
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

#sig

i <- ggplot(osnedata, aes(arid_dist, osne_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", linetype="dashed", se = FALSE) + 
  geom_smooth(aes(arid_dist, osne_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", linetype="dashed", se = FALSE) + geom_point(aes(arid_dist, osne_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Nestedness") + xlab("") + labs(subtitle = "<span style=color:#040D12;>r = 0.042, p = 0.378</span>, <span style=color:#9FBB73;>r = 0.33, p = 0.107</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))


i
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

msordata <- as.data.frame(cbind(msor_dist1, arid_dist, msor_adist1))
vegan::mantel(arid_dist, msor_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = msor_dist1) 
## 
## Mantel statistic r: 0.525 
##       Significance: 0.014 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.256 0.337 0.420 0.539 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, msor_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = msor_adist1) 
## 
## Mantel statistic r: 0.6545 
##       Significance: 0.016 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.259 0.469 0.613 0.718 
## Permutation: free
## Number of permutations: 999
msimdata <- as.data.frame(cbind(msim_dist1, arid_dist, msim_adist1))
vegan::mantel(arid_dist, msim_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = msim_dist1) 
## 
## Mantel statistic r: 0.3266 
##       Significance: 0.011 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.203 0.251 0.292 0.323 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, msim_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = msim_adist1) 
## 
## Mantel statistic r: 0.2029 
##       Significance: 0.102 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.207 0.247 0.307 0.360 
## Permutation: free
## Number of permutations: 999
msnedata <- as.data.frame(cbind(msne_dist1, arid_dist, msne_adist1))
vegan::mantel(arid_dist, msne_dist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = msne_dist1) 
## 
## Mantel statistic r: 0.3345 
##       Significance: 0.097 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.330 0.398 0.519 0.616 
## Permutation: free
## Number of permutations: 999
vegan::mantel(arid_dist, msne_adist1)
## 
## Mantel statistic based on Pearson's product-moment correlation 
## 
## Call:
## vegan::mantel(xdis = arid_dist, ydis = msne_adist1) 
## 
## Mantel statistic r: 0.3313 
##       Significance: 0.106 
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.337 0.453 0.493 0.560 
## Permutation: free
## Number of permutations: 999
#sig
j <- ggplot(msordata, aes(arid_dist, msor_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", alpha = 0.15) + 
  geom_smooth(aes(arid_dist, msor_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", alpha = 0.15) + geom_point(aes(arid_dist, msor_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Beta-diversity") + xlab("Aridity (Euclidean Distance)")  + labs(subtitle = "<span style=color:#040D12;>r = 0.525, p = 0.015 *</span>, <span style=color:#9FBB73;>r = 0.2, p = 0.01 **</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))
j
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

#i is, a isnt
k <- ggplot(msimdata, aes(arid_dist, msim_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm",alpha = 0.15, color = "black") + 
  geom_smooth(aes(arid_dist, msim_adist1), color = "#9FBB73", method = "lm", linetype="dashed", se = FALSE) + geom_point(aes(arid_dist, msim_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Turnover") + xlab("Aridity (Euclidean Distance)") + xlab("Aridity (Euclidean Distance)")  + labs(subtitle = "<span style=color:#040D12;>r = 0.525, p = 0.014 *</span>, <span style=color:#9FBB73;>r = 0.65, p = 0.017 *</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11))  
k
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

#not

l <- ggplot(osnedata, aes(arid_dist, msne_dist1)) + geom_point(color = "#040D12") + 
  geom_smooth(method = "lm", color = "black", fill = "black", linetype="dashed", se = FALSE) + 
  geom_smooth(aes(arid_dist, msne_adist1), method = "lm", color = "#9FBB73", fill = "#9FBB73", linetype="dashed", se = FALSE) + geom_point(aes(arid_dist, msne_adist1), color = "#9FBB73") + theme(axis.text=element_text(size=12),
        axis.title=element_text(size=14,face="bold")) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + ylab("Nestedness") + xlab("Aridity (Euclidean Distance)") + labs(subtitle = "<span style=color:#040D12;>r = 0.3345, p = 0.093</span>, <span style=color:#9FBB73;>r = 0.33, p = 0.11</span>") + 
  theme(plot.subtitle = element_markdown(hjust = 0,face="bold", size = 11)) 

l
## Don't know how to automatically pick scale for object of type <dist>.
## Defaulting to continuous.
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

# 
# plots <- list(a, b, c, d, e, f, g, h, i, j, k)
# grobs <- list()
# widths <- list()
# 
# for (i in 1:length(plots)){
#     grobs[[i]] <- ggplotGrob(plots[[i]])
#     widths[[i]] <- grobs[[i]]$widths[2:5]
# }
# 
# maxwidth <- do.call(grid::unit.pmax, widths)
# for (i in 1:length(grobs)){
#      grobs[[i]]$widths[2:5] <- as.list(maxwidth)
# }
# 
# p <- do.call("grid.arrange", c(grobs, ncol = 3))
# p
# 
# grid.arrange(grobs = plots, ncol = 3)

grid.arrange(a,b, c, d, e, f, g, h, i, j, k, l, ncol = 3)
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'
## Don't know how to automatically pick scale for object of type <dist>.
## Defaulting to continuous.
## `geom_smooth()` using formula = 'y ~ x'
## `geom_smooth()` using formula = 'y ~ x'

Indicator species analysis

library(indicspecies)
indval <- multipatt(comm, env$bnll, control = how(nperm=999))
indval
## $call
## multipatt(x = comm, cluster = env$bnll, control = how(nperm = 999))
## 
## $func
## [1] "IndVal.g"
## 
## $cluster
## [1] "absent"  "present" "present" "absent"  "present" "absent"  "present"
## [8] "present" "absent" 
## 
## $comb
##       absent present absent+present
##  [1,]      1       0              1
##  [2,]      0       1              1
##  [3,]      0       1              1
##  [4,]      1       0              1
##  [5,]      0       1              1
##  [6,]      1       0              1
##  [7,]      0       1              1
##  [8,]      0       1              1
##  [9,]      1       0              1
## 
## $str
##                                        absent   present absent+present
## Ageniellaaccepta                   0.41099747 0.3601801      0.5773503
## Agenioideusbirkmanni               0.20761370 0.9097177      0.8164966
## Alaephus                           0.00000000 0.6324555      0.4714045
## Alaudes                            0.00000000 0.6324555      0.4714045
## Alopecosakochi                     0.37267800 0.8498366      0.8819171
## Amarainsignis                      0.00000000 0.7745967      0.5773503
## Anepsiusdeliculatus                0.00000000 0.4472136      0.3333333
## Anthomyiidae                       0.37267800 0.7601170      0.8164966
## Aphoebantus                        0.37267800 0.2981424      0.4714045
## Apristus                           0.59761430 0.2390457      0.5773503
## Arenigena                          0.00000000 0.7745967      0.5773503
## Arenivaga                          0.53708616 0.7544738      0.9428090
## Athysanella                        0.00000000 0.6324555      0.4714045
## Auchmobius                         0.22981928 0.5616876      0.5773503
## Bethylidae                         0.75235479 0.5892112      0.9428090
## Blapstinus                         0.50507627 0.5421047      0.7453560
## Brachycistidinae.large             0.24397502 0.6761234      0.6666667
## Brachycistidinae.small             0.56980288 0.3675118      0.7453560
## Brevitrichia                       0.50000000 0.0000000      0.3333333
## Calilena.Hololena                  0.18380366 0.4159002      0.4714045
## Callilepis                         0.71296419 0.7012004      1.0000000
## Caponiidae                         0.50000000 0.0000000      0.3333333
## Carpophilushemipterus              0.95602222 0.1311652      0.7453560
## Ceratagallia                       0.00000000 0.6324555      0.4714045
## Ceuthophilus                       0.46291005 0.5855400      0.7453560
## Chyphotes                          0.57388267 0.8189375      1.0000000
## Cicadellidae.palemanyspots         0.00000000 0.4472136      0.3333333
## Conibiosomaelongatum               0.88852332 0.2901905      0.8164966
## Conibiusseriatus                   0.50000000 0.0000000      0.3333333
## Culicidae                          0.00000000 0.6324555      0.4714045
## Cydnidae                           0.00000000 0.6324555      0.4714045
## Cyphomyrmexwheeleri                0.71743005 0.2504897      0.6666667
## Dasymutillacalifornica             0.62575256 0.3607222      0.7453560
## Dasymutillacoccineohirta           0.63343079 0.2810913      0.6666667
## Dasymutillasackenii                0.62828086 0.2051957      0.5773503
## Dasymutillasatanas.flammifera      0.00000000 0.4472136      0.3333333
## Dictynidae                         0.70710678 0.0000000      0.4714045
## Dolichopodidae                     0.47673129 0.5720776      0.7453560
## Dorymyrmexbicolor                  0.82115787 0.5104506      0.9428090
## Dorymyrmexinsanus                  0.05528322 0.6285778      0.5773503
## Drassyllus                         0.65252644 0.7577660      1.0000000
## Drosophilamelanogasterspeciesgroup 0.88083033 0.4234505      0.9428090
## Eleodes                            0.64549722 0.1825742      0.5773503
## Eleodesarmata                      0.41522740 0.8775619      0.9428090
## Eleodesdentipes                    0.00000000 0.6324555      0.4714045
## Eleodesgigantea                    0.31008684 0.3508232      0.4714045
## Emblethisvicarius                  0.71743005 0.6230853      0.9428090
## Entiminae                          0.00000000 0.4472136      0.3333333
## Ephydridae                         0.34340141 0.4596964      0.5773503
## Eremobatidae                       0.57192902 0.8203031      1.0000000
## Eupnigodessierranus                0.84115823 0.1063990      0.6666667
## Foreliuspruinosus                  0.62601269 0.2079501      0.5773503
## Geocorisatricolor                  0.59761430 0.2390457      0.5773503
## Geocorispallens                    0.45267873 0.7682213      0.8819171
## Glyptinaatriventris                0.00000000 0.6324555      0.4714045
## Gnaphosa                           0.50000000 0.6324555      0.8164966
## Gryllus                            0.40496194 0.6846931      0.8164966
## Haploembiasolieri                  0.00000000 0.4472136      0.3333333
## Hoplosphyrumboreale                0.00000000 0.6324555      0.4714045
## Hymenorus                          0.70710678 0.0000000      0.4714045
## Kibramoamadrona                    0.30429031 0.8073734      0.8164966
## Kukulcania                         0.70710678 0.0000000      0.4714045
## Lasioglossum                       0.00000000 0.7745967      0.5773503
## Latrodectushesperus                0.23312620 0.7912566      0.7453560
## Lepidocnemeplatiasericea           0.70710678 0.0000000      0.4714045
## Litaneutriaminor                   0.60241450 0.6425755      0.8819171
## Loxoscelesdeserta                  0.82992500 0.1277753      0.6666667
## Machilinusaurantiacus              0.24397502 0.6761234      0.6666667
## Melyridae.redunicolor              0.86602540 0.0000000      0.5773503
## Mesomachilis                       0.39528471 0.2738613      0.4714045
## Messorandrei                       0.00000000 0.7745967      0.5773503
## Messorpergandei                    0.68190106 0.1673582      0.6666667
## Metoponium                         0.63807747 0.4276180      0.7453560
## Micaria                            0.49186938 0.4543695      0.6666667
## Miridae                            0.00000000 0.4472136      0.3333333
## Mirolepismadeserticola             0.57826889 0.4457871      0.7453560
## Miscophus                          0.00000000 0.4472136      0.3333333
## Muscidae                           0.94225817 0.2118014      0.8164966
## Myrmecocystuskennedyi              0.23336228 0.8844027      0.8164966
## Myrmecophilusmanni.oregonensis     0.37267800 0.2981424      0.4714045
## Mythicomyia                        0.31008684 0.4961389      0.5773503
## Neoanagraphischamberlini           0.46291005 0.6761234      0.8164966
## Niptus                             0.75000000 0.3162278      0.7453560
## Notibiuspuncticollis               0.34156503 0.5656854      0.6666667
## Nysiusraphanus                     0.76948376 0.2051957      0.6666667
## Odontophotopsis                    0.17751790 0.8361577      0.7453560
## Oedaleonotusenigma                 0.67419986 0.1348400      0.5773503
## Oligotomanigra                     0.86602540 0.0000000      0.5773503
## Oonopidae                          0.50000000 0.0000000      0.3333333
## Opatroidespunctulatus              0.70710678 0.0000000      0.4714045
## Orgerius                           0.34780417 0.4543695      0.5773503
## Osbornellus                        0.00000000 0.8944272      0.6666667
## Oxyopesscalaris                    0.31008684 0.3508232      0.4714045
## Paravaejovis                       0.81173563 0.5840251      1.0000000
## Parcoblatta                        0.20761370 0.7046643      0.6666667
## Pheidolehyatti                     0.66972338 0.7426107      1.0000000
## Pherocera                          0.00000000 0.4472136      0.3333333
## Phoridae                           0.50280114 0.8141998      0.9428090
## Phthiria                           0.00000000 0.6324555      0.4714045
## Platygastridae.black               0.31622777 0.6928203      0.7453560
## Plectreurys                        0.00000000 0.4472136      0.3333333
## Pogonomyrmexhoelldobleri           0.00000000 0.4472136      0.3333333
## Pompilus                           0.18380366 0.5881717      0.5773503
## Pompilusphoenix                    0.75731725 0.3757346      0.8164966
## Porcellionidespruinosis            0.52082722 0.3024824      0.5773503
## Pseudoscorpiones                   0.47673129 0.5720776      0.7453560
## Psilochorus                        0.46518911 0.8852113      1.0000000
## Rhagodera                          0.00000000 0.4472136      0.3333333
## Salticidae                         0.51847585 0.8550923      1.0000000
## Sarcophagidae                      0.72276418 0.6181339      0.9428090
## Scelioninae                        0.50000000 0.0000000      0.3333333
## Scolopendrapolymorpha              0.00000000 0.4472136      0.3333333
## Scopoides                          0.40824829 0.6324555      0.7453560
## Solenopsisxyloni                   0.64450122 0.7646033      1.0000000
## Sphaeropthalma                     0.51149575 0.8069466      0.9428090
## Steatoda                           0.70710678 0.0000000      0.4714045
## Tachinidae                         0.40824829 0.5163978      0.6666667
## Tachysphex                         0.70710678 0.0000000      0.4714045
## Temnothoraxandrei                  0.00000000 0.4472136      0.3333333
## Tetragonoderuspallidus             0.00000000 0.7745967      0.5773503
## Theridiidae                        0.48481206 0.6511003      0.8164966
## Thermobiadomestica                 0.93629695 0.2720456      0.8819171
## Titanebo                           0.37267800 0.2981424      0.4714045
## Tolliussetosus                     0.61346890 0.7063460      0.9428090
## Trimerotropispseudofasciata        0.70710678 0.0000000      0.4714045
## Triorophus                         0.82107083 0.2463212      0.8164966
## Typhaeastercorea                   0.84515425 0.4140393      0.8819171
## Urophorushumeralis                 0.97683083 0.1657737      0.8819171
## Xysticus                           0.52704628 0.5163978      0.7453560
## 
## $A
##                                        absent    present absent+present
## Ageniellaaccepta                   0.67567568 0.32432432              1
## Agenioideusbirkmanni               0.17241379 0.82758621              1
## Alaephus                           0.00000000 1.00000000              1
## Alaudes                            0.00000000 1.00000000              1
## Alopecosakochi                     0.27777778 0.72222222              1
## Amarainsignis                      0.00000000 1.00000000              1
## Anepsiusdeliculatus                0.00000000 1.00000000              1
## Anthomyiidae                       0.27777778 0.72222222              1
## Aphoebantus                        0.55555556 0.44444444              1
## Apristus                           0.71428571 0.28571429              1
## Arenigena                          0.00000000 1.00000000              1
## Arenivaga                          0.28846154 0.71153846              1
## Athysanella                        0.00000000 1.00000000              1
## Auchmobius                         0.21126761 0.78873239              1
## Bethylidae                         0.56603774 0.43396226              1
## Blapstinus                         0.51020408 0.48979592              1
## Brachycistidinae.large             0.23809524 0.76190476              1
## Brachycistidinae.small             0.32467532 0.67532468              1
## Brevitrichia                       1.00000000 0.00000000              1
## Calilena.Hololena                  0.13513514 0.86486486              1
## Callilepis                         0.50831793 0.49168207              1
## Caponiidae                         1.00000000 0.00000000              1
## Carpophilushemipterus              0.91397849 0.08602151              1
## Ceratagallia                       0.00000000 1.00000000              1
## Ceuthophilus                       0.42857143 0.57142857              1
## Chyphotes                          0.32934132 0.67065868              1
## Cicadellidae.palemanyspots         0.00000000 1.00000000              1
## Conibiosomaelongatum               0.78947368 0.21052632              1
## Conibiusseriatus                   1.00000000 0.00000000              1
## Culicidae                          0.00000000 1.00000000              1
## Cydnidae                           0.00000000 1.00000000              1
## Cyphomyrmexwheeleri                0.68627451 0.31372549              1
## Dasymutillacalifornica             0.78313253 0.21686747              1
## Dasymutillacoccineohirta           0.80246914 0.19753086              1
## Dasymutillasackenii                0.78947368 0.21052632              1
## Dasymutillasatanas.flammifera      0.00000000 1.00000000              1
## Dictynidae                         1.00000000 0.00000000              1
## Dolichopodidae                     0.45454545 0.54545455              1
## Dorymyrmexbicolor                  0.67430025 0.32569975              1
## Dorymyrmexinsanus                  0.01222494 0.98777506              1
## Drassyllus                         0.42579075 0.57420925              1
## Drosophilamelanogasterspeciesgroup 0.77586207 0.22413793              1
## Eleodes                            0.83333333 0.16666667              1
## Eleodesarmata                      0.22988506 0.77011494              1
## Eleodesdentipes                    0.00000000 1.00000000              1
## Eleodesgigantea                    0.38461538 0.61538462              1
## Emblethisvicarius                  0.51470588 0.48529412              1
## Entiminae                          0.00000000 1.00000000              1
## Ephydridae                         0.47169811 0.52830189              1
## Eremobatidae                       0.32710280 0.67289720              1
## Eupnigodessierranus                0.94339623 0.05660377              1
## Foreliuspruinosus                  0.78378378 0.21621622              1
## Geocorisatricolor                  0.71428571 0.28571429              1
## Geocorispallens                    0.40983607 0.59016393              1
## Glyptinaatriventris                0.00000000 1.00000000              1
## Gnaphosa                           0.50000000 0.50000000              1
## Gryllus                            0.21865889 0.78134111              1
## Haploembiasolieri                  0.00000000 1.00000000              1
## Hoplosphyrumboreale                0.00000000 1.00000000              1
## Hymenorus                          1.00000000 0.00000000              1
## Kibramoamadrona                    0.18518519 0.81481481              1
## Kukulcania                         1.00000000 0.00000000              1
## Lasioglossum                       0.00000000 1.00000000              1
## Latrodectushesperus                0.21739130 0.78260870              1
## Lepidocnemeplatiasericea           1.00000000 0.00000000              1
## Litaneutriaminor                   0.48387097 0.51612903              1
## Loxoscelesdeserta                  0.91836735 0.08163265              1
## Machilinusaurantiacus              0.23809524 0.76190476              1
## Melyridae.redunicolor              1.00000000 0.00000000              1
## Mesomachilis                       0.62500000 0.37500000              1
## Messorandrei                       0.00000000 1.00000000              1
## Messorpergandei                    0.92997812 0.07002188              1
## Metoponium                         0.54285714 0.45714286              1
## Micaria                            0.48387097 0.51612903              1
## Miridae                            0.00000000 1.00000000              1
## Mirolepismadeserticola             0.66878981 0.33121019              1
## Miscophus                          0.00000000 1.00000000              1
## Muscidae                           0.88785047 0.11214953              1
## Myrmecocystuskennedyi              0.21783181 0.78216819              1
## Myrmecophilusmanni.oregonensis     0.55555556 0.44444444              1
## Mythicomyia                        0.38461538 0.61538462              1
## Neoanagraphischamberlini           0.42857143 0.57142857              1
## Niptus                             0.75000000 0.25000000              1
## Notibiuspuncticollis               0.46666667 0.53333333              1
## Nysiusraphanus                     0.78947368 0.21052632              1
## Odontophotopsis                    0.12605042 0.87394958              1
## Oedaleonotusenigma                 0.90909091 0.09090909              1
## Oligotomanigra                     1.00000000 0.00000000              1
## Oonopidae                          1.00000000 0.00000000              1
## Opatroidespunctulatus              1.00000000 0.00000000              1
## Orgerius                           0.48387097 0.51612903              1
## Osbornellus                        0.00000000 1.00000000              1
## Oxyopesscalaris                    0.38461538 0.61538462              1
## Paravaejovis                       0.65891473 0.34108527              1
## Parcoblatta                        0.17241379 0.82758621              1
## Pheidolehyatti                     0.44852941 0.55147059              1
## Pherocera                          0.00000000 1.00000000              1
## Phoridae                           0.33707865 0.66292135              1
## Phthiria                           0.00000000 1.00000000              1
## Platygastridae.black               0.20000000 0.80000000              1
## Plectreurys                        0.00000000 1.00000000              1
## Pogonomyrmexhoelldobleri           0.00000000 1.00000000              1
## Pompilus                           0.13513514 0.86486486              1
## Pompilusphoenix                    0.76470588 0.23529412              1
## Porcellionidespruinosis            0.54252199 0.45747801              1
## Pseudoscorpiones                   0.45454545 0.54545455              1
## Psilochorus                        0.21640091 0.78359909              1
## Rhagodera                          0.00000000 1.00000000              1
## Salticidae                         0.26881720 0.73118280              1
## Sarcophagidae                      0.52238806 0.47761194              1
## Scelioninae                        1.00000000 0.00000000              1
## Scolopendrapolymorpha              0.00000000 1.00000000              1
## Scopoides                          0.33333333 0.66666667              1
## Solenopsisxyloni                   0.41538182 0.58461818              1
## Sphaeropthalma                     0.34883721 0.65116279              1
## Steatoda                           1.00000000 0.00000000              1
## Tachinidae                         0.33333333 0.66666667              1
## Tachysphex                         1.00000000 0.00000000              1
## Temnothoraxandrei                  0.00000000 1.00000000              1
## Tetragonoderuspallidus             0.00000000 1.00000000              1
## Theridiidae                        0.47008547 0.52991453              1
## Thermobiadomestica                 0.87665198 0.12334802              1
## Titanebo                           0.55555556 0.44444444              1
## Tolliussetosus                     0.37634409 0.62365591              1
## Trimerotropispseudofasciata        1.00000000 0.00000000              1
## Triorophus                         0.89887640 0.10112360              1
## Typhaeastercorea                   0.71428571 0.28571429              1
## Urophorushumeralis                 0.95419847 0.04580153              1
## Xysticus                           0.55555556 0.44444444              1
## 
## $B
##                                    absent present absent+present
## Ageniellaaccepta                     0.25     0.4      0.3333333
## Agenioideusbirkmanni                 0.25     1.0      0.6666667
## Alaephus                             0.00     0.4      0.2222222
## Alaudes                              0.00     0.4      0.2222222
## Alopecosakochi                       0.50     1.0      0.7777778
## Amarainsignis                        0.00     0.6      0.3333333
## Anepsiusdeliculatus                  0.00     0.2      0.1111111
## Anthomyiidae                         0.50     0.8      0.6666667
## Aphoebantus                          0.25     0.2      0.2222222
## Apristus                             0.50     0.2      0.3333333
## Arenigena                            0.00     0.6      0.3333333
## Arenivaga                            1.00     0.8      0.8888889
## Athysanella                          0.00     0.4      0.2222222
## Auchmobius                           0.25     0.4      0.3333333
## Bethylidae                           1.00     0.8      0.8888889
## Blapstinus                           0.50     0.6      0.5555556
## Brachycistidinae.large               0.25     0.6      0.4444444
## Brachycistidinae.small               1.00     0.2      0.5555556
## Brevitrichia                         0.25     0.0      0.1111111
## Calilena.Hololena                    0.25     0.2      0.2222222
## Callilepis                           1.00     1.0      1.0000000
## Caponiidae                           0.25     0.0      0.1111111
## Carpophilushemipterus                1.00     0.2      0.5555556
## Ceratagallia                         0.00     0.4      0.2222222
## Ceuthophilus                         0.50     0.6      0.5555556
## Chyphotes                            1.00     1.0      1.0000000
## Cicadellidae.palemanyspots           0.00     0.2      0.1111111
## Conibiosomaelongatum                 1.00     0.4      0.6666667
## Conibiusseriatus                     0.25     0.0      0.1111111
## Culicidae                            0.00     0.4      0.2222222
## Cydnidae                             0.00     0.4      0.2222222
## Cyphomyrmexwheeleri                  0.75     0.2      0.4444444
## Dasymutillacalifornica               0.50     0.6      0.5555556
## Dasymutillacoccineohirta             0.50     0.4      0.4444444
## Dasymutillasackenii                  0.50     0.2      0.3333333
## Dasymutillasatanas.flammifera        0.00     0.2      0.1111111
## Dictynidae                           0.50     0.0      0.2222222
## Dolichopodidae                       0.50     0.6      0.5555556
## Dorymyrmexbicolor                    1.00     0.8      0.8888889
## Dorymyrmexinsanus                    0.25     0.4      0.3333333
## Drassyllus                           1.00     1.0      1.0000000
## Drosophilamelanogasterspeciesgroup   1.00     0.8      0.8888889
## Eleodes                              0.50     0.2      0.3333333
## Eleodesarmata                        0.75     1.0      0.8888889
## Eleodesdentipes                      0.00     0.4      0.2222222
## Eleodesgigantea                      0.25     0.2      0.2222222
## Emblethisvicarius                    1.00     0.8      0.8888889
## Entiminae                            0.00     0.2      0.1111111
## Ephydridae                           0.25     0.4      0.3333333
## Eremobatidae                         1.00     1.0      1.0000000
## Eupnigodessierranus                  0.75     0.2      0.4444444
## Foreliuspruinosus                    0.50     0.2      0.3333333
## Geocorisatricolor                    0.50     0.2      0.3333333
## Geocorispallens                      0.50     1.0      0.7777778
## Glyptinaatriventris                  0.00     0.4      0.2222222
## Gnaphosa                             0.50     0.8      0.6666667
## Gryllus                              0.75     0.6      0.6666667
## Haploembiasolieri                    0.00     0.2      0.1111111
## Hoplosphyrumboreale                  0.00     0.4      0.2222222
## Hymenorus                            0.50     0.0      0.2222222
## Kibramoamadrona                      0.50     0.8      0.6666667
## Kukulcania                           0.50     0.0      0.2222222
## Lasioglossum                         0.00     0.6      0.3333333
## Latrodectushesperus                  0.25     0.8      0.5555556
## Lepidocnemeplatiasericea             0.50     0.0      0.2222222
## Litaneutriaminor                     0.75     0.8      0.7777778
## Loxoscelesdeserta                    0.75     0.2      0.4444444
## Machilinusaurantiacus                0.25     0.6      0.4444444
## Melyridae.redunicolor                0.75     0.0      0.3333333
## Mesomachilis                         0.25     0.2      0.2222222
## Messorandrei                         0.00     0.6      0.3333333
## Messorpergandei                      0.50     0.4      0.4444444
## Metoponium                           0.75     0.4      0.5555556
## Micaria                              0.50     0.4      0.4444444
## Miridae                              0.00     0.2      0.1111111
## Mirolepismadeserticola               0.50     0.6      0.5555556
## Miscophus                            0.00     0.2      0.1111111
## Muscidae                             1.00     0.4      0.6666667
## Myrmecocystuskennedyi                0.25     1.0      0.6666667
## Myrmecophilusmanni.oregonensis       0.25     0.2      0.2222222
## Mythicomyia                          0.25     0.4      0.3333333
## Neoanagraphischamberlini             0.50     0.8      0.6666667
## Niptus                               0.75     0.4      0.5555556
## Notibiuspuncticollis                 0.25     0.6      0.4444444
## Nysiusraphanus                       0.75     0.2      0.4444444
## Odontophotopsis                      0.25     0.8      0.5555556
## Oedaleonotusenigma                   0.50     0.2      0.3333333
## Oligotomanigra                       0.75     0.0      0.3333333
## Oonopidae                            0.25     0.0      0.1111111
## Opatroidespunctulatus                0.50     0.0      0.2222222
## Orgerius                             0.25     0.4      0.3333333
## Osbornellus                          0.00     0.8      0.4444444
## Oxyopesscalaris                      0.25     0.2      0.2222222
## Paravaejovis                         1.00     1.0      1.0000000
## Parcoblatta                          0.25     0.6      0.4444444
## Pheidolehyatti                       1.00     1.0      1.0000000
## Pherocera                            0.00     0.2      0.1111111
## Phoridae                             0.75     1.0      0.8888889
## Phthiria                             0.00     0.4      0.2222222
## Platygastridae.black                 0.50     0.6      0.5555556
## Plectreurys                          0.00     0.2      0.1111111
## Pogonomyrmexhoelldobleri             0.00     0.2      0.1111111
## Pompilus                             0.25     0.4      0.3333333
## Pompilusphoenix                      0.75     0.6      0.6666667
## Porcellionidespruinosis              0.50     0.2      0.3333333
## Pseudoscorpiones                     0.50     0.6      0.5555556
## Psilochorus                          1.00     1.0      1.0000000
## Rhagodera                            0.00     0.2      0.1111111
## Salticidae                           1.00     1.0      1.0000000
## Sarcophagidae                        1.00     0.8      0.8888889
## Scelioninae                          0.25     0.0      0.1111111
## Scolopendrapolymorpha                0.00     0.2      0.1111111
## Scopoides                            0.50     0.6      0.5555556
## Solenopsisxyloni                     1.00     1.0      1.0000000
## Sphaeropthalma                       0.75     1.0      0.8888889
## Steatoda                             0.50     0.0      0.2222222
## Tachinidae                           0.50     0.4      0.4444444
## Tachysphex                           0.50     0.0      0.2222222
## Temnothoraxandrei                    0.00     0.2      0.1111111
## Tetragonoderuspallidus               0.00     0.6      0.3333333
## Theridiidae                          0.50     0.8      0.6666667
## Thermobiadomestica                   1.00     0.6      0.7777778
## Titanebo                             0.25     0.2      0.2222222
## Tolliussetosus                       1.00     0.8      0.8888889
## Trimerotropispseudofasciata          0.50     0.0      0.2222222
## Triorophus                           0.75     0.6      0.6666667
## Typhaeastercorea                     1.00     0.6      0.7777778
## Urophorushumeralis                   1.00     0.6      0.7777778
## Xysticus                             0.50     0.6      0.5555556
## 
## $sign
##                                    s.absent s.present index      stat p.value
## Ageniellaaccepta                          1         1     3 0.5773503      NA
## Agenioideusbirkmanni                      0         1     2 0.9097177   0.045
## Alaephus                                  0         1     2 0.6324555   0.434
## Alaudes                                   0         1     2 0.6324555   0.455
## Alopecosakochi                            1         1     3 0.8819171      NA
## Amarainsignis                             0         1     2 0.7745967   0.171
## Anepsiusdeliculatus                       0         1     2 0.4472136   1.000
## Anthomyiidae                              1         1     3 0.8164966      NA
## Aphoebantus                               1         1     3 0.4714045      NA
## Apristus                                  1         0     1 0.5976143   0.524
## Arenigena                                 0         1     2 0.7745967   0.175
## Arenivaga                                 1         1     3 0.9428090      NA
## Athysanella                               0         1     2 0.6324555   0.455
## Auchmobius                                1         1     3 0.5773503      NA
## Bethylidae                                1         1     3 0.9428090      NA
## Blapstinus                                1         1     3 0.7453560      NA
## Brachycistidinae.large                    0         1     2 0.6761234   0.441
## Brachycistidinae.small                    1         1     3 0.7453560      NA
## Brevitrichia                              1         0     1 0.5000000   0.440
## Calilena.Hololena                         1         1     3 0.4714045      NA
## Callilepis                                1         1     3 1.0000000      NA
## Caponiidae                                1         0     1 0.5000000   0.467
## Carpophilushemipterus                     1         0     1 0.9560222   0.026
## Ceratagallia                              0         1     2 0.6324555   0.425
## Ceuthophilus                              1         1     3 0.7453560      NA
## Chyphotes                                 1         1     3 1.0000000      NA
## Cicadellidae.palemanyspots                0         1     2 0.4472136   1.000
## Conibiosomaelongatum                      1         0     1 0.8885233   0.088
## Conibiusseriatus                          1         0     1 0.5000000   0.442
## Culicidae                                 0         1     2 0.6324555   0.434
## Cydnidae                                  0         1     2 0.6324555   0.425
## Cyphomyrmexwheeleri                       1         0     1 0.7174301   0.318
## Dasymutillacalifornica                    1         1     3 0.7453560      NA
## Dasymutillacoccineohirta                  1         1     3 0.6666667      NA
## Dasymutillasackenii                       1         0     1 0.6282809   0.418
## Dasymutillasatanas.flammifera             0         1     2 0.4472136   1.000
## Dictynidae                                1         0     1 0.7071068   0.173
## Dolichopodidae                            1         1     3 0.7453560      NA
## Dorymyrmexbicolor                         1         1     3 0.9428090      NA
## Dorymyrmexinsanus                         0         1     2 0.6285778   0.455
## Drassyllus                                1         1     3 1.0000000      NA
## Drosophilamelanogasterspeciesgroup        1         1     3 0.9428090      NA
## Eleodes                                   1         0     1 0.6454972   0.422
## Eleodesarmata                             1         1     3 0.9428090      NA
## Eleodesdentipes                           0         1     2 0.6324555   0.434
## Eleodesgigantea                           1         1     3 0.4714045      NA
## Emblethisvicarius                         1         1     3 0.9428090      NA
## Entiminae                                 0         1     2 0.4472136   1.000
## Ephydridae                                1         1     3 0.5773503      NA
## Eremobatidae                              1         1     3 1.0000000      NA
## Eupnigodessierranus                       1         0     1 0.8411582   0.085
## Foreliuspruinosus                         1         0     1 0.6260127   0.412
## Geocorisatricolor                         1         0     1 0.5976143   0.508
## Geocorispallens                           1         1     3 0.8819171      NA
## Glyptinaatriventris                       0         1     2 0.6324555   0.455
## Gnaphosa                                  1         1     3 0.8164966      NA
## Gryllus                                   1         1     3 0.8164966      NA
## Haploembiasolieri                         0         1     2 0.4472136   1.000
## Hoplosphyrumboreale                       0         1     2 0.6324555   0.448
## Hymenorus                                 1         0     1 0.7071068   0.185
## Kibramoamadrona                           1         1     3 0.8164966      NA
## Kukulcania                                1         0     1 0.7071068   0.184
## Lasioglossum                              0         1     2 0.7745967   0.164
## Latrodectushesperus                       0         1     2 0.7912566   0.185
## Lepidocnemeplatiasericea                  1         0     1 0.7071068   0.159
## Litaneutriaminor                          1         1     3 0.8819171      NA
## Loxoscelesdeserta                         1         0     1 0.8299250   0.093
## Machilinusaurantiacus                     0         1     2 0.6761234   0.363
## Melyridae.redunicolor                     1         0     1 0.8660254   0.051
## Mesomachilis                              1         1     3 0.4714045      NA
## Messorandrei                              0         1     2 0.7745967   0.178
## Messorpergandei                           1         0     1 0.6819011   0.563
## Metoponium                                1         1     3 0.7453560      NA
## Micaria                                   1         1     3 0.6666667      NA
## Miridae                                   0         1     2 0.4472136   1.000
## Mirolepismadeserticola                    1         1     3 0.7453560      NA
## Miscophus                                 0         1     2 0.4472136   1.000
## Muscidae                                  1         0     1 0.9422582   0.025
## Myrmecocystuskennedyi                     0         1     2 0.8844027   0.078
## Myrmecophilusmanni.oregonensis            1         1     3 0.4714045      NA
## Mythicomyia                               1         1     3 0.5773503      NA
## Neoanagraphischamberlini                  1         1     3 0.8164966      NA
## Niptus                                    1         0     1 0.7500000   0.356
## Notibiuspuncticollis                      1         1     3 0.6666667      NA
## Nysiusraphanus                            1         0     1 0.7694838   0.202
## Odontophotopsis                           0         1     2 0.8361577   0.132
## Oedaleonotusenigma                        1         0     1 0.6741999   0.424
## Oligotomanigra                            1         0     1 0.8660254   0.053
## Oonopidae                                 1         0     1 0.5000000   0.467
## Opatroidespunctulatus                     1         0     1 0.7071068   0.184
## Orgerius                                  1         1     3 0.5773503      NA
## Osbornellus                               0         1     2 0.8944272   0.054
## Oxyopesscalaris                           1         1     3 0.4714045      NA
## Paravaejovis                              1         1     3 1.0000000      NA
## Parcoblatta                               0         1     2 0.7046643   0.349
## Pheidolehyatti                            1         1     3 1.0000000      NA
## Pherocera                                 0         1     2 0.4472136   1.000
## Phoridae                                  1         1     3 0.9428090      NA
## Phthiria                                  0         1     2 0.6324555   0.455
## Platygastridae.black                      1         1     3 0.7453560      NA
## Plectreurys                               0         1     2 0.4472136   1.000
## Pogonomyrmexhoelldobleri                  0         1     2 0.4472136   1.000
## Pompilus                                  0         1     2 0.5881717   0.586
## Pompilusphoenix                           1         1     3 0.8164966      NA
## Porcellionidespruinosis                   1         1     3 0.5773503      NA
## Pseudoscorpiones                          1         1     3 0.7453560      NA
## Psilochorus                               1         1     3 1.0000000      NA
## Rhagodera                                 0         1     2 0.4472136   1.000
## Salticidae                                1         1     3 1.0000000      NA
## Sarcophagidae                             1         1     3 0.9428090      NA
## Scelioninae                               1         0     1 0.5000000   0.473
## Scolopendrapolymorpha                     0         1     2 0.4472136   1.000
## Scopoides                                 1         1     3 0.7453560      NA
## Solenopsisxyloni                          1         1     3 1.0000000      NA
## Sphaeropthalma                            1         1     3 0.9428090      NA
## Steatoda                                  1         0     1 0.7071068   0.184
## Tachinidae                                1         1     3 0.6666667      NA
## Tachysphex                                1         0     1 0.7071068   0.159
## Temnothoraxandrei                         0         1     2 0.4472136   1.000
## Tetragonoderuspallidus                    0         1     2 0.7745967   0.175
## Theridiidae                               1         1     3 0.8164966      NA
## Thermobiadomestica                        1         0     1 0.9362970   0.075
## Titanebo                                  1         1     3 0.4714045      NA
## Tolliussetosus                            1         1     3 0.9428090      NA
## Trimerotropispseudofasciata               1         0     1 0.7071068   0.159
## Triorophus                                1         0     1 0.8210708   0.355
## Typhaeastercorea                          1         1     3 0.8819171      NA
## Urophorushumeralis                        1         0     1 0.9768308   0.011
## Xysticus                                  1         1     3 0.7453560      NA
## 
## attr(,"class")
## [1] "multipatt"
summary(indval)
## 
##  Multilevel pattern analysis
##  ---------------------------
## 
##  Association function: IndVal.g
##  Significance level (alpha): 0.05
## 
##  Total number of species: 129
##  Selected number of species: 4 
##  Number of species associated to 1 group: 4 
## 
##  List of species associated to each combination: 
## 
##  Group absent  #sps.  3 
##                        stat p.value  
## Urophorushumeralis    0.977   0.011 *
## Carpophilushemipterus 0.956   0.026 *
## Muscidae              0.942   0.025 *
## 
##  Group present  #sps.  1 
##                      stat p.value  
## Agenioideusbirkmanni 0.91   0.045 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sum <- as.data.frame(capture.output(summary(indval)))




#canopy.wide <- select(comm, -1, -2)
indval <- multipatt(commshrub, envshrub$bnll, control = how(nperm=999))
indval
## $call
## multipatt(x = commshrub, cluster = envshrub$bnll, control = how(nperm = 999))
## 
## $func
## [1] "IndVal.g"
## 
## $cluster
## [1] "absent"  "present" "present" "present" "present" "absent" 
## 
## $comb
##      absent present absent+present
## [1,]      1       0              1
## [2,]      0       1              1
## [3,]      0       1              1
## [4,]      0       1              1
## [5,]      0       1              1
## [6,]      1       0              1
## 
## $str
##                                       absent   present absent+present
## Aeoloplidescalifornicus            0.0000000 0.7071068      0.5773503
## Arhyssuscrassus.scutatus           0.0000000 0.5000000      0.4082483
## Arhyssuslateralis                  0.0000000 0.5000000      0.4082483
## Attalus                            0.0000000 0.7071068      0.5773503
## Braconidae.bigstigma               0.0000000 0.5000000      0.4082483
## Braconidae.brown                   0.0000000 0.5000000      0.4082483
## Braconidae.redandblack             0.5773503 0.2886751      0.5773503
## Brephidiumexilis                   0.8944272 0.2236068      0.7071068
## Carpophilushemipterus              0.5000000 0.5000000      0.7071068
## Ceratagallia                       0.0000000 0.7071068      0.5773503
## Chrysomelidae.brown                0.0000000 0.5000000      0.4082483
## Cibolacrisparviceps                0.7071068 0.0000000      0.4082483
## Cicadellidae.palemanyspots         0.5000000 0.3535534      0.5773503
## Cicadellidae.palePhlepsanus        0.9675589 0.1263228      0.7071068
## Dictynidae                         0.9128709 0.2041241      0.7071068
## Drosophilamelanogasterspeciesgroup 0.7071068 0.0000000      0.4082483
## Encyrtidae                         1.0000000 0.0000000      0.5773503
## Ephydridae                         0.5773503 0.2886751      0.5773503
## Eremochrysa                        0.2000000 0.4795832      0.5773503
## Foreliuspruinosus                  0.7071068 0.0000000      0.4082483
## Geocorispallens                    0.6741999 0.5222330      0.8164966
## Geron                              0.5000000 0.3535534      0.5773503
## Glyptinaatriventris                0.3535534 0.6123724      0.7071068
## Hyperaspidius                      1.0000000 0.0000000      0.5773503
## Hyperaspis.allblack                0.0000000 0.5000000      0.4082483
## Hyperaspis.whitefacenospots        0.5000000 0.5000000      0.7071068
## Irisoratoria                       0.7745967 0.5477226      0.9128709
## Latrodectushesperus                0.4472136 0.5477226      0.7071068
## Lepidoptera                        0.5773503 0.2886751      0.5773503
## Mantisreliogiosa                   0.7071068 0.0000000      0.4082483
## Mecaphesa                          0.8164966 0.4082483      0.8164966
## Melanopluscinereus                 0.0000000 0.5000000      0.4082483
## Melanoplusdevastator               0.0000000 0.5000000      0.4082483
## Melyridae.redunicolor              0.7071068 0.0000000      0.4082483
## Metatrichiabulbosa                 0.0000000 0.5000000      0.4082483
## Metepeira                          0.0000000 0.8660254      0.7071068
## Miridae                            1.0000000 0.0000000      0.5773503
## Mordellistena                      0.7071068 0.0000000      0.4082483
## Norvellina                         0.0000000 0.5000000      0.4082483
## Norvellinabicolorata               0.0000000 0.5000000      0.4082483
## Nysiusraphanus                     0.9258201 0.1889822      0.7071068
## Oecleus                            0.9185587 0.2795085      0.8164966
## Oedaleonotusenigma                 0.3779645 0.8451543      0.9128709
## Opsiusstactogalus                  0.8528029 0.2611165      0.7071068
## Orgerius                           0.1443376 0.8477912      0.8164966
## Osbornellus                        0.0000000 0.5000000      0.4082483
## Perdita                            0.0000000 0.7071068      0.5773503
## Pipunculidae                       0.7071068 0.0000000      0.4082483
## Pteromalidae                       0.0000000 0.5000000      0.4082483
## Salticidae                         0.7966275 0.6044705      1.0000000
## Scenopinus                         1.0000000 0.0000000      0.5773503
## Solenopsisxyloni                   0.6123724 0.2500000      0.5773503
## Stethoruspunctum                   0.7071068 0.0000000      0.4082483
## Systena                            0.5773503 0.2886751      0.5773503
## Tepa                               0.3779645 0.4225771      0.5773503
## Titanebo                           0.0000000 0.7071068      0.5773503
## Tolliussetosus                     0.4082483 0.7071068      0.8164966
## Trimerotropispseudofasciata        0.4472136 0.5477226      0.7071068
## Trupanea                           0.5773503 0.2886751      0.5773503
## Zelustetracanthus                  0.5345225 0.4629100      0.7071068
## 
## $A
##                                        absent    present absent+present
## Aeoloplidescalifornicus            0.00000000 1.00000000              1
## Arhyssuscrassus.scutatus           0.00000000 1.00000000              1
## Arhyssuslateralis                  0.00000000 1.00000000              1
## Attalus                            0.00000000 1.00000000              1
## Braconidae.bigstigma               0.00000000 1.00000000              1
## Braconidae.brown                   0.00000000 1.00000000              1
## Braconidae.redandblack             0.66666667 0.33333333              1
## Brephidiumexilis                   0.80000000 0.20000000              1
## Carpophilushemipterus              0.50000000 0.50000000              1
## Ceratagallia                       0.00000000 1.00000000              1
## Chrysomelidae.brown                0.00000000 1.00000000              1
## Cibolacrisparviceps                1.00000000 0.00000000              1
## Cicadellidae.palemanyspots         0.50000000 0.50000000              1
## Cicadellidae.palePhlepsanus        0.93617021 0.06382979              1
## Dictynidae                         0.83333333 0.16666667              1
## Drosophilamelanogasterspeciesgroup 1.00000000 0.00000000              1
## Encyrtidae                         1.00000000 0.00000000              1
## Ephydridae                         0.66666667 0.33333333              1
## Eremochrysa                        0.08000000 0.92000000              1
## Foreliuspruinosus                  1.00000000 0.00000000              1
## Geocorispallens                    0.45454545 0.54545455              1
## Geron                              0.50000000 0.50000000              1
## Glyptinaatriventris                0.25000000 0.75000000              1
## Hyperaspidius                      1.00000000 0.00000000              1
## Hyperaspis.allblack                0.00000000 1.00000000              1
## Hyperaspis.whitefacenospots        0.50000000 0.50000000              1
## Irisoratoria                       0.60000000 0.40000000              1
## Latrodectushesperus                0.40000000 0.60000000              1
## Lepidoptera                        0.66666667 0.33333333              1
## Mantisreliogiosa                   1.00000000 0.00000000              1
## Mecaphesa                          0.66666667 0.33333333              1
## Melanopluscinereus                 0.00000000 1.00000000              1
## Melanoplusdevastator               0.00000000 1.00000000              1
## Melyridae.redunicolor              1.00000000 0.00000000              1
## Metatrichiabulbosa                 0.00000000 1.00000000              1
## Metepeira                          0.00000000 1.00000000              1
## Miridae                            1.00000000 0.00000000              1
## Mordellistena                      1.00000000 0.00000000              1
## Norvellina                         0.00000000 1.00000000              1
## Norvellinabicolorata               0.00000000 1.00000000              1
## Nysiusraphanus                     0.85714286 0.14285714              1
## Oecleus                            0.84375000 0.15625000              1
## Oedaleonotusenigma                 0.28571429 0.71428571              1
## Opsiusstactogalus                  0.72727273 0.27272727              1
## Orgerius                           0.04166667 0.95833333              1
## Osbornellus                        0.00000000 1.00000000              1
## Perdita                            0.00000000 1.00000000              1
## Pipunculidae                       1.00000000 0.00000000              1
## Pteromalidae                       0.00000000 1.00000000              1
## Salticidae                         0.63461538 0.36538462              1
## Scenopinus                         1.00000000 0.00000000              1
## Solenopsisxyloni                   0.75000000 0.25000000              1
## Stethoruspunctum                   1.00000000 0.00000000              1
## Systena                            0.66666667 0.33333333              1
## Tepa                               0.28571429 0.71428571              1
## Titanebo                           0.00000000 1.00000000              1
## Tolliussetosus                     0.33333333 0.66666667              1
## Trimerotropispseudofasciata        0.40000000 0.60000000              1
## Trupanea                           0.66666667 0.33333333              1
## Zelustetracanthus                  0.57142857 0.42857143              1
## 
## $B
##                                    absent present absent+present
## Aeoloplidescalifornicus               0.0    0.50      0.3333333
## Arhyssuscrassus.scutatus              0.0    0.25      0.1666667
## Arhyssuslateralis                     0.0    0.25      0.1666667
## Attalus                               0.0    0.50      0.3333333
## Braconidae.bigstigma                  0.0    0.25      0.1666667
## Braconidae.brown                      0.0    0.25      0.1666667
## Braconidae.redandblack                0.5    0.25      0.3333333
## Brephidiumexilis                      1.0    0.25      0.5000000
## Carpophilushemipterus                 0.5    0.50      0.5000000
## Ceratagallia                          0.0    0.50      0.3333333
## Chrysomelidae.brown                   0.0    0.25      0.1666667
## Cibolacrisparviceps                   0.5    0.00      0.1666667
## Cicadellidae.palemanyspots            0.5    0.25      0.3333333
## Cicadellidae.palePhlepsanus           1.0    0.25      0.5000000
## Dictynidae                            1.0    0.25      0.5000000
## Drosophilamelanogasterspeciesgroup    0.5    0.00      0.1666667
## Encyrtidae                            1.0    0.00      0.3333333
## Ephydridae                            0.5    0.25      0.3333333
## Eremochrysa                           0.5    0.25      0.3333333
## Foreliuspruinosus                     0.5    0.00      0.1666667
## Geocorispallens                       1.0    0.50      0.6666667
## Geron                                 0.5    0.25      0.3333333
## Glyptinaatriventris                   0.5    0.50      0.5000000
## Hyperaspidius                         1.0    0.00      0.3333333
## Hyperaspis.allblack                   0.0    0.25      0.1666667
## Hyperaspis.whitefacenospots           0.5    0.50      0.5000000
## Irisoratoria                          1.0    0.75      0.8333333
## Latrodectushesperus                   0.5    0.50      0.5000000
## Lepidoptera                           0.5    0.25      0.3333333
## Mantisreliogiosa                      0.5    0.00      0.1666667
## Mecaphesa                             1.0    0.50      0.6666667
## Melanopluscinereus                    0.0    0.25      0.1666667
## Melanoplusdevastator                  0.0    0.25      0.1666667
## Melyridae.redunicolor                 0.5    0.00      0.1666667
## Metatrichiabulbosa                    0.0    0.25      0.1666667
## Metepeira                             0.0    0.75      0.5000000
## Miridae                               1.0    0.00      0.3333333
## Mordellistena                         0.5    0.00      0.1666667
## Norvellina                            0.0    0.25      0.1666667
## Norvellinabicolorata                  0.0    0.25      0.1666667
## Nysiusraphanus                        1.0    0.25      0.5000000
## Oecleus                               1.0    0.50      0.6666667
## Oedaleonotusenigma                    0.5    1.00      0.8333333
## Opsiusstactogalus                     1.0    0.25      0.5000000
## Orgerius                              0.5    0.75      0.6666667
## Osbornellus                           0.0    0.25      0.1666667
## Perdita                               0.0    0.50      0.3333333
## Pipunculidae                          0.5    0.00      0.1666667
## Pteromalidae                          0.0    0.25      0.1666667
## Salticidae                            1.0    1.00      1.0000000
## Scenopinus                            1.0    0.00      0.3333333
## Solenopsisxyloni                      0.5    0.25      0.3333333
## Stethoruspunctum                      0.5    0.00      0.1666667
## Systena                               0.5    0.25      0.3333333
## Tepa                                  0.5    0.25      0.3333333
## Titanebo                              0.0    0.50      0.3333333
## Tolliussetosus                        0.5    0.75      0.6666667
## Trimerotropispseudofasciata           0.5    0.50      0.5000000
## Trupanea                              0.5    0.25      0.3333333
## Zelustetracanthus                     0.5    0.50      0.5000000
## 
## $sign
##                                    s.absent s.present index      stat p.value
## Aeoloplidescalifornicus                   0         1     2 0.7071068   0.471
## Arhyssuscrassus.scutatus                  0         1     2 0.5000000   1.000
## Arhyssuslateralis                         0         1     2 0.5000000   1.000
## Attalus                                   0         1     2 0.7071068   0.469
## Braconidae.bigstigma                      0         1     2 0.5000000   1.000
## Braconidae.brown                          0         1     2 0.5000000   1.000
## Braconidae.redandblack                    1         0     1 0.5773503   1.000
## Brephidiumexilis                          1         0     1 0.8944272   0.186
## Carpophilushemipterus                     1         1     3 0.7071068      NA
## Ceratagallia                              0         1     2 0.7071068   0.469
## Chrysomelidae.brown                       0         1     2 0.5000000   1.000
## Cibolacrisparviceps                       1         0     1 0.7071068   0.334
## Cicadellidae.palemanyspots                1         1     3 0.5773503      NA
## Cicadellidae.palePhlepsanus               1         0     1 0.9675589   0.064
## Dictynidae                                1         0     1 0.9128709   0.124
## Drosophilamelanogasterspeciesgroup        1         0     1 0.7071068   0.334
## Encyrtidae                                1         0     1 1.0000000   0.064
## Ephydridae                                1         0     1 0.5773503   1.000
## Eremochrysa                               1         1     3 0.5773503      NA
## Foreliuspruinosus                         1         0     1 0.7071068   0.334
## Geocorispallens                           1         1     3 0.8164966      NA
## Geron                                     1         1     3 0.5773503      NA
## Glyptinaatriventris                       1         1     3 0.7071068      NA
## Hyperaspidius                             1         0     1 1.0000000   0.064
## Hyperaspis.allblack                       0         1     2 0.5000000   1.000
## Hyperaspis.whitefacenospots               1         1     3 0.7071068      NA
## Irisoratoria                              1         1     3 0.9128709      NA
## Latrodectushesperus                       1         1     3 0.7071068      NA
## Lepidoptera                               1         0     1 0.5773503   1.000
## Mantisreliogiosa                          1         0     1 0.7071068   0.334
## Mecaphesa                                 1         0     1 0.8164966   1.000
## Melanopluscinereus                        0         1     2 0.5000000   1.000
## Melanoplusdevastator                      0         1     2 0.5000000   1.000
## Melyridae.redunicolor                     1         0     1 0.7071068   0.334
## Metatrichiabulbosa                        0         1     2 0.5000000   1.000
## Metepeira                                 0         1     2 0.8660254   0.324
## Miridae                                   1         0     1 1.0000000   0.064
## Mordellistena                             1         0     1 0.7071068   0.334
## Norvellina                                0         1     2 0.5000000   1.000
## Norvellinabicolorata                      0         1     2 0.5000000   1.000
## Nysiusraphanus                            1         0     1 0.9258201   0.126
## Oecleus                                   1         0     1 0.9185587   0.186
## Oedaleonotusenigma                        1         1     3 0.9128709      NA
## Opsiusstactogalus                         1         0     1 0.8528029   0.402
## Orgerius                                  0         1     2 0.8477912   0.386
## Osbornellus                               0         1     2 0.5000000   1.000
## Perdita                                   0         1     2 0.7071068   0.469
## Pipunculidae                              1         0     1 0.7071068   0.334
## Pteromalidae                              0         1     2 0.5000000   1.000
## Salticidae                                1         1     3 1.0000000      NA
## Scenopinus                                1         0     1 1.0000000   0.064
## Solenopsisxyloni                          1         0     1 0.6123724   0.739
## Stethoruspunctum                          1         0     1 0.7071068   0.334
## Systena                                   1         0     1 0.5773503   1.000
## Tepa                                      1         1     3 0.5773503      NA
## Titanebo                                  0         1     2 0.7071068   0.469
## Tolliussetosus                            1         1     3 0.8164966      NA
## Trimerotropispseudofasciata               1         1     3 0.7071068      NA
## Trupanea                                  1         1     3 0.5773503      NA
## Zelustetracanthus                         1         1     3 0.7071068      NA
## 
## attr(,"class")
## [1] "multipatt"
summary(indval)
## 
##  Multilevel pattern analysis
##  ---------------------------
## 
##  Association function: IndVal.g
##  Significance level (alpha): 0.05
## 
##  Total number of species: 60
##  Selected number of species: 0 
##  Number of species associated to 1 group: 0 
## 
##  List of species associated to each combination: 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#open.wide <- select(open.wide, -1, -2)
indval <- multipatt(commopen, envopen$bnll, control = how(nperm=999))
indval
## $call
## multipatt(x = commopen, cluster = envopen$bnll, control = how(nperm = 999))
## 
## $func
## [1] "IndVal.g"
## 
## $cluster
## [1] "absent"  "present" "present" "absent"  "present" "absent"  "present"
## [8] "present" "absent" 
## 
## $comb
##       absent present absent+present
##  [1,]      1       0              1
##  [2,]      0       1              1
##  [3,]      0       1              1
##  [4,]      1       0              1
##  [5,]      0       1              1
##  [6,]      1       0              1
##  [7,]      0       1              1
##  [8,]      0       1              1
##  [9,]      1       0              1
## 
## $str
##                                 absent   present absent+present
## Aeoloplidescalifornicus     0.29361011 0.4068381      0.5773503
## Anthomyiidae                0.31008684 0.3508232      0.4714045
## Anthonomus                  0.00000000 0.6324555      0.4714045
## Aphoebantus                 0.00000000 0.8944272      0.6666667
## Arhyssuscrassus.scutatus    0.00000000 0.4472136      0.3333333
## Arhyssuslateralis           0.09284767 0.7611244      0.6666667
## Attalus                     0.50000000 0.0000000      0.3333333
## Carpophilushemipterus       0.50000000 0.0000000      0.3333333
## Conozoarebellis             0.00000000 0.4472136      0.3333333
## Dictynidae                  0.00000000 0.4472136      0.3333333
## Efferia                     0.00000000 0.7745967      0.5773503
## Eleodesarmata               0.31008684 0.3508232      0.4714045
## Enallagmacivile             0.42257713 0.2390457      0.4714045
## Eupnigodessierranus         0.75250585 0.5890568      0.9428090
## Geocorispallens             0.76696499 0.4058397      0.8164966
## Glyptinaatriventris         0.00000000 0.6324555      0.4714045
## Hesperotettixviridis        0.37267800 0.2981424      0.4714045
## Hyperaspis.allblack         0.00000000 0.4472136      0.3333333
## Irisoratoria                0.62828086 0.2051957      0.5773503
## Lasioglossum                0.51107145 0.5353197      0.7453560
## Latrodectushesperus         0.14808722 0.8542977      0.7453560
## Lepidoptera                 0.37267800 0.2981424      0.4714045
## Litaneutriaminor            0.24397502 0.5520524      0.5773503
## Mecaphesa                   0.00000000 0.6324555      0.4714045
## Melanopluscinereus          0.50000000 0.0000000      0.3333333
## Melanoplusdevastator        0.37267800 0.2981424      0.4714045
## Melyridae.redunicolor       0.83957562 0.1551133      0.7453560
## Melyridae2.dark             0.00000000 0.4472136      0.3333333
## Miridae                     0.50000000 0.0000000      0.3333333
## Mythicomyia                 0.00000000 0.4472136      0.3333333
## Oecleus                     0.70710678 0.0000000      0.4714045
## Oedaleonotusenigma          0.80069812 0.2951373      0.8164966
## Orgerius                    0.00000000 0.7745967      0.5773503
## Oxyopesscalaris             0.59761430 0.3380617      0.6666667
## Pipunculidae                0.00000000 0.6324555      0.4714045
## Pteromalidae                0.50000000 0.0000000      0.3333333
## Salticidae                  0.49346377 0.7350236      0.8819171
## Scenopinus                  0.22360680 0.5656854      0.5773503
## Tingidae                    0.70710678 0.0000000      0.4714045
## Titanebo                    0.00000000 0.6324555      0.4714045
## Tollius                     0.70710678 0.0000000      0.4714045
## Tolliussetosus              0.44764012 0.7656759      0.8819171
## Trimerotropispseudofasciata 0.41152745 0.7869910      0.8819171
## Xerophloeapeltata           0.00000000 0.6324555      0.4714045
## 
## $A
##                                 absent    present absent+present
## Aeoloplidescalifornicus     0.17241379 0.82758621              1
## Anthomyiidae                0.38461538 0.61538462              1
## Anthonomus                  0.00000000 1.00000000              1
## Aphoebantus                 0.00000000 1.00000000              1
## Arhyssuscrassus.scutatus    0.00000000 1.00000000              1
## Arhyssuslateralis           0.03448276 0.96551724              1
## Attalus                     1.00000000 0.00000000              1
## Carpophilushemipterus       1.00000000 0.00000000              1
## Conozoarebellis             0.00000000 1.00000000              1
## Dictynidae                  0.00000000 1.00000000              1
## Efferia                     0.00000000 1.00000000              1
## Eleodesarmata               0.38461538 0.61538462              1
## Enallagmacivile             0.71428571 0.28571429              1
## Eupnigodessierranus         0.56626506 0.43373494              1
## Geocorispallens             0.58823529 0.41176471              1
## Glyptinaatriventris         0.00000000 1.00000000              1
## Hesperotettixviridis        0.55555556 0.44444444              1
## Hyperaspis.allblack         0.00000000 1.00000000              1
## Irisoratoria                0.78947368 0.21052632              1
## Lasioglossum                0.52238806 0.47761194              1
## Latrodectushesperus         0.08771930 0.91228070              1
## Lepidoptera                 0.55555556 0.44444444              1
## Litaneutriaminor            0.23809524 0.76190476              1
## Mecaphesa                   0.00000000 1.00000000              1
## Melanopluscinereus          1.00000000 0.00000000              1
## Melanoplusdevastator        0.55555556 0.44444444              1
## Melyridae.redunicolor       0.93984962 0.06015038              1
## Melyridae2.dark             0.00000000 1.00000000              1
## Miridae                     1.00000000 0.00000000              1
## Mythicomyia                 0.00000000 1.00000000              1
## Oecleus                     1.00000000 0.00000000              1
## Oedaleonotusenigma          0.85482330 0.14517670              1
## Orgerius                    0.00000000 1.00000000              1
## Oxyopesscalaris             0.71428571 0.28571429              1
## Pipunculidae                0.00000000 1.00000000              1
## Pteromalidae                1.00000000 0.00000000              1
## Salticidae                  0.32467532 0.67532468              1
## Scenopinus                  0.20000000 0.80000000              1
## Tingidae                    1.00000000 0.00000000              1
## Titanebo                    0.00000000 1.00000000              1
## Tollius                     1.00000000 0.00000000              1
## Tolliussetosus              0.26717557 0.73282443              1
## Trimerotropispseudofasciata 0.22580645 0.77419355              1
## Xerophloeapeltata           0.00000000 1.00000000              1
## 
## $B
##                             absent present absent+present
## Aeoloplidescalifornicus       0.50     0.2      0.3333333
## Anthomyiidae                  0.25     0.2      0.2222222
## Anthonomus                    0.00     0.4      0.2222222
## Aphoebantus                   0.00     0.8      0.4444444
## Arhyssuscrassus.scutatus      0.00     0.2      0.1111111
## Arhyssuslateralis             0.25     0.6      0.4444444
## Attalus                       0.25     0.0      0.1111111
## Carpophilushemipterus         0.25     0.0      0.1111111
## Conozoarebellis               0.00     0.2      0.1111111
## Dictynidae                    0.00     0.2      0.1111111
## Efferia                       0.00     0.6      0.3333333
## Eleodesarmata                 0.25     0.2      0.2222222
## Enallagmacivile               0.25     0.2      0.2222222
## Eupnigodessierranus           1.00     0.8      0.8888889
## Geocorispallens               1.00     0.4      0.6666667
## Glyptinaatriventris           0.00     0.4      0.2222222
## Hesperotettixviridis          0.25     0.2      0.2222222
## Hyperaspis.allblack           0.00     0.2      0.1111111
## Irisoratoria                  0.50     0.2      0.3333333
## Lasioglossum                  0.50     0.6      0.5555556
## Latrodectushesperus           0.25     0.8      0.5555556
## Lepidoptera                   0.25     0.2      0.2222222
## Litaneutriaminor              0.25     0.4      0.3333333
## Mecaphesa                     0.00     0.4      0.2222222
## Melanopluscinereus            0.25     0.0      0.1111111
## Melanoplusdevastator          0.25     0.2      0.2222222
## Melyridae.redunicolor         0.75     0.4      0.5555556
## Melyridae2.dark               0.00     0.2      0.1111111
## Miridae                       0.25     0.0      0.1111111
## Mythicomyia                   0.00     0.2      0.1111111
## Oecleus                       0.50     0.0      0.2222222
## Oedaleonotusenigma            0.75     0.6      0.6666667
## Orgerius                      0.00     0.6      0.3333333
## Oxyopesscalaris               0.50     0.4      0.4444444
## Pipunculidae                  0.00     0.4      0.2222222
## Pteromalidae                  0.25     0.0      0.1111111
## Salticidae                    0.75     0.8      0.7777778
## Scenopinus                    0.25     0.4      0.3333333
## Tingidae                      0.50     0.0      0.2222222
## Titanebo                      0.00     0.4      0.2222222
## Tollius                       0.50     0.0      0.2222222
## Tolliussetosus                0.75     0.8      0.7777778
## Trimerotropispseudofasciata   0.75     0.8      0.7777778
## Xerophloeapeltata             0.00     0.4      0.2222222
## 
## $sign
##                             s.absent s.present index      stat p.value
## Aeoloplidescalifornicus            1         1     3 0.5773503      NA
## Anthomyiidae                       1         1     3 0.4714045      NA
## Anthonomus                         0         1     2 0.6324555   0.446
## Aphoebantus                        0         1     2 0.8944272   0.044
## Arhyssuscrassus.scutatus           0         1     2 0.4472136   1.000
## Arhyssuslateralis                  0         1     2 0.7611244   0.247
## Attalus                            1         0     1 0.5000000   0.469
## Carpophilushemipterus              1         0     1 0.5000000   0.428
## Conozoarebellis                    0         1     2 0.4472136   1.000
## Dictynidae                         0         1     2 0.4472136   1.000
## Efferia                            0         1     2 0.7745967   0.163
## Eleodesarmata                      1         1     3 0.4714045      NA
## Enallagmacivile                    1         1     3 0.4714045      NA
## Eupnigodessierranus                1         1     3 0.9428090      NA
## Geocorispallens                    1         1     3 0.8164966      NA
## Glyptinaatriventris                0         1     2 0.6324555   0.455
## Hesperotettixviridis               1         1     3 0.4714045      NA
## Hyperaspis.allblack                0         1     2 0.4472136   1.000
## Irisoratoria                       1         0     1 0.6282809   0.409
## Lasioglossum                       1         1     3 0.7453560      NA
## Latrodectushesperus                0         1     2 0.8542977   0.096
## Lepidoptera                        1         1     3 0.4714045      NA
## Litaneutriaminor                   1         1     3 0.5773503      NA
## Mecaphesa                          0         1     2 0.6324555   0.446
## Melanopluscinereus                 1         0     1 0.5000000   0.428
## Melanoplusdevastator               1         1     3 0.4714045      NA
## Melyridae.redunicolor              1         0     1 0.8395756   0.274
## Melyridae2.dark                    0         1     2 0.4472136   1.000
## Miridae                            1         0     1 0.5000000   0.428
## Mythicomyia                        0         1     2 0.4472136   1.000
## Oecleus                            1         0     1 0.7071068   0.159
## Oedaleonotusenigma                 1         1     3 0.8164966      NA
## Orgerius                           0         1     2 0.7745967   0.166
## Oxyopesscalaris                    1         1     3 0.6666667      NA
## Pipunculidae                       0         1     2 0.6324555   0.428
## Pteromalidae                       1         0     1 0.5000000   0.428
## Salticidae                         1         1     3 0.8819171      NA
## Scenopinus                         1         1     3 0.5773503      NA
## Tingidae                           1         0     1 0.7071068   0.154
## Titanebo                           0         1     2 0.6324555   0.428
## Tollius                            1         0     1 0.7071068   0.159
## Tolliussetosus                     1         1     3 0.8819171      NA
## Trimerotropispseudofasciata        1         1     3 0.8819171      NA
## Xerophloeapeltata                  0         1     2 0.6324555   0.446
## 
## attr(,"class")
## [1] "multipatt"
summary(indval)
## 
##  Multilevel pattern analysis
##  ---------------------------
## 
##  Association function: IndVal.g
##  Significance level (alpha): 0.05
## 
##  Total number of species: 44
##  Selected number of species: 1 
##  Number of species associated to 1 group: 1 
## 
##  List of species associated to each combination: 
## 
##  Group present  #sps.  1 
##              stat p.value  
## Aphoebantus 0.894   0.044 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
indval <- multipatt(commmal, env$bnll, control = how(nperm=999))
indval
## $call
## multipatt(x = commmal, cluster = env$bnll, control = how(nperm = 999))
## 
## $func
## [1] "IndVal.g"
## 
## $cluster
## [1] "absent"  "present" "present" "absent"  "present" "absent"  "present"
## [8] "present" "absent" 
## 
## $comb
##       absent present absent+present
##  [1,]      1       0              1
##  [2,]      0       1              1
##  [3,]      0       1              1
##  [4,]      1       0              1
##  [5,]      0       1              1
##  [6,]      1       0              1
##  [7,]      0       1              1
##  [8,]      0       1              1
##  [9,]      1       0              1
## 
## $str
##                                       absent    present absent+present
## X                                  0.7071068 0.70710678      1.0000000
## Aeoloplidescalifornicus            0.1431496 0.42849336      0.4714045
## Agenioideusbirkmanni               0.4964664 0.63689387      0.8164966
## Agromyzidae                        0.6565322 0.16609096      0.5773503
## Anagyrus                           0.5710402 0.37300192      0.6666667
## Anomalon                           0.0000000 0.44721360      0.3333333
## Anthocoridae                       0.3726780 0.29814240      0.4714045
## Anthomyiidae                       0.5857792 0.50097943      0.8164966
## Aphididae                          0.8075729 0.45683219      0.8819171
## Aphoebantus                        0.2076137 0.70466426      0.6666667
## Apollophanes                       0.0000000 0.63245553      0.4714045
## Apolysis                           0.0000000 0.63245553      0.4714045
## Arenigena                          0.0000000 0.63245553      0.4714045
## Arogaparaplutella                  0.0000000 0.63245553      0.4714045
## Ashmeadiella                       0.0000000 0.63245553      0.4714045
## Attalus                            0.0000000 0.44721360      0.3333333
## Bethylidae                         0.7140507 0.70009398      1.0000000
## Brachycistidinae.large             0.2672612 0.53452248      0.5773503
## Brachycistidinae.medium            0.0000000 0.63245553      0.4714045
## Brachycistidinae.small             0.7917278 0.31390082      0.8164966
## Calilena.Hololena                  0.3726780 0.29814240      0.4714045
## Carpophilushemipterus              0.5000000 0.00000000      0.3333333
## Catharosia                         0.0000000 0.44721360      0.3333333
## Cecidomyiidae                      0.5521576 0.48388670      0.7453560
## Ceraphronidae                      0.6282809 0.20519567      0.5773503
## Ceratagglia                        0.0000000 0.44721360      0.3333333
## Chalcididae                        0.6892845 0.45820820      0.8164966
## Chamaemyiidae                      0.1345955 0.74600385      0.6666667
## Chironomidae                       0.4171938 0.87631757      0.9428090
## Chloropidae                        0.2711631 0.53136893      0.5773503
## Chyphotes                          0.6282809 0.20519567      0.5773503
## Cicadellidae.palemanyspots         0.8040844 0.16609096      0.6666667
## Cicadellidae.palePhlepsanus        0.5212860 0.35712215      0.6666667
## Circulifertenellus                 0.5710402 0.37300192      0.6666667
## Coniopterygidae                    0.8801408 0.47471266      1.0000000
## Culicidae                          0.1838037 0.41590020      0.4714045
## Dermestidae                        0.7071068 0.00000000      0.4714045
## Dictynidae                         0.3771955 0.53495688      0.6666667
## Dolichopodidae                     0.6201737 0.30382181      0.6666667
## Dorymyrmexbicolor                  0.5000000 0.00000000      0.3333333
## Drosophilamelanogasterspeciesgroup 0.7453560 0.66666667      1.0000000
## Encrytidae                         0.0000000 0.63245553      0.4714045
## Ephydridae                         0.5976143 0.23904572      0.5773503
## Eremochrysa                        0.0000000 0.63245553      0.4714045
## Eulophidae                         0.3726780 0.29814240      0.4714045
## Eupelmidae                         0.0000000 0.63245553      0.4714045
## Eupnigodessierranus                0.5000000 0.00000000      0.3333333
## Foreliuspruinosis                  0.4736655 0.14322297      0.4714045
## Geocorispallens                    0.4892461 0.63914837      0.8164966
## Geron                              0.3726780 0.29814240      0.4714045
## Glyptinaatriventris                0.3168621 0.84833880      0.9428090
## Heleomyzidae                       0.0000000 0.63245553      0.4714045
## Hemerobiidae                       0.0000000 0.63245553      0.4714045
## Hymenorus                          0.3100868 0.35082321      0.4714045
## Hyperaspidius                      0.7071068 0.00000000      0.4714045
## Ichneumoidae                       0.3726780 0.29814240      0.4714045
## Lepidoptera                        0.7494290 0.66208471      1.0000000
## Limoniidae                         0.7537784 0.31139958      0.7453560
## Litaneutriaminor                   0.0000000 0.63245553      0.4714045
## Mecaphesa                          0.6282809 0.20519567      0.5773503
## Melyridae.redunicolor              0.7071068 0.00000000      0.4714045
## Metoponium                         0.8438159 0.10063092      0.6666667
## Micaria                            0.0000000 0.44721360      0.3333333
## Miridae                            0.7644708 0.49935023      0.8819171
## Mordellistena                      0.7071068 0.00000000      0.4714045
## Muscidae                           0.6900656 0.09759001      0.5773503
## Myrmaridae                         0.2236068 0.80000000      0.7453560
## Myrmecocystuskennedyi              0.3535534 0.54772256      0.6666667
## Mythicomyia                        0.6024145 0.55648667      0.8164966
## Norvellina                         0.0000000 0.63245553      0.4714045
## Norvellinabicolorata               0.0000000 0.44721360      0.3333333
## Nysiusraphanus                     0.3726780 0.42163702      0.5773503
## Odontophotopsis                    0.0000000 0.77459667      0.5773503
## Oecleus                            0.6454972 0.51639778      0.8164966
## Oedaleonotusenigma                 0.8660254 0.00000000      0.5773503
## Oligotomanigra                     0.7071068 0.00000000      0.4714045
## Opsiusstactogalus                  0.6940111 0.08567059      0.5773503
## Orgerius                           0.0000000 0.63245553      0.4714045
## Osbornellus                        0.0000000 0.63245553      0.4714045
## Pheidolehyatti                     0.5000000 0.00000000      0.3333333
## Pherocera                          0.7071068 0.00000000      0.4714045
## Phoridae                           0.5423261 0.84016805      1.0000000
## Pipunculidae                       0.6655174 0.57232775      0.8819171
## Platygastridae.black               0.6169464 0.78700519      1.0000000
## Platygastridae.brown               0.0000000 0.63245553      0.4714045
## Pompilusphoenix                    0.9393364 0.21693046      0.8164966
## Psychodidae                        0.0000000 0.63245553      0.4714045
## Pteromalidae                       0.0000000 0.77459667      0.5773503
## Pthiria                            0.7071068 0.00000000      0.4714045
## Sarcophagidae                      0.8660254 0.00000000      0.5773503
## Scelioninae                        0.7071068 0.00000000      0.4714045
## Scenopinus                         0.0000000 0.63245553      0.4714045
## Sciaridae                          0.5857792 0.35424595      0.6666667
## Scotoleonlongipalpis               0.4225771 0.23904572      0.4714045
## Solenopsisxyloni                   0.6282809 0.29019050      0.6666667
## Sphaerothalma                      0.0000000 0.63245553      0.4714045
## Tachinidae                         0.5330018 0.84611411      1.0000000
## Tachysphex                         0.7071068 0.00000000      0.4714045
## Thereva                            0.0000000 0.44721360      0.3333333
## Theridiidae                        0.0000000 0.44721360      0.3333333
## Tingidae                           0.0000000 0.63245553      0.4714045
## Titanebo                           0.0000000 0.44721360      0.3333333
## Tolliussetosus                     0.7071068 0.00000000      0.4714045
## Toxomerusmarginatus                0.3162278 0.56568542      0.6666667
## Trimerotropispseudofasciata        0.4225771 0.23904572      0.4714045
## 
## $A
##                                        absent    present absent+present
## X                                  0.50000000 0.50000000              1
## Aeoloplidescalifornicus            0.08196721 0.91803279              1
## Agenioideusbirkmanni               0.49295775 0.50704225              1
## Agromyzidae                        0.86206897 0.13793103              1
## Anagyrus                           0.65217391 0.34782609              1
## Anomalon                           0.00000000 1.00000000              1
## Anthocoridae                       0.55555556 0.44444444              1
## Anthomyiidae                       0.68627451 0.31372549              1
## Aphididae                          0.65217391 0.34782609              1
## Aphoebantus                        0.17241379 0.82758621              1
## Apollophanes                       0.00000000 1.00000000              1
## Apolysis                           0.00000000 1.00000000              1
## Arenigena                          0.00000000 1.00000000              1
## Arogaparaplutella                  0.00000000 1.00000000              1
## Ashmeadiella                       0.00000000 1.00000000              1
## Attalus                            0.00000000 1.00000000              1
## Bethylidae                         0.50986842 0.49013158              1
## Brachycistidinae.large             0.28571429 0.71428571              1
## Brachycistidinae.medium            0.00000000 1.00000000              1
## Brachycistidinae.small             0.83577713 0.16422287              1
## Calilena.Hololena                  0.55555556 0.44444444              1
## Carpophilushemipterus              1.00000000 0.00000000              1
## Catharosia                         0.00000000 1.00000000              1
## Cecidomyiidae                      0.60975610 0.39024390              1
## Ceraphronidae                      0.78947368 0.21052632              1
## Ceratagglia                        0.00000000 1.00000000              1
## Chalcididae                        0.47511312 0.52488688              1
## Chamaemyiidae                      0.07246377 0.92753623              1
## Chironomidae                       0.23206751 0.76793249              1
## Chloropidae                        0.29411765 0.70588235              1
## Chyphotes                          0.78947368 0.21052632              1
## Cicadellidae.palemanyspots         0.86206897 0.13793103              1
## Cicadellidae.palePhlepsanus        0.36231884 0.63768116              1
## Circulifertenellus                 0.65217391 0.34782609              1
## Coniopterygidae                    0.77464789 0.22535211              1
## Culicidae                          0.13513514 0.86486486              1
## Dermestidae                        1.00000000 0.00000000              1
## Dictynidae                         0.28455285 0.71544715              1
## Dolichopodidae                     0.76923077 0.23076923              1
## Dorymyrmexbicolor                  1.00000000 0.00000000              1
## Drosophilamelanogasterspeciesgroup 0.55555556 0.44444444              1
## Encrytidae                         0.00000000 1.00000000              1
## Ephydridae                         0.71428571 0.28571429              1
## Eremochrysa                        0.00000000 1.00000000              1
## Eulophidae                         0.55555556 0.44444444              1
## Eupelmidae                         0.00000000 1.00000000              1
## Eupnigodessierranus                1.00000000 0.00000000              1
## Foreliuspruinosis                  0.89743590 0.10256410              1
## Geocorispallens                    0.31914894 0.68085106              1
## Geron                              0.55555556 0.44444444              1
## Glyptinaatriventris                0.10040161 0.89959839              1
## Heleomyzidae                       0.00000000 1.00000000              1
## Hemerobiidae                       0.00000000 1.00000000              1
## Hymenorus                          0.38461538 0.61538462              1
## Hyperaspidius                      1.00000000 0.00000000              1
## Ichneumoidae                       0.55555556 0.44444444              1
## Lepidoptera                        0.56164384 0.43835616              1
## Limoniidae                         0.75757576 0.24242424              1
## Litaneutriaminor                   0.00000000 1.00000000              1
## Mecaphesa                          0.78947368 0.21052632              1
## Melyridae.redunicolor              1.00000000 0.00000000              1
## Metoponium                         0.94936709 0.05063291              1
## Micaria                            0.00000000 1.00000000              1
## Miridae                            0.58441558 0.41558442              1
## Mordellistena                      1.00000000 0.00000000              1
## Muscidae                           0.95238095 0.04761905              1
## Myrmaridae                         0.20000000 0.80000000              1
## Myrmecocystuskennedyi              0.50000000 0.50000000              1
## Mythicomyia                        0.48387097 0.51612903              1
## Norvellina                         0.00000000 1.00000000              1
## Norvellinabicolorata               0.00000000 1.00000000              1
## Nysiusraphanus                     0.55555556 0.44444444              1
## Odontophotopsis                    0.00000000 1.00000000              1
## Oecleus                            0.55555556 0.44444444              1
## Oedaleonotusenigma                 1.00000000 0.00000000              1
## Oligotomanigra                     1.00000000 0.00000000              1
## Opsiusstactogalus                  0.96330275 0.03669725              1
## Orgerius                           0.00000000 1.00000000              1
## Osbornellus                        0.00000000 1.00000000              1
## Pheidolehyatti                     1.00000000 0.00000000              1
## Pherocera                          1.00000000 0.00000000              1
## Phoridae                           0.29411765 0.70588235              1
## Pipunculidae                       0.59055118 0.40944882              1
## Platygastridae.black               0.38062284 0.61937716              1
## Platygastridae.brown               0.00000000 1.00000000              1
## Pompilusphoenix                    0.88235294 0.11764706              1
## Psychodidae                        0.00000000 1.00000000              1
## Pteromalidae                       0.00000000 1.00000000              1
## Pthiria                            1.00000000 0.00000000              1
## Sarcophagidae                      1.00000000 0.00000000              1
## Scelioninae                        1.00000000 0.00000000              1
## Scenopinus                         0.00000000 1.00000000              1
## Sciaridae                          0.68627451 0.31372549              1
## Scotoleonlongipalpis               0.71428571 0.28571429              1
## Solenopsisxyloni                   0.78947368 0.21052632              1
## Sphaerothalma                      0.00000000 1.00000000              1
## Tachinidae                         0.28409091 0.71590909              1
## Tachysphex                         1.00000000 0.00000000              1
## Thereva                            0.00000000 1.00000000              1
## Theridiidae                        0.00000000 1.00000000              1
## Tingidae                           0.00000000 1.00000000              1
## Titanebo                           0.00000000 1.00000000              1
## Tolliussetosus                     1.00000000 0.00000000              1
## Toxomerusmarginatus                0.20000000 0.80000000              1
## Trimerotropispseudofasciata        0.71428571 0.28571429              1
## 
## $B
##                                    absent present absent+present
## X                                    1.00     1.0      1.0000000
## Aeoloplidescalifornicus              0.25     0.2      0.2222222
## Agenioideusbirkmanni                 0.50     0.8      0.6666667
## Agromyzidae                          0.50     0.2      0.3333333
## Anagyrus                             0.50     0.4      0.4444444
## Anomalon                             0.00     0.2      0.1111111
## Anthocoridae                         0.25     0.2      0.2222222
## Anthomyiidae                         0.50     0.8      0.6666667
## Aphididae                            1.00     0.6      0.7777778
## Aphoebantus                          0.25     0.6      0.4444444
## Apollophanes                         0.00     0.4      0.2222222
## Apolysis                             0.00     0.4      0.2222222
## Arenigena                            0.00     0.4      0.2222222
## Arogaparaplutella                    0.00     0.4      0.2222222
## Ashmeadiella                         0.00     0.4      0.2222222
## Attalus                              0.00     0.2      0.1111111
## Bethylidae                           1.00     1.0      1.0000000
## Brachycistidinae.large               0.25     0.4      0.3333333
## Brachycistidinae.medium              0.00     0.4      0.2222222
## Brachycistidinae.small               0.75     0.6      0.6666667
## Calilena.Hololena                    0.25     0.2      0.2222222
## Carpophilushemipterus                0.25     0.0      0.1111111
## Catharosia                           0.00     0.2      0.1111111
## Cecidomyiidae                        0.50     0.6      0.5555556
## Ceraphronidae                        0.50     0.2      0.3333333
## Ceratagglia                          0.00     0.2      0.1111111
## Chalcididae                          1.00     0.4      0.6666667
## Chamaemyiidae                        0.25     0.6      0.4444444
## Chironomidae                         0.75     1.0      0.8888889
## Chloropidae                          0.25     0.4      0.3333333
## Chyphotes                            0.50     0.2      0.3333333
## Cicadellidae.palemanyspots           0.75     0.2      0.4444444
## Cicadellidae.palePhlepsanus          0.75     0.2      0.4444444
## Circulifertenellus                   0.50     0.4      0.4444444
## Coniopterygidae                      1.00     1.0      1.0000000
## Culicidae                            0.25     0.2      0.2222222
## Dermestidae                          0.50     0.0      0.2222222
## Dictynidae                           0.50     0.4      0.4444444
## Dolichopodidae                       0.50     0.4      0.4444444
## Dorymyrmexbicolor                    0.25     0.0      0.1111111
## Drosophilamelanogasterspeciesgroup   1.00     1.0      1.0000000
## Encrytidae                           0.00     0.4      0.2222222
## Ephydridae                           0.50     0.2      0.3333333
## Eremochrysa                          0.00     0.4      0.2222222
## Eulophidae                           0.25     0.2      0.2222222
## Eupelmidae                           0.00     0.4      0.2222222
## Eupnigodessierranus                  0.25     0.0      0.1111111
## Foreliuspruinosis                    0.25     0.2      0.2222222
## Geocorispallens                      0.75     0.6      0.6666667
## Geron                                0.25     0.2      0.2222222
## Glyptinaatriventris                  1.00     0.8      0.8888889
## Heleomyzidae                         0.00     0.4      0.2222222
## Hemerobiidae                         0.00     0.4      0.2222222
## Hymenorus                            0.25     0.2      0.2222222
## Hyperaspidius                        0.50     0.0      0.2222222
## Ichneumoidae                         0.25     0.2      0.2222222
## Lepidoptera                          1.00     1.0      1.0000000
## Limoniidae                           0.75     0.4      0.5555556
## Litaneutriaminor                     0.00     0.4      0.2222222
## Mecaphesa                            0.50     0.2      0.3333333
## Melyridae.redunicolor                0.50     0.0      0.2222222
## Metoponium                           0.75     0.2      0.4444444
## Micaria                              0.00     0.2      0.1111111
## Miridae                              1.00     0.6      0.7777778
## Mordellistena                        0.50     0.0      0.2222222
## Muscidae                             0.50     0.2      0.3333333
## Myrmaridae                           0.25     0.8      0.5555556
## Myrmecocystuskennedyi                0.25     0.6      0.4444444
## Mythicomyia                          0.75     0.6      0.6666667
## Norvellina                           0.00     0.4      0.2222222
## Norvellinabicolorata                 0.00     0.2      0.1111111
## Nysiusraphanus                       0.25     0.4      0.3333333
## Odontophotopsis                      0.00     0.6      0.3333333
## Oecleus                              0.75     0.6      0.6666667
## Oedaleonotusenigma                   0.75     0.0      0.3333333
## Oligotomanigra                       0.50     0.0      0.2222222
## Opsiusstactogalus                    0.50     0.2      0.3333333
## Orgerius                             0.00     0.4      0.2222222
## Osbornellus                          0.00     0.4      0.2222222
## Pheidolehyatti                       0.25     0.0      0.1111111
## Pherocera                            0.50     0.0      0.2222222
## Phoridae                             1.00     1.0      1.0000000
## Pipunculidae                         0.75     0.8      0.7777778
## Platygastridae.black                 1.00     1.0      1.0000000
## Platygastridae.brown                 0.00     0.4      0.2222222
## Pompilusphoenix                      1.00     0.4      0.6666667
## Psychodidae                          0.00     0.4      0.2222222
## Pteromalidae                         0.00     0.6      0.3333333
## Pthiria                              0.50     0.0      0.2222222
## Sarcophagidae                        0.75     0.0      0.3333333
## Scelioninae                          0.50     0.0      0.2222222
## Scenopinus                           0.00     0.4      0.2222222
## Sciaridae                            0.50     0.4      0.4444444
## Scotoleonlongipalpis                 0.25     0.2      0.2222222
## Solenopsisxyloni                     0.50     0.4      0.4444444
## Sphaerothalma                        0.00     0.4      0.2222222
## Tachinidae                           1.00     1.0      1.0000000
## Tachysphex                           0.50     0.0      0.2222222
## Thereva                              0.00     0.2      0.1111111
## Theridiidae                          0.00     0.2      0.1111111
## Tingidae                             0.00     0.4      0.2222222
## Titanebo                             0.00     0.2      0.1111111
## Tolliussetosus                       0.50     0.0      0.2222222
## Toxomerusmarginatus                  0.50     0.4      0.4444444
## Trimerotropispseudofasciata          0.25     0.2      0.2222222
## 
## $sign
##                                    s.absent s.present index      stat p.value
## X                                         1         1     3 1.0000000      NA
## Aeoloplidescalifornicus                   1         1     3 0.4714045      NA
## Agenioideusbirkmanni                      1         1     3 0.8164966      NA
## Agromyzidae                               1         0     1 0.6565322   0.265
## Anagyrus                                  1         1     3 0.6666667      NA
## Anomalon                                  0         1     2 0.4472136   1.000
## Anthocoridae                              1         1     3 0.4714045      NA
## Anthomyiidae                              1         1     3 0.8164966      NA
## Aphididae                                 1         1     3 0.8819171      NA
## Aphoebantus                               0         1     2 0.7046643   0.308
## Apollophanes                              0         1     2 0.6324555   0.435
## Apolysis                                  0         1     2 0.6324555   0.474
## Arenigena                                 0         1     2 0.6324555   0.459
## Arogaparaplutella                         0         1     2 0.6324555   0.459
## Ashmeadiella                              0         1     2 0.6324555   0.425
## Attalus                                   0         1     2 0.4472136   1.000
## Bethylidae                                1         1     3 1.0000000      NA
## Brachycistidinae.large                    1         1     3 0.5773503      NA
## Brachycistidinae.medium                   0         1     2 0.6324555   0.459
## Brachycistidinae.small                    1         1     3 0.8164966      NA
## Calilena.Hololena                         1         1     3 0.4714045      NA
## Carpophilushemipterus                     1         0     1 0.5000000   0.443
## Catharosia                                0         1     2 0.4472136   1.000
## Cecidomyiidae                             1         1     3 0.7453560      NA
## Ceraphronidae                             1         0     1 0.6282809   0.378
## Ceratagglia                               0         1     2 0.4472136   1.000
## Chalcididae                               1         1     3 0.8164966      NA
## Chamaemyiidae                             0         1     2 0.7460038   0.389
## Chironomidae                              1         1     3 0.9428090      NA
## Chloropidae                               1         1     3 0.5773503      NA
## Chyphotes                                 1         0     1 0.6282809   0.388
## Cicadellidae.palemanyspots                1         0     1 0.8040844   0.143
## Cicadellidae.palePhlepsanus               1         1     3 0.6666667      NA
## Circulifertenellus                        1         1     3 0.6666667      NA
## Coniopterygidae                           1         1     3 1.0000000      NA
## Culicidae                                 1         1     3 0.4714045      NA
## Dermestidae                               1         0     1 0.7071068   0.172
## Dictynidae                                1         1     3 0.6666667      NA
## Dolichopodidae                            1         1     3 0.6666667      NA
## Dorymyrmexbicolor                         1         0     1 0.5000000   0.448
## Drosophilamelanogasterspeciesgroup        1         1     3 1.0000000      NA
## Encrytidae                                0         1     2 0.6324555   0.427
## Ephydridae                                1         0     1 0.5976143   0.545
## Eremochrysa                               0         1     2 0.6324555   0.454
## Eulophidae                                1         1     3 0.4714045      NA
## Eupelmidae                                0         1     2 0.6324555   0.459
## Eupnigodessierranus                       1         0     1 0.5000000   0.449
## Foreliuspruinosis                         1         0     1 0.4736655   0.725
## Geocorispallens                           1         1     3 0.8164966      NA
## Geron                                     1         1     3 0.4714045      NA
## Glyptinaatriventris                       1         1     3 0.9428090      NA
## Heleomyzidae                              0         1     2 0.6324555   0.459
## Hemerobiidae                              0         1     2 0.6324555   0.459
## Hymenorus                                 1         1     3 0.4714045      NA
## Hyperaspidius                             1         0     1 0.7071068   0.172
## Ichneumoidae                              1         1     3 0.4714045      NA
## Lepidoptera                               1         1     3 1.0000000      NA
## Limoniidae                                1         0     1 0.7537784   0.362
## Litaneutriaminor                          0         1     2 0.6324555   0.439
## Mecaphesa                                 1         0     1 0.6282809   0.411
## Melyridae.redunicolor                     1         0     1 0.7071068   0.172
## Metoponium                                1         0     1 0.8438159   0.140
## Micaria                                   0         1     2 0.4472136   1.000
## Miridae                                   1         1     3 0.8819171      NA
## Mordellistena                             1         0     1 0.7071068   0.174
## Muscidae                                  1         0     1 0.6900656   0.258
## Myrmaridae                                0         1     2 0.8000000   0.169
## Myrmecocystuskennedyi                     1         1     3 0.6666667      NA
## Mythicomyia                               1         1     3 0.8164966      NA
## Norvellina                                0         1     2 0.6324555   0.459
## Norvellinabicolorata                      0         1     2 0.4472136   1.000
## Nysiusraphanus                            1         1     3 0.5773503      NA
## Odontophotopsis                           0         1     2 0.7745967   0.156
## Oecleus                                   1         1     3 0.8164966      NA
## Oedaleonotusenigma                        1         0     1 0.8660254   0.050
## Oligotomanigra                            1         0     1 0.7071068   0.172
## Opsiusstactogalus                         1         0     1 0.6940111   0.380
## Orgerius                                  0         1     2 0.6324555   0.439
## Osbornellus                               0         1     2 0.6324555   0.439
## Pheidolehyatti                            1         0     1 0.5000000   0.448
## Pherocera                                 1         0     1 0.7071068   0.174
## Phoridae                                  1         1     3 1.0000000      NA
## Pipunculidae                              1         1     3 0.8819171      NA
## Platygastridae.black                      1         1     3 1.0000000      NA
## Platygastridae.brown                      0         1     2 0.6324555   0.411
## Pompilusphoenix                           1         0     1 0.9393364   0.102
## Psychodidae                               0         1     2 0.6324555   0.427
## Pteromalidae                              0         1     2 0.7745967   0.158
## Pthiria                                   1         0     1 0.7071068   0.172
## Sarcophagidae                             1         0     1 0.8660254   0.037
## Scelioninae                               1         0     1 0.7071068   0.138
## Scenopinus                                0         1     2 0.6324555   0.414
## Sciaridae                                 1         1     3 0.6666667      NA
## Scotoleonlongipalpis                      1         1     3 0.4714045      NA
## Solenopsisxyloni                          1         1     3 0.6666667      NA
## Sphaerothalma                             0         1     2 0.6324555   0.459
## Tachinidae                                1         1     3 1.0000000      NA
## Tachysphex                                1         0     1 0.7071068   0.172
## Thereva                                   0         1     2 0.4472136   1.000
## Theridiidae                               0         1     2 0.4472136   1.000
## Tingidae                                  0         1     2 0.6324555   0.466
## Titanebo                                  0         1     2 0.4472136   1.000
## Tolliussetosus                            1         0     1 0.7071068   0.138
## Toxomerusmarginatus                       1         1     3 0.6666667      NA
## Trimerotropispseudofasciata               1         1     3 0.4714045      NA
## 
## attr(,"class")
## [1] "multipatt"
summary(indval)
## 
##  Multilevel pattern analysis
##  ---------------------------
## 
##  Association function: IndVal.g
##  Significance level (alpha): 0.05
## 
##  Total number of species: 105
##  Selected number of species: 2 
##  Number of species associated to 1 group: 2 
## 
##  List of species associated to each combination: 
## 
##  Group absent  #sps.  2 
##                     stat p.value  
## Oedaleonotusenigma 0.866   0.050 *
## Sarcophagidae      0.866   0.037 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1