Загрузка

library(tidyverse)
library(vegan)
library(dendextend)
library(iNEXT)
theme_set(theme_bw() + theme(legend.position = "bottom"))
taxa <- readxl::read_xlsx("Caspian data_15.09.2022_SA.xlsx", sheet = "taxa")
labs <- readxl::read_xlsx("Caspian data_15.09.2022_SA.xlsx", sheet = "samples")
df   <- readxl::read_xlsx("Caspian data_15.09.2022_SA.xlsx", sheet = "main")

# 0 = 6468
# !0 = 536

dfw <- df %>% 
    mutate_all(as.character) %>% #equalize all columns
    pivot_longer(names_to = "id", values_to = "abu", -sp) %>% 
    filter(sp != "Oribatida Juvenile instars", abu != "0") %>% 
    # temporary filter !!!
    filter(!(id %in% c("SmPbAe1", "SmPbAe2", "SmPbAe3", "SmPbAe4", "SmPbAe5"))) %>% 
    # temporary filter !!!
    left_join(select(taxa, sp, order), by = "sp") %>% 
    filter(order == "Oribatida") %>% 
    left_join(select(labs, id, distr), by = "id") %>% 
    filter(distr == "Samoor") %>% 
    select(-order, -distr) %>% 
    separate(col = abu, into = c("adu", "juv"), sep = "\\+", fill = "right") %>% 
    mutate(adu = as.numeric(adu), juv = as.numeric(juv), 
           juv = case_when(is.na(juv) ~ 0, TRUE ~ juv)) %>% 
    transmute(sp, id, abu = adu + juv) %>% 
    pivot_wider(names_from = id, values_from = abu, values_fill = 0)

dfl <- dfw %>% pivot_longer(names_to = "id", values_to = "abu", -sp)

dfl0 <- dfl %>% 
    mutate(id = substr(id, 1, nchar(id)- 1)) %>% 
    group_by(sp, id) %>% 
    summarise(abu = sum(abu), .groups = "drop")
dfw0 <- dfl0 %>% 
    pivot_wider(names_from = id, values_from = abu)

labs <- labs %>% 
    select(id, plants.d, plants.sp) %>% 
    unite("p", 2:3, sep = ", ") %>% 
    column_to_rownames("id") %>% 
    t %>% 
    as.data.frame() %>%
    as.list() %>% 
    lapply(FUN = function(a){ # No.of plants in dominant complex
        str_split(a, ", ") %>% 
            .[[1]] %>% 
            unique %>% 
            length
        }) %>% 
    map_dbl(c) %>% 
    tibble(id = names(.), dom.comp = .) %>% 
    left_join(labs, ., by = "id") %>% 
    mutate(veg = factor(veg, ordered = TRUE), 
           dom.comp = factor(dom.comp, ordered = TRUE)) 
