首页 > 解决方案 > 物种丰富度的 GLM

问题描述

我确信这是一个相对简单的问题,但我正在使用已经创建的 glm 来查看蜜蜂丰度与花卉可用性等。我想重新运行分析,查看物种丰富度而不是丰度。我假设我可以交换数量以换取丰富性,但是如何为此重写代码?

这是我正在使用的 glm:

m2=glm(count~floral.availability+native.exotic/plant.species+datj,
family=poisson, data=dat)

这里有几行数据:

structure(list(date = structure(c(4L, 4L, 4L, 4L, 4L, 4L), .Label = c("10/17/19", 
"2/8/20", "3/13/20", "6/12/19", "6/19/19", "7/17/19", "7/26/19", 
"7/3/19", "7/31/19", "8/12/19", "8/16/19", "8/20/19"), class = "factor"), 
    site = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "main post", class = "factor"), 
    visitor.species = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("", 
    "A. mellifera", "A. texanus", "B. californicus ", "B. melanopygus", 
    "B. vosnesenskii", "L. pilosum", "Lasioglossum sp"), class = "factor"), 
    count = c(0L, 0L, 0L, 0L, 0L, 0L), native.exotic = structure(c(1L, 
    2L, 2L, 1L, 1L, 2L), .Label = c("exotic", "native"), class = "factor"), 
    plant.species = structure(1:6, .Label = c("Abelia grandiflora", 
    "Baccharis pilularis", "Ceanothus thyrsiflorus", "Cistus purpureus ", 
    "Correa pulchella", "Frangula californica ", "Grevillia lanigera", 
    "Hebe speciosa", "Heteromeles arbutifolia", "Ribes sanguineum", 
    "Salvia officinalis"), class = "factor"), floral.availability = c(75L, 
    0L, 0L, 25L, 12L, 0L)), row.names = c(NA, 6L), class = "data.frame")

此外,我对这个网站非常陌生,并尽我所能以可用的格式分享我的代码和数据,但如果有更好的方法,请纠正我。谢谢!

标签: rglmmixed-models

解决方案


推荐阅读