0

早上好,

我正在使用未标记包中的 pcount() 函数对丰度进行建模,并在尝试创建表以汇总估计值、aics 等时收到错误“$ 运算符对原子向量无效”。我已阅读以前的一些帖子并已更新洞察力和 sjPlot 都使用 github 函数。我想知道是否有人可以提供帮助。

也欢迎使用此模型类型的任何其他包/功能。

mhbdata <- read.csv("http://sites.google.com/site/unmarkedinfo/home/webinars/2012-january/data/wtmatrix.csv?attredirects=0&d=1%22")
y <- apply(mhbdata[, c("c.1", "c.2", "c.3")], 1, max, na.rm = TRUE) 
elev <- mhbdata[, "elev"] 
forest <- mhbdata[, "forest"]

library("unmarked") 
mhb.y <- mhbdata[, c("c.1", "c.2", "c.3")]
mhbdata[, "length"] <- 1 / mhbdata[, "length"]
mhb.umf <-
  unmarkedFramePCount(
    y = mhb.y,
    siteCovs = data.frame(
      elev = mhbdata[, "elev"],
      forest = mhbdata[, "forest"],
      length = mhbdata[, "length"]
    ),
    obsCovs = list(duration = mhbdata[, c("dur.1", "dur.2", "dur.3")], day = mhbdata[, c("day.1", "day.2", "day.3")])
  )

obsCovs(mhb.umf) <- scale(obsCovs(mhb.umf))
siteCovs(mhb.umf)$forest <- scale(siteCovs(mhb.umf)$forest)
siteCovs(mhb.umf)$elev <- scale(siteCovs(mhb.umf)$elev)
str(mhb.umf) 

fm1 <- pcount( ~ 1 ~ 1, mhb.umf)
fm2 <- pcount( ~ 1 ~ elev, mhb.umf)
fm3 <- pcount( ~ 1 ~ forest, mhb.umf)
fm4 <- pcount( ~ 1 ~ length, mhb.umf)
fm5 <- pcount( ~ 1 ~ forest + elev, mhb.umf)
fm6 <- pcount( ~ 1 ~ forest + length, mhb.umf)
fm7 <- pcount( ~ 1 ~ elev + length, mhb.umf)
fm8 <- pcount( ~ 1 ~ forest + elev + length, mhb.umf)
fm9 <- pcount( ~ 1 ~ elev + I(elev ^ 2), mhb.umf)
fm10 <- pcount( ~ 1 ~ forest + elev + I(elev ^ 2) + length, mhb.umf)

在此先感谢,泰

4

0 回答 0