indval <- function(dat, clas = colnames(dat), spec = rownames(dat), 
                   method = "APCF", rawdata = FALSE, significance = FALSE, 
                   nboot = 999) { 

# Variables description: see the function's previous version
# The function works by different ways with 0 and NA in matrix:
#    0 means abcence and involved to calculations
#    NA means `no data` and skipped of calculations
    
        
# test & pre-processing unit ----------------------------------------------
    dat <- as.matrix(dat)
    # dat[is.na(dat)] <- 0
    if(!is.numeric(dat)) {show("Your data aren't numeric"); break}
    if(sum(dat, na.rm = TRUE) <= 0) {show("Your data are empty or negative"); break}
    if(length(clas) != ncol(dat)) {show("Classification size error"); break}
    if(length(spec) != nrow(dat)) {show("Species number error"); break}
    if(!(method %in% c("APCF", "ACF", "ASF", "PCF", "PSF"))) {
        show("You selected unknown type of IndVal
try one of this: APCF, ACF, ASF, #PCF, #PSF"); break}
    clas[clas == "NA"] <- NA
    g <- unique(clas) |> sort() |> na.omit()
    
# Selecting unit ----------------------------------------------------------
    if(method == "APCF") { 
        calcA <- function(d, clas) { 
            res0 <- rep(NA, length(g))
            names(res0) <- g
            res <- rep(NA, length(g))
            names(res) <- g
            for(h in 1:length(g)) {
                res0[h] <- mean(d[clas == g[h]], na.rm = TRUE)
            }
            res0[is.nan(res0)] <- NA
            for(h in g){ 
                res[[h]] <- res0[[h]]/sum(res0, na.rm = TRUE)
                }
            return(res)
            }
        calcB <- function(d, clas) { 
            res <- rep(NA, length(g))
            names(res) <- g
            d[d>0] <- 1
            for(j in g)
                res[[j]] <- mean(d[which(clas == j)], na.rm = TRUE)
            return(res)
            }
    }
    if(method == "ACF") { 
        calcA <- function(d, clas) { 
            res0 <- rep(NA, length(g))
            names(res0) <- g
            res <- rep(NA, length(g))
            names(res) <- g
            for(h in 1:length(g)) {
                res0[h] <- mean(d[clas == g[h]], na.rm = TRUE)
            }
            res0[is.nan(res0)] <- NA
            for(h in g){ 
                res[[h]] <- res0[[h]]/sum(res0, na.rm = TRUE)
            }
            return(res)
        }
        calcB <- function(d, clas) { 
            res <- rep(NA, length(g))
            names(res) <- g
            for(j in g) { 
                e <- d[clas == j] |> na.omit()
                res[[j]] <- 1 - sum(abs(e/sum(e) - 1/length(e)))*0.5
            }
            res[is.nan(res)] <- 0
            return(res)
        }
    }
    if(method == "ASF") { 
        calcA <- function(d, clas) { 
            res0 <- rep(NA, length(g))
            names(res0) <- g
            res <- rep(NA, length(g))
            names(res) <- g
            for(h in g) { 
                res0[[h]] <- mean(d[clas == h], na.rm = TRUE)
            }
            res0[is.nan(res0)] <- NA
            for(h in g) { 
                res[[h]] <- (res0[[h]] - mean(res0[names(res0) != h], 
                    na.rm = TRUE)) / max(res0, na.rm = TRUE)
            }
            return(res)
        }
        calcB <- function(d, clas) { 
            res <- rep(NA, length(g))
            names(res) <- g
            for(j in g) { 
                e <- d[clas == j] |> na.omit()
                res[[j]] <- 1 - sum(abs(e/sum(e) - 1/length(e)))*0.5
            }
            res[is.nan(res)] <- 0
            return(res)
        }
    }

# computational unit ------------------------------------------------------
    A <- matrix(NA, nrow = length(spec), 
        ncol = length(g))
    colnames(A) <- g
    rownames(A) <- spec
    B <- A
    for(i in 1:nrow(A)) { 
        A[i,] <- calcA(dat[i,], clas)
        B[i,] <- calcB(dat[i,], clas)
    }
    res <- A*B*100
    res[is.nan(res)] <- NA
    S <-  mean(abs(res), na.rm = TRUE)
    
# permutational test ------------------------------------------------------
    if(significance == TRUE) { 
        library(parallel)
        library(doParallel)
        library(foreach)
        clas2 <- matrix(NA, ncol = length(clas), nrow = nboot)
        for(i in 1:nrow(clas2)) { 
            clas2[i,] <- sample(clas, length(clas))
        }
        myCluster <- makeCluster(detectCores()-1)
        registerDoParallel(myCluster)
        permutated <- foreach(i = 1:nboot, .combine = 'c') %dopar% {
            res2 <- matrix(NA, nrow = length(spec), ncol = length(g))
            for(j in 1:nrow(res2)) {
                res2[j,] <- 100 * 
                    calcA(dat[j,], clas2[i,]) 
                    calcB(dat[j,], clas2[i,])
            }
            mean(abs(res2), na.rm = TRUE)
        }
        stopCluster(myCluster)
        S2 <- (S - mean(c(S, permutated), na.rm = TRUE))/sd(c(S, permutated))
    }

# Return results ----------------------------------------------------------
    if(rawdata == FALSE & significance == FALSE) {return(
        list(Method = method, Sharpness = S, indval = res))
    }
    if(rawdata == TRUE  & significance == FALSE) {return(
        list(Method = method, Sharpness = S, indval = res, A = A, B = B))
    }
    if(rawdata == FALSE & significance == TRUE)  {return(
        list(Method = method, Sharpness = S, Significance = S2, indval = res)) 
    }
    if(rawdata == TRUE  & significance == TRUE)  {return(list(Method = method,
        Sharpness = S, Significance = S2, indval = res, A = A, B = B) )
    }
}
collapse_labels <- function(a){
    paste(names(sort(table(a), decreasing = TRUE)), collapse = " or ")
}
colorise_labels <- function(a) {
    n <- length(unique(a))
    clr <- hcl(h = seq(15, 375, length = n + 1), 
               l = 65, c = 100)[1:n]
    data.frame(l = unique(a), clr = clr) %>% 
        left_join(data.frame(l = a), ., by = "l") %>% 
        pull(clr)
}
count1 <- function(d) {
    d <- d %>% 
        pivot_wider(names_from = "sp", values_from = abu, values_fill = 0) 
    dis <- vegan::vegdist(d[,-1])
    PCOA <- ape::pcoa(dis)
    tibble(d[,1],
           abu  = apply(d[,-1], 1, function(a){sum(a)}),
           nsp  = apply(d[,-1], 1, function(a){length(a[a>0])}),
           shan = apply(d[,-1], 1, function(a){vegan::diversity(a, "shannon")}),
           ax.1 = PCOA$vectors[,1], 
           ax.2 = PCOA$vectors[,2]
    )
}

Вопрос 5

  1. Связано ли видовое разнообразие почвенных клещей (Oribatida, Mesostigmata) отдельных типов берега со сложностью растительного покрова (числом гипсометрических зон, биотопов или синузий видов сосудистых растений)?

— Связано, на песчаном пляже видовое богатство выше, но надо «выровнять» по числу проб.

требуется стандартизация c iNEXT

Примечание. Применение разрежения и эксраполяции для нивелирования различий между объемами выборки на результат почти не влияет

Обозначения: abu (abundance) - Обилие shan (Shannon’ index) - мера разнообразия Шеннона nsp (number of species) - количество видов i10 - ожидаемое количество видов в пробе из 10 особей 120 - ожидаемое количество видов в пробе из 20 особей i25 - ожидаемое количество видов в пробе из 25 особей

rar1 <- dfw %>% 
    select(-sp) %>% 
    lapply(function(a){sort(a[a>0], decreasing = TRUE)}) %>% 
    discard(~ length(.x) < 2) %>% 
    iNEXT::iNEXT(., q = 0, size = c(10, 20, 25), 
                 datatype = "abundance", nboot = 9) %>% # 999
    pluck("iNextEst", "size_based") %>% 
    filter(m %in% c(10, 20, 25)) %>% 
    select(id = Assemblage, m, qD) %>% 
    mutate(m = paste0("i", m)) %>% 
    pivot_wider(names_from = m, values_from = qD)

div <- dfl %>% 
    pivot_wider(names_from = "sp", values_from = abu, values_fill = 0) %>% 
    mutate(
        abu  = apply(.[,-1], 1, function(a){sum(a)}), 
        nsp  = apply(.[,-1], 1, function(a){length(a[a>0])}),
        shan = apply(.[,-1], 1, function(a){vegan::diversity(a, "shannon")}),
        .before = 2) %>% 
    left_join(labs, by = "id") %>% 
    left_join(rar1, by = "id") %>% 
    select(abu, nsp, i10, i20, i25, shan, id, 
           coast, skew, soil, substrate, zone, veg, dom.comp) %>% 
    filter(shan > 0)

coast type

div %>% 
    pivot_longer(names_to = "diversity", values_to = "val", -c(7:ncol(.))) %>% 
    ggplot(aes(x = coast, y = val, fill = coast)) + 
    geom_boxplot() + 
    facet_wrap(~diversity, scales = "free") + 
    labs(y = NULL, x = NULL, title = "Diversity ~ coast type") + 
    theme(axis.text.x = element_text(angle = 15, vjust = 0.7))

Skew

div %>% 
    pivot_longer(names_to = "diversity", values_to = "val", -c(7:ncol(.))) %>% 
    ggplot(aes(x = skew, y = val, fill = skew)) + 
    geom_boxplot() + 
    facet_wrap(~diversity, scales = "free") + 
    labs(y = NULL, x = NULL, title = "Diversity ~ skew") + 
    theme(axis.text.x = element_text(angle = 15, vjust = 0.7))

soil type

div %>% 
    pivot_longer(names_to = "diversity", values_to = "val", -c(7:ncol(.))) %>% 
    ggplot(aes(x = soil, y = val, fill = soil)) + 
    geom_boxplot() + 
    facet_wrap(~diversity, scales = "free") + 
    labs(y = NULL, x = NULL, title = "Diversity ~ soil type") + 
    theme(axis.text.x = element_text(angle = 15, vjust = 0.7))

substrate type

div %>% 
    pivot_longer(names_to = "diversity", values_to = "val", -c(7:ncol(.))) %>% 
    ggplot(aes(x = substrate, y = val, fill = substrate)) + 
    geom_boxplot() + 
    facet_wrap(~diversity, scales = "free") + 
    labs(y = NULL, x = NULL, title = "Diversity ~ substrate type") + 
    theme(axis.text.x = element_text(angle = 15, vjust = 0.7))

Zone

div %>% 
    pivot_longer(names_to = "diversity", values_to = "val", -c(7:ncol(.))) %>% 
    ggplot(aes(x = zone, y = val, fill = zone)) + 
    geom_boxplot() + 
    facet_wrap(~diversity, scales = "free") + 
    labs(y = NULL, x = NULL, title = "Diversity ~ zone") + 
    theme(axis.text.x = element_text(angle = 15, vjust = 0.7))

vegetation cover

div %>% 
    pivot_longer(names_to = "diversity", values_to = "val", -c(7:ncol(.))) %>% 
    ggplot(aes(x = veg, y = val, fill = veg)) + 
    geom_boxplot() + 
    facet_wrap(~diversity, scales = "free") + 
    labs(y = NULL, x = NULL, title = "Diversity ~ vegetation cover") + 
    theme(axis.text.x = element_text(angle = 15, vjust = 0.7))

Кол-во видов в доминантном комплексе

div %>% 
    pivot_longer(names_to = "diversity", values_to = "val", -c(7:ncol(.))) %>% 
    ggplot(aes(x = dom.comp, y = val, fill = dom.comp)) + 
    geom_boxplot() + 
    facet_wrap(~diversity, scales = "free") + 
    labs(y = NULL, x = NULL, title = "Diversity ~ Dominant complex", 
         subtitle = "Кол-во видов растений в доминантном комплексе")

Вопрос 5а

Кривые разрежения

По отдельным пробам

rar2 <- dfw %>% 
    select(-sp) %>% 
    lapply(function(a){sort(a[a>0], decreasing = TRUE)}) %>% 
    discard(~ length(.x) < 2) %>% 
    iNEXT::iNEXT(., q = 0, size = seq(5, 150, by = 5), #anchor_A
                 datatype = "abundance", nboot = 9) %>% # 999
    pluck("iNextEst", "size_based") %>% 
    transmute(id = Assemblage, Method, m, qD, qD.LCL, qD.UCL) %>% 
    as_tibble() %>%
    left_join(., select(labs, id, coast, skew, soil, 
        substrate, zone, veg, dom.comp), by = "id")
obs2 <- rar2 %>% 
    filter(Method == "Observed") %>% 
    mutate(r = case_when(m >= 150 ~ "up", m <= 5 ~ "low", TRUE ~ "r"), 
           m = case_when(m < 5 ~ 5, 
                         m > 150  ~ 150, 
                         TRUE ~ m))
rar2.rar <- rar2 %>% 
    filter(Method != "Extrapolation", m <= 150, m >= 5) %>%
    filter(m %in% seq(5, 150, by = 5) | Method == "Observed")

rar2.ext <- rar2 %>% 
    filter(Method != "Rarefaction", m <= 150, m >= 5) %>%
    filter(m %in% seq(5, 150, by = 5) | Method == "Observed")

Coast

ggplot(mapping = aes(x = m, y = qD, size = id, color = coast, fill = coast)) + 
    scale_size_manual(values = rep(1, 59)) +
    geom_line(data = rar2.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar2.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 155, y = qD, label = id), size = 3.5, show.legend=FALSE,
       data = summarise(group_by(rar2, id, coast), qD = max(qD), .groups = "drop")) +
    geom_point(mapping = aes(x = m, y = qD, size = id, fill = coast, shape = r), 
               data = obs2, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(25, 21, 24)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Skew

ggplot(mapping = aes(x = m, y = qD, size = id, color = skew, fill = skew)) + 
    scale_size_manual(values = rep(1, 59)) +
    geom_line(data = rar2.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar2.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 155, y = qD, label = id), size = 3.5, show.legend=FALSE,
       data = summarise(group_by(rar2, id, skew), qD = max(qD), .groups = "drop")) +
    geom_point(mapping = aes(x = m, y = qD, size = id, fill = skew, shape = r), 
               data = obs2, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(25, 21, 24)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Soil

ggplot(mapping = aes(x = m, y = qD, size = id, color = soil, fill = soil)) + 
    scale_size_manual(values = rep(1, 59)) +
    geom_line(data = rar2.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar2.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 155, y = qD, label = id), size = 3.5, show.legend=FALSE,
       data = summarise(group_by(rar2, id, soil), qD = max(qD), .groups = "drop")) +
    geom_point(mapping = aes(x = m, y = qD, size = id, fill = soil, shape = r), 
               data = obs2, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(25, 21, 24)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Substrate

ggplot(mapping = aes(x = m, y = qD, size = id, color = substrate, fill = substrate)) + 
    scale_size_manual(values = rep(1, 59)) +
    geom_line(data = rar2.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar2.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 155, y = qD, label = id), size = 3.5, show.legend=FALSE,
       data = summarise(group_by(rar2, id, substrate), qD = max(qD), .groups = "drop")) +
    geom_point(mapping = aes(x = m, y = qD, size = id, fill = substrate, shape = r), 
               data = obs2, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(25, 21, 24)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Zone

ggplot(mapping = aes(x = m, y = qD, size = id, color = zone, fill = zone)) + 
    scale_size_manual(values = rep(1, 59)) +
    geom_line(data = rar2.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar2.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 155, y = qD, label = id), size = 3.5, show.legend=FALSE,
       data = summarise(group_by(rar2, id, zone), qD = max(qD), .groups = "drop")) +
    geom_point(mapping = aes(x = m, y = qD, size = id, fill = zone, shape = r), 
               data = obs2, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(25, 21, 24)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Vegetation

ggplot(mapping = aes(x = m, y = qD, size = id, color = veg, fill = veg)) + 
    scale_size_manual(values = rep(1, 59)) +
    geom_line(data = rar2.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar2.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 155, y = qD, label = id), size = 3.5, show.legend=FALSE,
       data = summarise(group_by(rar2, id, veg), qD = max(qD), .groups = "drop")) +
    geom_point(mapping = aes(x = m, y = qD, size = id, fill = veg, shape = r), 
               data = obs2, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(25, 21, 24)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.7), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Dominant complex

ggplot(mapping = aes(x = m, y = qD, size = id, color = dom.comp, fill = dom.comp)) + 
    scale_size_manual(values = rep(1, 59)) +
    geom_line(data = rar2.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar2.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 155, y = qD, label = id), size = 3.5, show.legend=FALSE,
       data = summarise(group_by(rar2, id, dom.comp), qD = max(qD), .groups = "drop")) +
    geom_point(mapping = aes(x = m, y = qD, size = id, fill = dom.comp, shape = r), 
               data = obs2, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(25, 21, 24)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.7), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

