0

popbio我想使用'sboot.transitions函数对我的数据进行引导。但是,它以某种方式给出了生育率列的奇怪错误:

stagefate = read.table("file.csv", header = TRUE, sep=",")
stagefatenames<- c("individual", "stage", "fate","fertility")
trans2.3 <- stagefate[stagefatenames]

boot2.3 <- boot.transitions(trans2.3, 100)
ci2.3 <- quantile(boot2.3$lambda, c(0.025, 0.975))
hist(boot2.3$lambda, col = "grey80", xlab = "Lambda", main = "")
abline(v = ci2.3, lty = 3)
dput(trans2.3)

50 多个错误:

Missing a fertility column with individual fertility rates

我都不太明白。我添加了一个“生育力”列,不确定它是如何看不到它以及如何解决这个问题。

顺便说一句,我的桌子是这样的:

  individual  stage     fate fertility
1          1 infant   infant         0
2          2 infant   infant         0
3          3 infant juvenile         0
4          4 infant juvenile         0
5          5 infant juvenile         0
6          6 juvenile adult          0
7          7 adult    adult          0
8          8 adult    adult          1
9          9 adult    adult          1

输入(trans2.3)

structure(list(individual = 1:9, stage = structure(c(2L, 2L, 
2L, 2L, 2L, 3L, 1L, 1L, 1L), .Label = c("adult", "infant", "juvenile"
), class = "factor"), fate = structure(c(2L, 2L, 3L, 3L, 3L, 
1L, 1L, 1L, 1L), .Label = c("adult", "infant", "juvenile"), class = 
"factor"), 
    fertility = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L)), row.names = c(NA, 
-9L), class = "data.frame")

编辑:数据格式不正确,这修复了之前的一个错误(错误排序矩阵)。

然而,生育错误仍然存​​在。无论如何,它给出了一些输出,我觉得这很奇怪,可能是由生育错误引起的。我输入的任何数据在引导后的置信区间始终低于 1,这很奇怪,因为我们计算的 lambda 从未如此低。

4

0 回答 0