在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")
型
1条答案
按热度按时间fbcarpbf1#
是的,你可以这样做,如果你给予R的数据框输入,那么你可以有分类或定量。更多细节请访问github