По участкам (пробы объединены по 5)

rar3 <- dfw0 %>% 
    select(-sp) %>% 
    lapply(function(a){sort(a[a>0], decreasing = TRUE)}) %>% 
    discard(~ length(.x) < 2) %>% 
    iNEXT::iNEXT(., q = 0, size = seq(5, 300, by = 5), #anchor_A
                 datatype = "abundance", nboot = 9) %>% # 999
    pluck("iNextEst", "size_based") %>% 
    transmute(id = Assemblage, Method, m, qD, qD.LCL, qD.UCL) %>% 
    as_tibble() %>%
    filter(id != "SmSw")
rar3 <- labs %>% 
    mutate(id = substr(id, 1, nchar(id)-1)) %>% 
    select(id, coast, skew, soil, substrate, zone, veg, dom.comp) %>% 
    distinct() %>% 
    left_join(rar3, ., by = "id")

obs3 <- rar3 %>% 
    filter(Method == "Observed" | m >= 300) %>% 
    mutate(Method = "Observed") %>% 
    group_by(id, Method) %>%
    summarise(qD = min(qD), m = min(m), coast = unique(coast), 
              skew = unique(skew), soil = unique(soil),
              substrate = unique(substrate), zone = unique(zone),
              veg = unique(veg), dom.comp = unique(dom.comp),
              .groups = "drop") %>%
    mutate(r = case_when(m == 300 ~ "up", TRUE ~ "r"))

rar3.rar <- rar3 %>% 
    filter(Method != "Extrapolation", m <= 300, m >= 5) %>%
    filter(m %in% seq(5, 300, by = 5) | Method == "Observed")
rar3.ext <- rar3 %>% 
    filter(Method != "Rarefaction", m <= 300, m >= 5) %>%
    filter(m %in% seq(5, 300, by = 5) | Method == "Observed")

Coast

ggplot(mapping = aes(x = m, y = qD, size = id, color = coast, fill = coast)) + 
    geom_line(data = rar3.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar3.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 315, y = qD, label = id), 
        size = 3.5, show.legend=FALSE, 
        data = filter(rar3, m == 300)) +
    geom_point(mapping = aes(shape = r), 
               data = obs3, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(21, 24)) +
    scale_size_manual(values = rep(1, 59)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Skew

ggplot(mapping = aes(x = m, y = qD, size = id, color = skew, fill = skew)) + 
    geom_line(data = rar3.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar3.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 315, y = qD, label = id), 
        size = 3.5, show.legend=FALSE, 
        data = filter(rar3, m == 300)) +
    geom_point(mapping = aes(shape = r), 
               data = obs3, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(21, 24)) +
    scale_size_manual(values = rep(1, 59)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Soil

ggplot(mapping = aes(x = m, y = qD, size = id, color = soil, fill = soil)) + 
    geom_line(data = rar3.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar3.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 315, y = qD, label = id), 
        size = 3.5, show.legend=FALSE, 
        data = filter(rar3, m == 300)) +
    geom_point(mapping = aes(shape = r), 
               data = obs3, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(21, 24)) +
    scale_size_manual(values = rep(1, 59)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Substrate

Единственная проба с дебрисом удалена

ggplot(mapping = aes(x = m, y = qD, size = id, color = substrate, fill = substrate)) + 
    geom_line(data = rar3.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar3.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 315, y = qD, label = id), 
        size = 3.5, show.legend=FALSE, 
        data = filter(rar3, m == 300)) +
    geom_point(mapping = aes(shape = r), 
               data = obs3, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(21, 24)) +
    scale_size_manual(values = rep(1, 59)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Zone

ggplot(mapping = aes(x = m, y = qD, size = id, color = zone, fill = zone)) + 
    geom_line(data = rar3.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar3.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 315, y = qD, label = id), 
        size = 3.5, show.legend=FALSE, 
        data = filter(rar3, m == 300)) +
    geom_point(mapping = aes(shape = r), 
               data = obs3, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(21, 24)) +
    scale_size_manual(values = rep(1, 59)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.1, 0.86), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Vegetation

ggplot(mapping = aes(x = m, y = qD, size = id, color = veg, fill = veg)) + 
    geom_line(data = rar3.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar3.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 315, y = qD, label = id), 
        size = 3.5, show.legend=FALSE, 
        data = filter(rar3, m == 300)) +
    geom_point(mapping = aes(shape = r), 
               data = obs3, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(21, 24)) +
    scale_size_manual(values = rep(1, 59)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.07, 0.76), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Dominant complex

