r - 物种丰富度的 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")
此外,我对这个网站非常陌生,并尽我所能以可用的格式分享我的代码和数据,但如果有更好的方法,请纠正我。谢谢!
解决方案
推荐阅读
- c# - Xamarin MPMusicPlayerController.NowPlayingItem:动态注册器已被链接掉
- c - Bootsplash 内核
- angularjs - Angular JS - 过滤表行基于从多个下拉列表中的选择
- java - 如何在两个 JTable 之间同步选择、排序和过滤
- python - 用于批次的 TensorFlow 成对点积
- javascript - 使用 NPM Python Shell 回调 Electron
- oauth-2.0 - “同意申请”和“添加委托权限授予”有什么区别?
- azure - Azure Cosmos DB 在存储过程中解码 base64
- python - 如何解决“pygame.init()”错误?
- javascript - 如何在node.js中提取标签的href