使用分类环境级别的 mvabund 第四角模型

问题描述 投票:0回答:1

mvabund::traitglm()
内使用分类R矩阵而不是连续环境变量是否合适?我对 MHW 时期(之前、期间、之后)和营养生态之间的相互作用对多元群落的类群丰富度的影响感兴趣。在使用 L(分类丰度数据)、R(环境数据)和 Q(物种性状)的典型第四角模型中,R 矩阵定义与每个观测值相关的环境变量。在本例中,我将 R 视为事件之前、期间和之后进行的观察。模型运行并且 swath_mod$fourth 似乎反映了预期趋势,但我不确定当环境矩阵 R 不连续时这是否是
traitglm()
的适当使用。

这是我的 L、R 和 Q 矩阵。

swath_L <- structure(list(pisaster_brevispinus = c(0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), pterygophora_californica = c(61, 
22, 0, 0, 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 70, 54, 15, 
0, 0, 4, 0, 17), eisenia_arborea = c(5, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), macrocystis_pyrifera = c(47, 
225, 0, 184, 69, 10, 0, 0, 261, 29, 165, 2, 275, 0, 185, 13, 
53, 49, 7, 54, 0, 0, 83, 322, 1), pisaster_giganteus = c(0, 4, 
1, 7, 2, 3, 4, 1, 9, 0, 5, 3, 1, 1, 3, 5, 3, 7, 1, 4, 0, 0, 5, 
15, 0), stephanocystis_osmundacea = c(0, 34, 0, 71, 14, 0, 0, 
0, 14, 5, 19, 2, 3, 0, 11, 2, 8, 0, 33, 11, 0, 2, 2, 11, 0), 
    strongylocentrotus_purpuratus = c(6, 1, 924, 0, 15, 7, 1818, 
    108, 3, 19, 1, 126, 2, 1671, 2, 952, 2, 46, 5, 0, 376, 365, 
    0, 0, 174), mesocentrotus_franciscanus = c(0, 0, 96, 0, 0, 
    5, 31, 80, 1, 1, 0, 11, 0, 133, 0, 73, 0, 0, 1, 1, 8, 42, 
    0, 0, 0), patiria_miniata = c(167, 82, 17, 83, 34, 99, 2, 
    24, 88, 9, 73, 24, 20, 12, 68, 23, 188, 80, 8, 39, 18, 44, 
    17, 49, 9), tethya_californiana = c(26, 22, 2, 8, 28, 6, 
    0, 5, 8, 0, 0, 9, 0, 0, 0, 0, 2, 13, 0, 61, 0, 0, 11, 0, 
    0), kelletia_kelletii = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0), orthasterias_koehleri = c(0, 
    1, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 
    0, 0, 0, 0, 0), pisaster_ochraceus = c(0, 0, 0, 0, 0, 0, 
    3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0), 
    pycnopodia_helianthoides = c(1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 
    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0), loxorhynchus_grandis = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0), neobernaya_spadicea = c(0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 
    cancridae = c(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 1, 0, 0, 1, 0, 0, 0), lytechinus_pictus = c(0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0), dermasterias_imbricata = c(4, 4, 1, 0, 2, 1, 
    0, 0, 3, 0, 0, 0, 0, 4, 0, 0, 1, 2, 1, 1, 0, 0, 0, 4, 0), 
    crassadoma_gigantea = c(0, 0, 0, 0, 0, 1, 2, 478, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1), henricia_leviuscula = c(2, 
    4, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 4, 3, 0, 2, 
    0, 0, 1, 0, 3), nereocystis_luetkeana = c(0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 11, 2, 0, 0, 0, 0, 
    65), pomaulax_gibberosus = c(0, 0, 4, 5, 8, 5, 0, 18, 0, 
    0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 11, 0, 21, 1, 0, 0), aplysia_californica = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0), cryptochiton_stelleri = c(1, 1, 1, 1, 0, 
    0, 1, 0, 3, 0, 9, 6, 9, 1, 1, 5, 1, 0, 0, 1, 2, 43, 1, 3, 
    0), mediaster_aequalis = c(5, 0, 0, 0, 5, 2, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0), loxorhynchus_crispatus_scyra_acutifrons = c(0, 
    1, 0, 3, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 1, 1, 
    2, 3, 0, 1, 1), stylaster_californicus = c(0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0), haliotis_rufescens = c(0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 
    0, 4, 0, 0, 0, 9, 0, 3, 2, 0, 1, 1, 0, 2, 1), metridium = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0), megathura_crenulata = c(0, 0, 0, 0, 0, 0, 
    2, 0, 0, 0, 0, 3, 0, 1, 0, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0), 
    alaria_marginata = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), anthopleura_sola = c(0, 
    0, 0, 51, 0, 0, 0, 0, 5, 1, 9, 0, 0, 0, 2, 1, 0, 0, 0, 0, 
    5, 8, 0, 0, 0), pugettia_producta = c(0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), megastraea_undosa = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0), anthopleura_xanthogrammica = c(0, 0, 0, 0, 
    0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 
    0, 0), pugettia_richii = c(1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 
    0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), costaria_costata = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 1), cucumaria_miniata = c(5, 0, 0, 0, 0, 2, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 3, 0), cribrinopsis_albopunctata = c(14, 
    0, 28, 0, 3, 15, 0, 2, 0, 0, 0, 1, 0, 3, 0, 0, 1, 67, 12, 
    0, 0, 0, 0, 0, 0), ceratostoma_foliatum = c(2, 1, 4, 0, 1, 
    0, 23, 0, 0, 3, 0, 5, 9, 5, 0, 0, 0, 0, 0, 3, 0, 2, 0, 0, 
    1), pugettia_foliata = c(0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0), styela_montereyensis = c(0, 
    0, 0, 0, 0, 1, 2, 0, 13, 1, 9, 0, 0, 0, 0, 0, 0, 1, 15, 0, 
    1, 0, 1, 2, 5), apostichopus_parvimensis = c(0, 0, 0, 1, 
    0, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 
    0, 0), apostichopus_californicus = c(0, 0, 0, 0, 0, 1, 0, 
    4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0), laminaria_setchellii = c(2, 
    0, 0, 0, 15, 1, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 28, 139, 
    0, 3, 0, 0, 0, 405), balanus_nubilus = c(0, 0, 21, 0, 0, 
    0, 534, 15, 0, 3, 0, 2, 116, 130, 0, 29, 0, 0, 0, 0, 0, 3, 
    0, 19, 49), laminaria_farlowii = c(0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), pleurophycus_gardneri = c(3, 
    0, 0, 0, 4, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 1, 
    0, 0, 0, 0, 0), pachycerianthus_fimbriatus = c(0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0), haliotis_walallensis = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), haliotis_kamtschatkana = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0), linckia_columbiae = c(0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), solaster_dawsoni = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0), craniella_arb = c(0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), aplysia_vaccaria = c(0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0), cryptolithodes_sitchensis = c(0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0), leptasterias_hexactis = c(0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), urticina = c(0, 
    0, 0, 0, 4, 6, 0, 3, 0, 0, 3, 0, 0, 0, 0, 2, 6, 0, 2, 1, 
    0, 0, 0, 0, 0)), row.names = c(NA, -25L), class = "data.frame")