ggplot(mapping = aes(x = m, y = qD, size = id, color = dom.comp, fill = dom.comp)) + 
    geom_line(data = rar3.ext, linetype = "dotted", alpha = 0.7) +
    geom_line(data = rar3.rar, alpha = 0.5) + 
    geom_text(mapping = aes(x = 315, y = qD, label = id), 
        size = 3.5, show.legend=FALSE, 
        data = filter(rar3, m == 300)) +
    geom_point(mapping = aes(shape = r), 
               data = obs3, size = 3, color = "black", show.legend=FALSE,) +
    scale_shape_manual(values = c(21, 24)) +
    scale_size_manual(values = rep(1, 59)) +
    labs(x = "individuals", y = "number of species") +
    theme(legend.position = c(0.07, 0.75), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    guides(size = "none", shape = "none")

Усреднены данные

support <- function(B){
    B %>% 
    select(-sp) %>% 
    lapply(function(a){sort(a[a>0], decreasing = TRUE)}) %>% 
    discard(~ length(.x) < 2) %>% 
    iNEXT::iNEXT(., q = 0, size = seq(30, 3000, by = 30), #anchor_A
                 datatype = "abundance", nboot = 9) %>% # 999
    pluck("iNextEst", "size_based") %>% 
    transmute(type = Assemblage, Method, m, qD, qD.LCL, qD.UCL) %>% 
    as_tibble() %>% 
    pivot_wider(names_from = Method, values_from = "qD") %>% 
    pivot_longer(names_to = "Method", values_to = "qD", -c(1:4, 6)) %>% 
    filter(!is.na(Observed) | !is.na(qD))
}

Coast

dfl %>% 
    left_join(select(labs, id, coast), by = "id") %>% 
    group_by(coast, sp) %>% 
    summarise(abu = sum(abu), .groups = "drop") %>% 
    pivot_wider(values_from = "abu", names_from = "coast") %>% 
    support %>% 
    ggplot(aes(x = m, y = qD, ymin = qD.LCL, ymax = qD.UCL, 
               color = type, fill = type, linetype = Method)) + 
    geom_ribbon(alpha = 0.2, linetype = "blank") +
    geom_line(linewidth = 1.2) +
    geom_point(mapping = aes(x = m, y = Observed), size = 3, shape = 22) +
    scale_linetype_manual(values = c("dotted", "solid")) + 
    guides(linetype = "none") +
    theme(legend.position = c(0.15, 0.8), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey"))+ 
    labs(x = "individuals", y = "number of species") 

Skew

dfl %>% 
    left_join(select(labs, id, skew), by = "id") %>% 
    group_by(skew, sp) %>% 
    summarise(abu = sum(abu), .groups = "drop") %>% 
    pivot_wider(values_from = "abu", names_from = "skew") %>% 
    support %>% 
    ggplot(aes(x = m, y = qD, ymin = qD.LCL, ymax = qD.UCL, 
               color = type, fill = type, linetype = Method)) + 
    geom_ribbon(alpha = 0.2, linetype = "blank") +
    geom_line(linewidth = 1.2) +
    geom_point(mapping = aes(x = m, y = Observed), size = 3, shape = 22) +
    scale_linetype_manual(values = c("dotted", "solid")) + 
    guides(linetype = "none") +
    theme(legend.position = c(0.15, 0.8), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey"))+ 
    labs(x = "individuals", y = "number of species") 

Soil

dfl %>% 
    left_join(select(labs, id, soil), by = "id") %>% 
    group_by(soil, sp) %>% 
    summarise(abu = sum(abu), .groups = "drop") %>% 
    pivot_wider(values_from = "abu", names_from = "soil") %>% 
    support %>% 
    ggplot(aes(x = m, y = qD, ymin = qD.LCL, ymax = qD.UCL, 
               color = type, fill = type, linetype = Method)) + 
    geom_ribbon(alpha = 0.2, linetype = "blank") +
    geom_line(linewidth = 1.2) +
    geom_point(mapping = aes(x = m, y = Observed), size = 3, shape = 22) +
    scale_linetype_manual(values = c("dotted", "solid")) + 
    guides(linetype = "none") +
    theme(legend.position = c(0.15, 0.8), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey"))+ 
    labs(x = "individuals", y = "number of species") 

Substrate

dfl %>% 
    left_join(select(labs, id, substrate), by = "id") %>% 
    group_by(substrate, sp) %>% 
    summarise(abu = sum(abu), .groups = "drop") %>% 
    pivot_wider(values_from = "abu", names_from = "substrate") %>% 
    support %>% 
    ggplot(aes(x = m, y = qD, ymin = qD.LCL, ymax = qD.UCL, 
               color = type, fill = type, linetype = Method)) + 
    geom_ribbon(alpha = 0.2, linetype = "blank") +
    geom_line(linewidth = 1.2) +
    geom_point(mapping = aes(x = m, y = Observed), size = 3, shape = 22) +
    scale_linetype_manual(values = c("dotted", "solid")) + 
    guides(linetype = "none") +
    theme(legend.position = c(0.15, 0.8), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey"))+ 
    labs(x = "individuals", y = "number of species") 

Zone

dfl %>% 
    left_join(select(labs, id, zone), by = "id") %>% 
    group_by(zone, sp) %>% 
    summarise(abu = sum(abu), .groups = "drop") %>% 
    pivot_wider(values_from = "abu", names_from = "zone") %>% 
    support %>% 
    ggplot(aes(x = m, y = qD, ymin = qD.LCL, ymax = qD.UCL, 
               color = type, fill = type, linetype = Method)) + 
    geom_ribbon(alpha = 0.2, linetype = "blank") +
    geom_line(linewidth = 1.2) +
    geom_point(mapping = aes(x = m, y = Observed), size = 3, shape = 22) +
    scale_linetype_manual(values = c("dotted", "solid")) + 
    guides(linetype = "none") +
    theme(legend.position = c(0.15, 0.8), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey"))+ 
    labs(x = "individuals", y = "number of species") 

Vegetation

dfl %>% 
    left_join(select(labs, id, veg), by = "id") %>% 
    group_by(veg, sp) %>% 
    summarise(abu = sum(abu), .groups = "drop") %>% 
    pivot_wider(values_from = "abu", names_from = "veg") %>% 
    support %>% 
    mutate(type = as.numeric(type), 
             type = factor(type, ordered = TRUE)) %>% 
    ggplot(aes(x = m, y = qD, ymin = qD.LCL, ymax = qD.UCL, 
               color = type, fill = type, linetype = Method)) + 
    geom_ribbon(alpha = 0.2, linetype = "blank") +
    geom_line(linewidth = 1.2) +
    geom_point(mapping = aes(x = m, y = Observed), size = 3, shape = 22) +
    scale_linetype_manual(values = c("dotted", "solid")) + 
    guides(linetype = "none") +
    theme(legend.position = c(0.05, 0.7), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey"))+ 
    labs(x = "individuals", y = "number of species") 

Dominant complex

dfl %>% 
    left_join(select(labs, id, dom.comp), by = "id") %>% 
    group_by(dom.comp, sp) %>% 
    summarise(abu = sum(abu), .groups = "drop") %>% 
    pivot_wider(values_from = "abu", names_from = "dom.comp") %>% 
    support %>% 
    mutate(type = as.numeric(type), 
             type = factor(type, ordered = TRUE)) %>% 
    ggplot(aes(x = m, y = qD, ymin = qD.LCL, ymax = qD.UCL, 
               color = type, fill = type, linetype = Method)) + 
    geom_ribbon(alpha = 0.2, linetype = "blank") +
    geom_line(linewidth = 1.2) +
    geom_point(mapping = aes(x = m, y = Observed), size = 3, shape = 22) +
    scale_linetype_manual(values = c("dotted", "solid")) + 
    guides(linetype = "none") +
    theme(legend.position = c(0.05, 0.7), 
          legend.title = element_blank(), 
          legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey"))+ 
    labs(x = "individuals", y = "number of species") 

Вопрос 5b

Профили Хилла

s <- (1.045^seq(0,20,by=0.25)-1)*3
s <- s[s< 0.96 | s >= 1]
s <- s[s< 1.97 | s >= 2.05]
s <- sort(c(s, 1, 2))

#s <- c(seq(0, 2, by = 0.05), 2.05^((seq(1, 10, length.out = 16))^0.35))

hill <- dfw[,-1] %>% 
    t %>% 
    vegan::renyi(scales = s, hill = TRUE) %>% 
    rownames_to_column("id") %>% 
    as_tibble() %>% 
    pivot_longer(names_to = "ord", values_to = "H", -id) %>% 
    mutate(ord = as.numeric(ord), O = rep(0:(length(s)-1), 69)) %>% 
    left_join(select(labs, id, 
        coast, skew, zone, substrate, soil, veg, dom.comp), by = "id")

Coast

hill %>% 
    group_by(ord, O, coast) %>% 
    summarise(HH = mean(H), 
        UH = mean(H)+sd(H), 
        LH = mean(H)-sd(H), 
        .groups = "drop") %>% 
    ggplot(aes(x = O, y = HH, ymin = LH, ymax = UH, color = coast, fill = coast)) + 
    geom_ribbon(alpha = 0.2, size = 0) +
    geom_line(size = 1) + 
    scale_x_continuous(
        breaks = which(s %in% c(0, 1, 2, max(s)))-1,
        labels = c(0, 1, 2, Inf)) +
    theme(
        panel.grid.minor = element_blank(), 
        legend.position = c(0.8, 0.8), 
        legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    labs(x = "Order", y = "Hill numbers")

Skew

hill %>% 
    group_by(ord, O, skew) %>% 
    summarise(HH = mean(H), 
        UH = mean(H)+sd(H), 
        LH = mean(H)-sd(H), 
        .groups = "drop") %>% 
    ggplot(aes(x = O, y = HH, ymin = LH, ymax = UH, color = skew, fill = skew)) + 
    geom_ribbon(alpha = 0.2, size = 0) +
    geom_line(size = 1) + 
    scale_x_continuous(
        breaks = which(s %in% c(0, 1, 2, max(s)))-1,
        labels = c(0, 1, 2, Inf)) +
    theme(
        panel.grid.minor = element_blank(), 
        legend.position = c(0.8, 0.8), 
        legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    labs(x = "Order", y = "Hill numbers")

Soil

hill %>% 
    group_by(ord, O, soil) %>% 
    summarise(HH = mean(H), 
        UH = mean(H)+sd(H), 
        LH = mean(H)-sd(H), 
        .groups = "drop") %>% 
    ggplot(aes(x = O, y = HH, ymin = LH, ymax = UH, color = soil, fill = soil)) + 
    geom_ribbon(alpha = 0.2, size = 0) +
    geom_line(size = 1) + 
    scale_x_continuous(
        breaks = which(s %in% c(0, 1, 2, max(s)))-1,
        labels = c(0, 1, 2, Inf)) +
    theme(
        panel.grid.minor = element_blank(), 
        legend.position = c(0.8, 0.8), 
        legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    labs(x = "Order", y = "Hill numbers")

Substrate

hill %>% 
    group_by(ord, O, substrate) %>% 
    summarise(HH = mean(H), 
        UH = mean(H)+sd(H), 
        LH = mean(H)-sd(H), 
        .groups = "drop") %>% 
    ggplot(aes(x = O, y = HH, ymin = LH, ymax = UH, 
               color = substrate, fill = substrate)) + 
    geom_ribbon(alpha = 0.2, size = 0) +
    geom_line(size = 1) + 
    scale_x_continuous(
        breaks = which(s %in% c(0, 1, 2, max(s)))-1,
        labels = c(0, 1, 2, Inf)) +
    theme(
        panel.grid.minor = element_blank(), 
        legend.position = c(0.8, 0.8), 
        legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    labs(x = "Order", y = "Hill numbers")

Zone

hill %>% 
    group_by(ord, O, zone) %>% 
    summarise(HH = mean(H), 
        UH = mean(H)+sd(H), 
        LH = mean(H)-sd(H), 
        .groups = "drop") %>% 
    ggplot(aes(x = O, y = HH, ymin = LH, ymax = UH, color = zone, fill = zone)) + 
    geom_ribbon(alpha = 0.2, size = 0) +
    geom_line(size = 1) + 
    scale_x_continuous(
        breaks = which(s %in% c(0, 1, 2, max(s)))-1,
        labels = c(0, 1, 2, Inf)) +
    theme(
        panel.grid.minor = element_blank(), 
        legend.position = c(0.8, 0.8), 
        legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    labs(x = "Order", y = "Hill numbers")

Vegetation

hill %>% 
    group_by(ord, O, veg) %>% 
    summarise(HH = mean(H), 
        UH = mean(H)+sd(H), 
        LH = mean(H)-sd(H), 
        .groups = "drop") %>% 
    ggplot(aes(x = O, y = HH, ymin = LH, ymax = UH, 
               color = veg, fill = veg)) + 
    geom_ribbon(alpha = 0.2, size = 0) +
    geom_line(size = 1) + 
    scale_x_continuous(
        breaks = which(s %in% c(0, 1, 2, max(s)))-1,
        labels = c(0, 1, 2, Inf)) +
    theme(
        panel.grid.minor = element_blank(), 
        legend.position = c(0.8, 0.7), 
        legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    labs(x = "Order", y = "Hill numbers")

Dominant complex

hill %>% 
    group_by(ord, O, dom.comp) %>% 
    summarise(HH = mean(H), 
        UH = mean(H)+sd(H), 
        LH = mean(H)-sd(H), 
        .groups = "drop") %>% 
    ggplot(aes(x = O, y = HH, ymin = LH, ymax = UH, 
               color = dom.comp, fill = dom.comp)) + 
    geom_ribbon(alpha = 0.2, size = 0) +
    geom_line(size = 1) + 
    scale_x_continuous(
        breaks = which(s %in% c(0, 1, 2, max(s)))-1,
        labels = c(0, 1, 2, Inf)) +
    theme(
        panel.grid.minor = element_blank(), 
        legend.position = c(0.8, 0.7), 
        legend.background = element_rect(fill="white",
                                  linewidth=0.5, linetype="solid", 
                                  colour ="grey")) + 
    labs(x = "Order", y = "Hill numbers")

Вопрос 6

  1. Есть ли виды-специалисты, приуроченные к отдельному типу берега (галечный, песчаный, тростниковый), или биотопу-синузии, или к плотным злаковым дернинам в целом?

— Есть.

Примечание. Использован IndVal - “индикаторная ценность вида”. В форме APCF, как применено здесь, он принимает значения от 0 до 100%. Максимум достигается когда вид не встречается в пробах других типов, но встречается во всех пробах данного типа, причем представлен во всех них.

Примечание 2. Для синузий нужна какая-то иерархическая классификация, чтобы такой же подход можно было применить и для этого средового фактора. Вариантов два. Сделать это на основе вашего экспертного мнения или сделать это на основе каких-либо алгоритмов, например - классифицировать не население клещей по типу проб, а пробы по населению клещей. Вариант два считаю менее предпочтительным, т.к. нахожу его несколько рекурсивным, но в зарубежные коллеги так поступают часто

dummy <- data.frame(id = colnames(dfw)[-1]) %>% 
    left_join(labs, by = "id")
iv <- list()
iv$coast <- dfw %>% 
    column_to_rownames("sp") %>% 
    indval(., clas = dummy$coast, 
           significance = FALSE) %>% # 
    .$indval %>% 
    round(., 1) %>% 
    as.data.frame() %>% 
    rownames_to_column("species")
iv$skew <- dfw %>% 
    column_to_rownames("sp") %>% 
    indval(., clas = dummy$skew, 
           significance = FALSE) %>% # 
    .$indval %>% 
    round(., 1) %>% 
    as.data.frame() %>% 
    rownames_to_column("species")
iv$substrate <- dfw %>% 
    column_to_rownames("sp") %>% 
    indval(., clas = dummy$substrate, 
           significance = FALSE) %>% # 
    .$indval %>% 
    round(., 1) %>% 
    as.data.frame() %>% 
    rownames_to_column("species")
iv$soil <- dfw %>% 
    column_to_rownames("sp") %>% 
    indval(., clas = dummy$soil, 
           significance = FALSE) %>% # 
    .$indval %>% 
    round(., 1) %>% 
    as.data.frame() %>% 
    rownames_to_column("species")
iv$zone <- dfw %>% 
    column_to_rownames("sp") %>% 
    indval(., clas = dummy$zone, 
           significance = FALSE) %>% # 
    .$indval %>% 
    round(., 1) %>% 
    as.data.frame() %>% 
    rownames_to_column("species")

Coast

formattable::formattable(iv[[1]])
species pebbly reeds sandy beach
Aphelacarus acarinus 0.0 0.0 2.1
Oppiella nova 0.2 46.9 1.6
Microppia minus 1.2 0.0 13.3
Punctoribates insignis 16.9 0.0 0.2
Punctoribates hexagonus 18.8 0.0 0.0
Protoribates capucinus 0.0 56.1 0.4
Zygoribatula caspica 0.0 0.0 4.2
Zygoribatula glabra (cf.) 12.3 0.0 6.3
Zygoribatula exarata 0.0 0.0 2.1
Oribatula tibialis 0.0 0.0 2.1
Oribatella caspica (cf.) 0.2 7.9 13.3
Scheloribates laevigatus (cf.) 0.0 57.0 0.2
Acrotritia ardua 3.9 3.3 2.6
Epilohmannia styriaca 0.0 48.5 1.6
Passalozetes africanus 0.0 0.0 6.2
Sphaerochthonius splendidus 0.0 15.7 1.4
Phyllozetes emmae 0.0 0.0 4.2
Austrophthiracarus duplex (cf.) 56.1 0.0 0.0
Phthiracarus globosus 6.2 0.0 0.0
Pyroppia lanceolata 4.7 0.0 0.5
Eobrachychthonius latior 0.0 68.2 1.2
Haplochthonius simplex 0.0 0.0 6.2
Trichogalumna nipponica 11.2 0.0 1.7
Galumna tarsipennata 0.0 0.0 6.2
Hydrozetes lacustris parisiensis 0.0 0.0 2.1
Zetomimus furcatus 4.7 0.0 0.5
Mesotritia nuda 6.2 0.0 0.0
Xenillus moyae 12.5 0.0 0.0
Scheloribates distinctus 0.0 0.0 47.6
Liebstadia similis 0.0 0.0 2.1
Trhypochthoniellus longisetus 18.8 0.0 0.0
Sellnickochthonius immaculatus 2.9 41.3 17.9
Sellnickochthonius suecicus 0.0 0.0 10.4
Brachychthonius bimaculatus 0.0 0.0 12.5
Liochthonius lapponicus 0.0 33.2 0.7
Ramusella (Insculptoppia) furcata 0.0 53.0 0.5
Lalmoppia sp. 0.0 0.0 2.1
Suctobelbella (Flagrosuctobelba) baloghi 0.0 0.0 6.2
Suctobelbella (Ussuribata) latirostris 0.0 0.0 4.2
Suctobelbella (Suctobelbella) subcornigera 0.0 17.3 0.8
Zygoribatula undulata 0.2 0.0 55.5
Oribatula pannonica 6.2 0.0 0.0
Hydrozetes lemnae 2.9 0.0 1.1
Latilamellobates naltschicki 6.2 0.0 0.0
Trichoribates berlesei 8.5 21.5 0.0
Eupelops plicatus 0.0 0.0 2.1
Malaconothrus monodactylus 0.0 0.0 4.2
Tectocepheus sarekensis 0.0 8.5 4.8
Pilogalumna tenuiclava 0.0 0.0 6.2
Pergalumna obvia 0.0 0.0 6.2
Brachychthonius berlesei 0.0 99.8 0.0
Galumna sp. 0.0 0.0 2.1
Punctoribates tschernovi 0.0 0.0 2.1
Xenillus tegeocranus 0.0 100.0 0.0
Oppia denticulata 0.0 100.0 0.0
Microzetorchestes emeryi 0.0 20.0 0.0
Galumna dimorpha 0.0 20.0 0.0
Ramusella clavipectinata 0.0 80.0 0.0
Banksinoma sp. 0.0 20.0 0.0

Skew

formattable::formattable(iv[[2]])
species flat gentle steep
Aphelacarus acarinus 5.6 0.0 0.0
Oppiella nova 11.8 3.6 0.4
Microppia minus 40.6 0.0 0.5
Punctoribates insignis 1.3 0.0 14.5
Punctoribates hexagonus 0.0 0.0 18.8
Protoribates capucinus 33.3 0.0 0.0
Zygoribatula caspica 11.1 0.0 0.0
Zygoribatula glabra (cf.) 0.6 5.5 9.8
Zygoribatula exarata 5.6 0.0 0.0
Oribatula tibialis 5.6 0.0 0.0
Oribatella caspica (cf.) 4.9 17.2 0.2
Scheloribates laevigatus (cf.) 13.3 1.2 0.0
Acrotritia ardua 8.2 0.7 3.6
Epilohmannia styriaca 38.9 0.0 0.0
Passalozetes africanus 16.7 0.0 0.0
Sphaerochthonius splendidus 22.2 0.0 0.0
Phyllozetes emmae 11.1 0.0 0.0
Austrophthiracarus duplex (cf.) 0.0 0.0 55.8
Phthiracarus globosus 0.0 0.0 6.2
Pyroppia lanceolata 2.6 0.0 3.3
Eobrachychthonius latior 44.4 0.0 0.0
Haplochthonius simplex 16.7 0.0 0.0
Trichogalumna nipponica 0.8 1.1 9.1
Galumna tarsipennata 0.3 5.4 0.0
Hydrozetes lacustris parisiensis 5.6 0.0 0.0
Zetomimus furcatus 2.6 0.0 3.3
Mesotritia nuda 0.0 0.0 6.2
Xenillus moyae 0.0 0.0 12.5
Scheloribates distinctus 0.0 65.4 0.0
Liebstadia similis 5.6 0.0 0.0
Trhypochthoniellus longisetus 0.0 0.0 18.8
Sellnickochthonius immaculatus 12.9 30.5 3.6
Sellnickochthonius suecicus 27.8 0.0 0.0
Brachychthonius bimaculatus 24.2 0.4 0.0
Liochthonius lapponicus 5.5 2.9 0.0
Ramusella (Insculptoppia) furcata 10.1 2.3 0.0
Lalmoppia sp. 5.6 0.0 0.0
Suctobelbella (Flagrosuctobelba) baloghi 16.7 0.0 0.0
Suctobelbella (Ussuribata) latirostris 3.7 1.0 0.0
Suctobelbella (Suctobelbella) subcornigera 8.3 1.5 0.0
Zygoribatula undulata 0.0 73.2 0.1
Oribatula pannonica 0.0 0.0 6.2
Hydrozetes lemnae 0.0 1.8 2.4
Latilamellobates naltschicki 0.0 0.0 6.2
Trichoribates berlesei 2.7 0.1 13.9
Eupelops plicatus 0.0 2.9 0.0
Malaconothrus monodactylus 0.0 5.7 0.0
Tectocepheus sarekensis 0.7 9.9 0.0
Pilogalumna tenuiclava 0.0 8.6 0.0
Pergalumna obvia 0.0 8.6 0.0
Brachychthonius berlesei 27.5 0.0 0.0
Galumna sp. 0.0 2.9 0.0
Punctoribates tschernovi 0.0 2.9 0.0
Xenillus tegeocranus 27.8 0.0 0.0
Oppia denticulata 27.8 0.0 0.0
Microzetorchestes emeryi 5.6 0.0 0.0
Galumna dimorpha 5.6 0.0 0.0
Ramusella clavipectinata 22.2 0.0 0.0
Banksinoma sp. 5.6 0.0 0.0

Substrate

formattable::formattable(iv[[3]])
species debris turf
Aphelacarus acarinus 20.0 0.0
Oppiella nova 0.0 12.5
Microppia minus 47.6 1.9
Punctoribates insignis 16.2 0.9
Punctoribates hexagonus 9.2 1.7
Protoribates capucinus 53.7 0.5
Zygoribatula caspica 18.6 0.1
Zygoribatula glabra (cf.) 39.3 3.8
Zygoribatula exarata 20.0 0.0
Oribatula tibialis 20.0 0.0
Oribatella caspica (cf.) 13.7 11.3
Scheloribates laevigatus (cf.) 0.0 7.8
Acrotritia ardua 97.1 0.1
Epilohmannia styriaca 77.4 0.2
Passalozetes africanus 60.0 0.0
Sphaerochthonius splendidus 58.3 0.0
Phyllozetes emmae 40.0 0.0
Austrophthiracarus duplex (cf.) 39.5 0.1
Phthiracarus globosus 20.0 0.0
Pyroppia lanceolata 18.6 0.1
Eobrachychthonius latior 56.8 0.4
Haplochthonius simplex 60.0 0.0
Trichogalumna nipponica 31.4 1.0
Galumna tarsipennata 6.1 2.2
Hydrozetes lacustris parisiensis 20.0 0.0
Zetomimus furcatus 18.6 0.1
Mesotritia nuda 20.0 0.0
Xenillus moyae 19.7 0.0
Scheloribates distinctus 0.0 37.5
Liebstadia similis 0.0 1.6
Trhypochthoniellus longisetus 0.0 4.7
Sellnickochthonius immaculatus 0.0 48.4
Sellnickochthonius suecicus 0.0 7.8
Brachychthonius bimaculatus 0.0 9.4
Liochthonius lapponicus 0.0 6.2
Ramusella (Insculptoppia) furcata 0.0 7.8
Lalmoppia sp. 0.0 1.6
Suctobelbella (Flagrosuctobelba) baloghi 0.0 4.7
Suctobelbella (Ussuribata) latirostris 0.0 3.1
Suctobelbella (Suctobelbella) subcornigera 0.0 6.2
Zygoribatula undulata 0.0 45.3
Oribatula pannonica 0.0 1.6
Hydrozetes lemnae 0.0 3.1
Latilamellobates naltschicki 0.0 1.6
Trichoribates berlesei 0.0 9.4
Eupelops plicatus 0.0 1.6
Malaconothrus monodactylus 0.0 3.1
Tectocepheus sarekensis 0.0 7.8
Pilogalumna tenuiclava 0.0 4.7
Pergalumna obvia 0.0 4.7
Brachychthonius berlesei 0.0 9.4
Galumna sp. 0.0 1.6
Punctoribates tschernovi 0.0 1.6
Xenillus tegeocranus 0.0 7.8
Oppia denticulata 0.0 7.8
Microzetorchestes emeryi 0.0 1.6
Galumna dimorpha 0.0 1.6
Ramusella clavipectinata 0.0 6.2
Banksinoma sp. 0.0 1.6

Soil

formattable::formattable(iv[[4]])
species clay grass remnants sand woody debris
Aphelacarus acarinus 0.0 33.3 0.0 0.0
Oppiella nova 49.7 0.0 1.5 0.0
Microppia minus 0.0 7.4 1.1 66.5
Punctoribates insignis 0.0 0.0 0.5 45.4
Punctoribates hexagonus 0.0 0.0 1.1 33.1
Protoribates capucinus 26.7 24.7 0.0 9.3
Zygoribatula caspica 0.0 0.0 0.1 48.4
Zygoribatula glabra (cf.) 0.0 9.7 2.4 32.7
Zygoribatula exarata 0.0 33.3 0.0 0.0
Oribatula tibialis 0.0 0.0 0.0 50.0
Oribatella caspica (cf.) 6.0 6.7 5.9 7.5
Scheloribates laevigatus (cf.) 57.6 0.0 0.1 0.0
Acrotritia ardua 0.5 15.4 0.0 81.1
Epilohmannia styriaca 12.1 70.3 0.0 4.8
Passalozetes africanus 0.0 100.0 0.0 0.0
Sphaerochthonius splendidus 3.7 81.6 0.0 0.0
Phyllozetes emmae 0.0 66.7 0.0 0.0
Austrophthiracarus duplex (cf.) 0.0 0.3 0.1 49.4
Phthiracarus globosus 0.0 0.0 0.0 50.0
Pyroppia lanceolata 0.0 31.7 0.1 0.0
Eobrachychthonius latior 22.2 72.0 0.0 0.0
Haplochthonius simplex 0.0 100.0 0.0 0.0
Trichogalumna nipponica 0.0 0.0 0.5 89.4
Galumna tarsipennata 0.0 0.0 1.7 25.2
Hydrozetes lacustris parisiensis 0.0 0.0 0.0 50.0
Zetomimus furcatus 0.0 0.0 0.1 48.4
Mesotritia nuda 0.0 0.0 0.0 50.0
Xenillus moyae 0.0 0.0 0.0 49.7
Scheloribates distinctus 0.0 0.0 40.7 0.0
Liebstadia similis 0.0 0.0 1.7 0.0
Trhypochthoniellus longisetus 0.0 0.0 5.1 0.0
Sellnickochthonius immaculatus 48.1 0.0 18.3 0.0
Sellnickochthonius suecicus 0.0 0.0 8.5 0.0
Brachychthonius bimaculatus 0.0 0.0 10.2 0.0
Liochthonius lapponicus 34.3 0.0 0.5 0.0
Ramusella (Insculptoppia) furcata 54.2 0.0 0.3 0.0
Lalmoppia sp. 0.0 0.0 1.7 0.0
Suctobelbella (Flagrosuctobelba) baloghi 0.0 0.0 5.1 0.0
Suctobelbella (Ussuribata) latirostris 0.0 0.0 3.4 0.0
Suctobelbella (Suctobelbella) subcornigera 17.7 0.0 0.6 0.0
Zygoribatula undulata 0.0 0.0 49.2 0.0
Oribatula pannonica 0.0 0.0 1.7 0.0
Hydrozetes lemnae 0.0 0.0 3.4 0.0
Latilamellobates naltschicki 0.0 0.0 1.7 0.0
Trichoribates berlesei 32.2 0.0 1.3 0.0
Eupelops plicatus 0.0 0.0 1.7 0.0
Malaconothrus monodactylus 0.0 0.0 3.4 0.0
Tectocepheus sarekensis 9.5 0.0 3.6 0.0
Pilogalumna tenuiclava 0.0 0.0 5.1 0.0
Pergalumna obvia 0.0 0.0 5.1 0.0
Brachychthonius berlesei 99.8 0.0 0.0 0.0
Galumna sp. 0.0 0.0 1.7 0.0
Punctoribates tschernovi 0.0 0.0 1.7 0.0
Xenillus tegeocranus 100.0 0.0 0.0 0.0
Oppia denticulata 100.0 0.0 0.0 0.0
Microzetorchestes emeryi 20.0 0.0 0.0 0.0
Galumna dimorpha 20.0 0.0 0.0 0.0
Ramusella clavipectinata 80.0 0.0 0.0 0.0
Banksinoma sp. 20.0 0.0 0.0 0.0

Zone

formattable::formattable(iv$zone)
species first second third
Aphelacarus acarinus 2.3 0.0 0.0
Oppiella nova 2.2 16.1 0.0
Microppia minus 20.5 0.0 0.0
Punctoribates insignis 9.1 0.0 0.0
Punctoribates hexagonus 6.8 0.0 0.0
Protoribates capucinus 13.6 0.0 0.0
Zygoribatula caspica 4.5 0.0 0.0
Zygoribatula glabra (cf.) 0.9 0.0 28.3
Zygoribatula exarata 2.3 0.0 0.0
Oribatula tibialis 2.3 0.0 0.0
Oribatella caspica (cf.) 1.0 5.3 21.7
Scheloribates laevigatus (cf.) 2.1 0.0 13.8
Acrotritia ardua 5.7 0.0 11.6
Epilohmannia styriaca 15.9 0.0 0.0
Passalozetes africanus 6.8 0.0 0.0
Sphaerochthonius splendidus 9.1 0.0 0.0
Phyllozetes emmae 4.5 0.0 0.0
Austrophthiracarus duplex (cf.) 22.7 0.0 0.0
Phthiracarus globosus 2.3 0.0 0.0
Pyroppia lanceolata 4.5 0.0 0.0
Eobrachychthonius latior 18.2 0.0 0.0
Haplochthonius simplex 6.8 0.0 0.0
Trichogalumna nipponica 1.4 0.0 8.5
Galumna tarsipennata 0.0 13.2 0.0
Hydrozetes lacustris parisiensis 2.3 0.0 0.0
Zetomimus furcatus 4.5 0.0 0.0
Mesotritia nuda 2.3 0.0 0.0
Xenillus moyae 4.5 0.0 0.0
Scheloribates distinctus 3.6 29.8 19.8
Liebstadia similis 2.3 0.0 0.0
Trhypochthoniellus longisetus 6.8 0.0 0.0
Sellnickochthonius immaculatus 5.7 0.9 42.6
Sellnickochthonius suecicus 11.4 0.0 0.0
Brachychthonius bimaculatus 5.0 0.0 5.6
Liochthonius lapponicus 0.7 11.4 0.0
Ramusella (Insculptoppia) furcata 1.1 0.3 8.0
Lalmoppia sp. 2.3 0.0 0.0
Suctobelbella (Flagrosuctobelba) baloghi 6.8 0.0 0.0
Suctobelbella (Ussuribata) latirostris 0.6 5.0 0.0
Suctobelbella (Suctobelbella) subcornigera 1.2 0.0 14.9
Zygoribatula undulata 1.9 77.6 3.7
Oribatula pannonica 2.3 0.0 0.0
Hydrozetes lemnae 0.2 6.1 0.0
Latilamellobates naltschicki 2.3 0.0 0.0
Trichoribates berlesei 9.7 0.0 1.4
Eupelops plicatus 0.0 6.7 0.0
Malaconothrus monodactylus 0.0 13.3 0.0
Tectocepheus sarekensis 0.2 1.2 15.7
Pilogalumna tenuiclava 0.0 20.0 0.0
Pergalumna obvia 0.0 12.2 0.9
Brachychthonius berlesei 10.4 0.0 0.8
Galumna sp. 0.0 0.0 10.0
Punctoribates tschernovi 0.0 0.0 10.0
Xenillus tegeocranus 11.4 0.0 0.0
Oppia denticulata 11.4 0.0 0.0
Microzetorchestes emeryi 2.3 0.0 0.0
Galumna dimorpha 2.3 0.0 0.0
Ramusella clavipectinata 9.1 0.0 0.0
Banksinoma sp. 2.3 0.0 0.0

Вопрос 10

  1. Как кластеризуется население почвенных клещей (Oribatida, Mesostigmata порознь и вместе) отдельных проб? Т.е. собираются ли в кластеры выборки из отдельных биотопов-синузий, а комплексы отдельных типов берега?

— Да, должны, но все бывает… Выборки под всеми рогозами (с плотной дерниной, на песчаном и галечном пляжах) могут собраться в один кластер.

par.default <- par()
d1.bc <- vegan::vegdist(as.data.frame(t(dfw[,-1])), method = "bray", binary = FALSE)
d1.cs <- vegan::vegdist(as.data.frame(t(dfw[,-1])), method = "bray", binary = TRUE)
d0.bc <- vegan::vegdist(as.data.frame(t(dfw0[,-1])), method = "bray", binary = FALSE)
d0.cs <- vegan::vegdist(as.data.frame(t(dfw0[,-1])), method = "bray", binary = TRUE)

#general, numeric
c0.bc <- hclust(d0.bc, method  = "ward.D2") 
c0.bc_labs <- labs %>% 
    transmute(id = substr(id, 1, nchar(id)-1), plants.d, substrate, soil) %>% 
    left_join(tibble(id = labels(c0.bc)), ., by = "id") %>% 
    group_by(id) %>% 
    mutate_at(vars(-id), collapse_labels) %>% 
    ungroup() %>% 
    distinct() %>% 
    mutate(substr.color = colorise_labels(.$substrate), 
           soil.color   = colorise_labels(.$soil))

#general, binary
c0.cs <- hclust(d0.cs, method  = "ward.D2") 
c0.cs_labs <- labs %>% 
    transmute(id = substr(id, 1, nchar(id)-1), plants.d, substrate, soil) %>% 
    left_join(tibble(id = labels(c0.cs)), ., by = "id") %>% 
    group_by(id) %>% 
    mutate_at(vars(-id), collapse_labels) %>% 
    ungroup() %>% 
    distinct() %>% 
    mutate(substr.color = colorise_labels(.$substrate), 
           soil.color   = colorise_labels(.$soil))

#local, numeric
c1.bc <- hclust(d1.bc, method  = "ward.D2") 
c1.bc_labs <- labs %>% 
    transmute(id, plants.d, substrate, soil) %>% 
    left_join(tibble(id = labels(c1.bc)), ., by = "id") %>% 
    group_by(id) %>% 
    mutate_at(vars(-id), collapse_labels) %>% 
    ungroup() %>% 
    distinct() %>% 
    mutate(substr.color = colorise_labels(.$substrate), 
           soil.color   = colorise_labels(.$soil))

#local, binary
c1.cs <- hclust(d1.cs, method  = "ward.D2") 
c1.cs_labs <- labs %>% 
    transmute(id, plants.d, substrate, soil) %>% 
    left_join(tibble(id = labels(c1.cs)), ., by = "id") %>% 
    group_by(id) %>% 
    mutate_at(vars(-id), collapse_labels) %>% 
    ungroup() %>% 
    distinct() %>% 
    mutate(substr.color = colorise_labels(.$substrate), 
           soil.color   = colorise_labels(.$soil))

Почва

Объединенные данные, количественные

par(mar=c(3,3,1,13))
c0.bc %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c0.bc_labs$id, "_", c0.bc_labs$soil)) %>% 
    set("labels_colors", c0.bc_labs$soil.color) %>% 
    plot(horiz = TRUE)

Объединенные данные, бинарные

c0.cs %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c0.cs_labs$id, "_", c0.cs_labs$soil)) %>% 
    set("labels_colors", c0.cs_labs$soil.color) %>% 
    plot(horiz = TRUE)

Дробные данные, количественные

par(mar=c(3,3,1,13), cex = 0.7)
c1.bc %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c1.bc_labs$id, "_", c1.bc_labs$soil)) %>% 
    set("labels_colors", c1.bc_labs$soil.color) %>% 
    plot(horiz = TRUE)

Дробные данные, бинарные

par(mar=c(3,3,1,13), cex = 0.7)
c1.cs %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c1.cs_labs$id, "_", c1.cs_labs$soil)) %>% 
    set("labels_colors", c1.cs_labs$soil.color) %>% 
    plot(horiz = TRUE)

Субстрат

Объединенные данные, количественные

c0.bc %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c0.bc_labs$id, "_", c0.bc_labs$substrate)) %>% 
    set("labels_colors", c0.bc_labs$substr.color) %>% 
    plot(horiz = TRUE)

Объединенные данные, бинарные

c0.cs %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c0.cs_labs$id, "_", c0.cs_labs$substrate)) %>% 
    set("labels_colors", c0.cs_labs$substr.color) %>% 
    plot(horiz = TRUE)

Дробные данные, количественные

par(mar=c(3,3,1,13), cex = 0.7)
c1.bc %>% 
    as.dendrogram() %>%
    set("labels", paste0(c1.bc_labs$id, "_", c1.bc_labs$substrate)) %>% 
    set("labels_colors", c1.bc_labs$substr.color) %>% 
    plot(horiz = TRUE)

Дробные данные, бинарные

par(mar=c(3,3,1,13), cex = 0.7)
c1.cs %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c1.cs_labs$id, "_", c1.cs_labs$substrate)) %>% 
    set("labels_colors", c1.cs_labs$substr.color) %>% 
    plot(horiz = TRUE)

