Testing sampling designs for selecting samples for age and growth of fishes. This is a IBM to generate a population and catch from the population to test sampling approaches of POS or FOS, sample size, supplemental sampling, and constraining or not constraining t0. It uses a von Bertalanffy growth function.

Examples


S1_Auric_lowF <- simulate_population_harvest(Linf = 32.5, Linf_sd = 2.5,
                                             M = 0.18, F = 0.09, Lorenzen = TRUE,
                                             mincat = 10, catsd = 2.5, maxcat = 200, maxcatsd = 0,
                                             L0 = 10, L0_sd = 2.5, k = 0.6, k_sd = 0,
                                             Amax = 32, age_max = 15, N = 100000)

summary(S1_Auric_lowF$harvest$length)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   15.59   26.18   29.67   29.04   32.37   41.92 
str(S1_Auric_lowF$harvest$length)
#>  num [1:14701] 19.5 19.7 20.1 20.7 20.6 ...
S1_hist_length_harv <- hist(S1_Auric_lowF$harvest$length, breaks = seq(0,50,2),include.lowest=TRUE, right=FALSE,plot=FALSE)

#####  A. S1_Auric_lowF#######
#FOS examples with differing sample size, constained vs unconstrained, supplemental samples added
S1_A1 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                   sample_type = 'FOS', supp_large = FALSE, supp_small = FALSE, constrained = FALSE,
                   save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A2 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                   sample_type = 'FOS', supp_large = FALSE, supp_small = FALSE, constrained = FALSE,
                   save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A3 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                   sample_type = 'FOS', supp_large = FALSE, supp_small = FALSE, constrained = TRUE,
                   save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A4 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                   sample_type = 'FOS', supp_large = FALSE, supp_small = FALSE, constrained = TRUE,
                   save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A5 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                   sample_type = 'FOS', supp_large = FALSE, supp_large_n_per_bin = 3,
                   supp_small = TRUE, constrained = FALSE, supp_small_n_per_bin = 3,
                   supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A6 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                   sample_type = 'FOS', supp_large = FALSE, supp_large_n_per_bin = 3,
                   supp_small = TRUE, constrained = FALSE, supp_small_n_per_bin = 3,
                   supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A7 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                   sample_type = 'FOS', supp_large = FALSE, supp_large_n_per_bin = 3,
                   supp_small = TRUE, constrained = TRUE, supp_small_n_per_bin = 3,
                   supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A8 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                   sample_type = 'FOS', supp_large = FALSE, supp_large_n_per_bin = 3,
                   supp_small = TRUE, constrained = TRUE, supp_small_n_per_bin = 3,
                   supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

#POS examples with differing sample size, constained vs unconstrained, supplemental samples added
S1_A9 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                   sample_type = 'POS', supp_large = FALSE, supp_small = FALSE, constrained = FALSE,
                   save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A10 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = FALSE, supp_small = FALSE, constrained = FALSE,
                    save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A11 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                    sample_type = 'POS', supp_large = FALSE, supp_small = FALSE, constrained = TRUE,
                    save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A12 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = FALSE, supp_small = FALSE, constrained = TRUE,
                    save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A13 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = FALSE, constrained = FALSE,
                    save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A14 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = FALSE, constrained = FALSE,
                    save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A15 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = FALSE, constrained = TRUE,
                    save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A16 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = FALSE, constrained = TRUE,
                    save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A17 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                    sample_type = 'POS', supp_large = FALSE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = FALSE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A18 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = FALSE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = FALSE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A19 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                    sample_type = 'POS', supp_large = FALSE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = TRUE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A20 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = FALSE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = TRUE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A21 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = FALSE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A22 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = FALSE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A23 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 300,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = TRUE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"

S1_A24 <- LH_sample(sim_output = S1_Auric_lowF, n_boots = 1000, samp_size = 75,
                    sample_type = 'POS', supp_large = TRUE, supp_large_n_per_bin = 3,
                    supp_small = TRUE, constrained = TRUE, supp_small_n_per_bin = 3,
                    supp_min_length = 10, save_bootstraps = TRUE,  Lbin_width = 2)
#> [1] "2022-09-29 12:27:14 HST"
#> Error in population_harv %>% group_by(binL) %>% mutate(prop = n()) %>%     group_by() %>% mutate(n = sum(n())) %>% mutate(propL = prop/n): could not find function "%>%"