swath_R <- structure(list(MHW = c("before", "before", "after", "before", 
"after", "after", "before", "before", "after", "during", "during", 
"before", "before", "before", "before", "before", "during", "before", 
"before", "during", "before", "before", "before", "before", "before"
)), row.names = c(NA, -25L), class = "data.frame")

swath_Q <- structure(list(trophic_ecology = structure(c(4L, 1L, 1L, 1L, 
4L, 1L, 3L, 2L, 2L, 6L, 4L, 4L, 4L, 4L, 4L, 5L, 4L, 3L, 5L, 6L, 
5L, 1L, 3L, 3L, 3L, 5L, 2L, 6L, 2L, 6L, 3L, 1L, 6L, 3L, 3L, 6L, 
3L, 1L, 6L, 5L, 5L, 3L, 6L, 2L, 2L, 1L, 6L, 1L, 1L, 6L, 2L, 2L, 
2L, 4L, 6L, 3L, 5L, 4L, 6L), levels = c("Autotroph", "Detritivore (algal)", 
"Herbivore", "Macroinvertivore", "Microinvertivore", "Planktivore"
), class = "factor")), row.names = c("pisaster_brevispinus", 
"pterygophora_californica", "eisenia_arborea", "macrocystis_pyrifera", 
"pisaster_giganteus", "stephanocystis_osmundacea", "strongylocentrotus_purpuratus", 
"mesocentrotus_franciscanus", "patiria_miniata", "tethya_californiana", 
"kelletia_kelletii", "orthasterias_koehleri", "pisaster_ochraceus", 
"pycnopodia_helianthoides", "loxorhynchus_grandis", "neobernaya_spadicea", 
"cancridae", "lytechinus_pictus", "dermasterias_imbricata", "crassadoma_gigantea", 
"henricia_leviuscula", "nereocystis_luetkeana", "pomaulax_gibberosus", 
"aplysia_californica", "cryptochiton_stelleri", "mediaster_aequalis", 
"loxorhynchus_crispatus_scyra_acutifrons", "stylaster_californicus", 
"haliotis_rufescens", "metridium", "megathura_crenulata", "alaria_marginata", 
"anthopleura_sola", "pugettia_producta", "megastraea_undosa", 
"anthopleura_xanthogrammica", "pugettia_richii", "costaria_costata", 
"cucumaria_miniata", "cribrinopsis_albopunctata", "ceratostoma_foliatum", 
"pugettia_foliata", "styela_montereyensis", "apostichopus_parvimensis", 
"apostichopus_californicus", "laminaria_setchellii", "balanus_nubilus", 
"laminaria_farlowii", "pleurophycus_gardneri", "pachycerianthus_fimbriatus", 
"haliotis_walallensis", "haliotis_kamtschatkana", "linckia_columbiae", 
"solaster_dawsoni", "craniella_arb", "aplysia_vaccaria", "cryptolithodes_sitchensis", 
"leptasterias_hexactis", "urticina"), class = "data.frame")

这是traitglm模型

swath_mod<- traitglm(swath_L, swath_R, swath_Q,
                         method="glm1path", family = "negative.binomial")
r glm multivariate-testing
1个回答
0
投票

是的,你可以做到这一点,如果你为 R 提供数据框输入,那么你可以得到分类或定量。更多详情请前往github

© www.soinside.com 2019 - 2024. All rights reserved.