Синузии

Объединенные данные, количественные

c0.bc %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c0.bc_labs$id, "_", c0.bc_labs$plants.d)) %>% 
    plot(horiz = TRUE)

Объединенные данные, бинарные

c0.cs %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c0.cs_labs$id, "_", c0.cs_labs$plants.d)) %>% 
    plot(horiz = TRUE)

Дробные данные, количественные

par(mar=c(3,3,1,13), cex = 0.7)
c1.bc %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c1.bc_labs$id, "_", c1.bc_labs$plants.d)) %>% 
    plot(horiz = TRUE)

Дробные данные, бинарные

par(mar=c(3,3,1,13), cex = 0.7)
c1.cs %>% 
    as.dendrogram() %>% 
    set("labels", paste0(c1.cs_labs$id, "_", c1.cs_labs$plants.d)) %>% 
    plot(horiz = TRUE)

dev.off() 
## null device 
##           1

Вопрос 10а

Примечание. Вы попросили выяснить “как кластеризуются …”, что подразумевает кластерный анализ. Но представление многомерных данных “съедает”, на мой взгляд, слишком много информации, поэтому я взял на себя смелость сделать ещё и ординацию. Тут тоже можно выделять кластеры различных уровней и порядков, но не требуется предположение о дихотомическом ветвлении в классификации. На переключаемых вкладках первым идет интерактивный график, где при наведении можно посмотреть id каждой из проб. На последующих вкладках топология точек такая же, просто они визуализированы по тому или иному фактору

