Last compiled: 2022-04-26
How many bootstraps is enough to estimate CIs around lambda?
::with_dir(here::here(), tar_load(c(
withr
ipm_det_cf,
ipm_det_ff,
ipm_stoch_cf,
ipm_stoch_ff,
lambda_bt_det_cf,
lambda_bt_det_ff,
lambda_bt_stoch_cf,
lambda_bt_stoch_ff )))
## Attempting to load the environment 'package:ipmr'
## It looks like you've installed the development vesrion of ipmr from the repository 'levisc8/ipmr'.
## ipmr will soon be moving to the padrinoDB Github organization.
## In the future, you will need to install the development version from there.
## remotes::install_github('padrinoDB/ipmr')
<- lambda(ipm_det_cf)
est <- seq_along(lambda_bt_det_cf) %>%
df map_df(~bcpi(t0 = est, t = lambda_bt_det_cf[1:.x]), .id = "B") %>%
mutate(B = as.numeric(B))
ggplot(df,aes(x = B)) +
geom_line(aes(y = lower), color = "red") +
geom_line(aes(y = upper), color = "blue")
Looks like it does converge after like 200 bootstraps
<- lambda(ipm_det_ff)
est <- seq_along(lambda_bt_det_ff) %>%
df map_df(~bcpi(t0 = est, t = lambda_bt_det_ff[1:.x]), .id = "B") %>%
mutate(B = as.numeric(B))
ggplot(df,aes(x = B)) +
geom_line(aes(y = lower), color = "red") +
geom_line(aes(y = upper), color = "blue")
<- lambda(ipm_stoch_cf, log = FALSE)
est <- seq_along(lambda_bt_stoch_cf) %>%
df map_df(~bcpi(t0 = est, t = lambda_bt_stoch_cf[1:.x]), .id = "B") %>%
mutate(B = as.numeric(B))
ggplot(df,aes(x = B)) +
geom_line(aes(y = lower), color = "red") +
geom_line(aes(y = upper), color = "blue")
For stochastic it does take longer. Why the sudden leaps for the upper limit?
<- lambda(ipm_stoch_ff, log = FALSE)
est <- seq_along(lambda_bt_stoch_ff) %>%
df map_df(~bcpi(t0 = est, t = lambda_bt_stoch_ff[1:.x]), .id = "B") %>%
mutate(B = as.numeric(B))
ggplot(df,aes(x = B)) +
geom_line(aes(y = lower), color = "red") +
geom_line(aes(y = upper), color = "blue")