I wanna do bootstrapping on my data using popbio
's boot.transitions
function. However, it is somehow giving a weird error with the fertility column:
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+ errors:
Missing a fertility column with individual fertility rates
Which I both don't really understand. I have added a column 'fertility', not sure how it's not seeing it and how to fix this.
Btw, my table looks like this:
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
dput(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")
edit: The data wasn't in the right format, and this fixed one previous error (error sorting matrix).
However the fertility error still persists. Anyway it is giving some output, which i find really strange and will probably be caused by the fertility error. The confidence intervals after bootstrapping for any data i put in are always under the value of 1, which is strange as our lambda's we calculate are never this low.