my.pcoa <- function(dis, df){
    pcoa1 <- ape::pcoa(dis)
    eig <- pcoa1$values$Eigenvalues
    if(min(eig)<0){ 
        eig <- eig+min(eig)*-1
    }
    eig <- round(eig/sum(eig)*100, 1)[1:2]
    df <- pcoa1$vectors %>% 
        data.frame() %>% 
        rownames_to_column("id") %>% 
        as_tibble %>% 
        select(id, Axis.1, Axis.2) %>% 
        left_join(df, by = "id")
    list(df = df, eig = eig)
}
pcoa.plot <- function(df, eig, key, tt = NULL, st = NULL){
    select(df, id, Axis.1, Axis.2, environmental = all_of(key)) %>% 
        ggplot(., aes(Axis.1, Axis.2, color = environmental, 
                      shape = environmental, fill = environmental)) + 
        geom_point() + 
        labs(x = paste0("Axis 1 (", eig[1], "%)"), 
             y = paste0("Axis 2 (", eig[2], "%)"), 
             title = tt, subtitle = st)
}

d1.bc <- vegan::vegdist(as.data.frame(t(dfw[,-1])), method = "bray", binary = FALSE)
d1.cs <- vegan::vegdist(as.data.frame(t(dfw[,-1])), method = "bray", binary = TRUE)
d0.bc <- vegan::vegdist(as.data.frame(t(dfw0[,-1])), method = "bray", binary = FALSE)
d0.cs <- vegan::vegdist(as.data.frame(t(dfw0[,-1])), method = "bray", binary = TRUE)

