set.seed(42) # set seed for repeatability
# Data for use in example
matU <- matrix(c(
0.1, 0.0,
0.2, 0.4
), byrow = TRUE, nrow = 2)
matF <- matrix(c(
0.0, 5.0,
0.0, 0.0
), byrow = TRUE, nrow = 2)
set.seed(42)
# Example of use to calculate 95% CI of lambda
compute_ci(
mat_U = matU, mat_F = matF, sample_size = 10, FUN =
popbio::lambda
)
# Example of use to calculate 95% CI of generation time
compute_ci(
mat_U = matU, mat_F = matF, sample_size = 40, FUN =
popbio::generation.time
)
# Example of use to calculate 95% CI of generation time and show the
# distribution of those bootstrapped estimates
xx <- compute_ci(
mat_U = matU, mat_F = matF, sample_size = 100, FUN =
popbio::generation.time, dist.out = TRUE
)
summary(xx$quantiles)
hist(xx$estimates)
Run the code above in your browser using DataLab