pcoa1.bc <- my.pcoa(d1.bc, labs)
pcoa1.cs <- my.pcoa(d1.cs, labs)
pcoa0.bc <- my.pcoa(d0.bc, c0.bc_labs)
pcoa0.cs <- my.pcoa(d0.cs, c0.cs_labs)

Дробные данные, количественные

Общая конфигурация (топология)

plotly::ggplotly(
    ggplot(pcoa1.bc[[1]], aes(Axis.1, Axis.2, color = id)) + 
        geom_point() + 
        theme(legend.position = "none") +
        labs(title = "All samples; bray-curtis similarity")
    )

тип берега

pcoa.plot(pcoa1.bc[[1]], pcoa1.bc[[2]], "coast", NULL, 
          "PCoA, bray-curtis similarity")

Субстрат

pcoa.plot(pcoa1.bc[[1]], pcoa1.bc[[2]], "substrate", NULL, 
          "PCoA, bray-curtis similarity")

Почва

pcoa.plot(pcoa1.bc[[1]], pcoa1.bc[[2]], "soil", NULL, 
          "PCoA, bray-curtis similarity")

Дробные данные, качественные

Общая конфигурация (топология)

plotly::ggplotly(
    ggplot(pcoa1.cs[[1]], aes(Axis.1, Axis.2, color = id)) + 
        geom_point() + 
        theme(legend.position = "none") +
        labs(title = "All samples; jaccard similarity")
)

тип берега

pcoa.plot(pcoa1.cs[[1]], pcoa1.cs[[2]], "coast", NULL, 
          "PCoA, jaccard similarity")

Субстрат

pcoa.plot(pcoa1.cs[[1]], pcoa1.cs[[2]], "substrate", NULL, 
          "PCoA, jaccard similarity")

Почва

pcoa.plot(pcoa1.cs[[1]], pcoa1.cs[[2]], "soil", NULL, 
          "PCoA, jaccard similarity")

Объединенные данные, количественные

Общая конфигурация (топология)

plotly::ggplotly(
    ggplot(pcoa0.bc[[1]], aes(Axis.1, Axis.2, color = id)) + 
        geom_point() + 
        theme(legend.position = "none") +
        labs(title = "United samples; bray-curtis similarity")
)

Субстрат

pcoa.plot(pcoa0.bc[[1]], pcoa0.bc[[2]], "substrate", NULL, 
          "PCoA, bray-curtis similarity")

Почва

pcoa.plot(pcoa0.bc[[1]], pcoa0.bc[[2]], "soil", NULL, 
          "PCoA, bray-curtis similarity")

Объединенные данные, качественные

Общая конфигурация (топология)

plotly::ggplotly(
    ggplot(pcoa0.cs[[1]], aes(Axis.1, Axis.2, color = id)) + 
        geom_point() + 
        theme(legend.position = "none") +
        labs(title = "United samples; jaccard similarity")
)

Субстрат

pcoa.plot(pcoa0.cs[[1]], pcoa0.cs[[2]], "substrate", NULL, 
          "PCoA, jaccard similarity")

Почва

pcoa.plot(pcoa0.cs[[1]], pcoa0.cs[[2]], "soil", NULL, 
          "PCoA, jaccard similarity")

Вопрос 11

  1. Что в большей степени «вкладывает» с структуру комплекса клещей отдельного биотопа-синузии — собственно специфика биотопа-синузии или тип берега?

— Возможны варианты. В нашем случае для такого анализа могут быть использованы только две пары серий — SmPbTu и SmSdTu (Typha australis и на гальке и на песке), а также, c натяжкой, SmPbTl и SmSdTa (потому, что Typha angustifolia, Ta, была на песке в смеси с Typha laxmannii, Tl; оба вида рогоза имеют сходную экологию и морфологию - с узкими листьями). Можно попробовать сравнить и небольшие тростниковые заросли на песчаном пляже (SmSdFn) с обширными тростниковыми зарослями (SmRsFd).

Примечаение. Пока не смог разобраться, как включить более двух факторов в одну модель, поэтому пришлось пока построить две штуки. В первой склон объясняет 13.1% дисперсии, почва 9.5%, во второй - субстрат 4.7%, тип берега 9.4%. Соответственно, 63.3% дисперсии остаются необъясненными. Но уже эти соотношения можно сравнивать, интерпретируя как разный вклад факторов в формирование структуры населения. Про синузии пока не разобрался как их стандартизировать (см. примечание 2 к п. 6). В таком виде с ними работать не получится, надо как-то сгруппировать.

labs2 <- as_tibble(left_join(data.frame(id = colnames(dfw[,-1])), labs, by = "id"))

vegan::adonis2(d1.bc ~ skew + soil + substrate + coast, data = labs2, permutations = 999)
## Permutation test for adonis under reduced model
## Terms added sequentially (first to last)
## Permutation: free
## Number of permutations: 999
## 
## vegan::adonis2(formula = d1.bc ~ skew + soil + substrate + coast, data = labs2, permutations = 999)
##          Df SumOfSqs      R2      F Pr(>F)    
## skew      2   3.8513 0.13091 5.3308  0.001 ***
## soil      3   2.8116 0.09557 2.5945  0.001 ***
## Residual 63  22.7574 0.77353                  
## Total    68  29.4203 1.00000                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
vegan::adonis2(d1.bc ~ substrate + coast, data = labs2, permutations = 999)
## Permutation test for adonis under reduced model
## Terms added sequentially (first to last)
## Permutation: free
## Number of permutations: 999
## 
## vegan::adonis2(formula = d1.bc ~ substrate + coast, data = labs2, permutations = 999)
##           Df SumOfSqs      R2      F Pr(>F)    
## substrate  1   1.3773 0.04681 3.5422  0.001 ***
## coast      2   2.7692 0.09413 3.5610  0.001 ***
## Residual  65  25.2738 0.85906                  
## Total     68  29.4203 1.00000                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1