This function simulates uniformly distributed birth times for a specified number of individuals from a provided vector

simulate_birth_times(N, times, age_min = 0)

Arguments

N

The number of individuals in the simulation

times

A vector of each time step in the simulation

age_min

A number matching the time resolution of times giving the youngest age possible by the end of the simulation; defaults to 0 which means individuals can be born up until the penultimate time step

Value

A vector of simulated birth times for each individual

See also

Examples

## Simulate random birth times for 500 individuals over 100 time steps and ensures 
## that all individuals are above 9 time steps old by the last time step
simulate_birth_times(500, 1:100, age_min=9) 
#>   [1] 47 90 82 62 89 50 27 23 69 30 44 67 79 58 44 37 80 44 67 83 76 14 21 38 58
#>  [26]  1 90 42 11 67 49 28 31 23 79  6 51 75 22 67  4 75 59 27  1 75 26 63  2 26
#>  [51]  7 47 17 55 83  1 33 39 15 43 64 82 10 42 63 65 51 90 85 90 70 16 14 54 41
#>  [76]  5 58 87 60 32  6 52 84  1 73 37 26 68 56 50 68 61 70 74 87 45 18 20 85 43
#> [101] 27 23 71 54 74  3 76 53 19 87 69 78 47 31 37 80 25 82 71 65 32 70 38 87 48
#> [126] 34 45  8 74 39 89 77  3 23 80 13 24 18 78 51 21  2 16 42 31 47 65 50 55 52
#> [151] 67 19 88 36 31 66 38 28  2 42 80 87 61 55 41 33 53 89 65 78 76 49 60 75 64
#> [176] 11 61 31 76 63 18 27 55 16 29 26  1 14 47 54 83 79 45  9  3 66 83  9 23 37
#> [201] 11 16 87 78 59 55 77 15 29 57 72  8 69 51 26 37 56 18  6 79 11 55 82 68 18
#> [226]  6 46 43 77 76 73 31 19 37  5 90 40 66 49 21 68 19 72 79 32 25 80 37 40 57
#> [251]  2 17 13 65 72 84  2 32 56 11 53 50 87 60  2 28 11 72 36 12 42 64 82 81 71
#> [276] 26 42 22 29 85 86 32 51 58 15 66 81 72 56 80 82 61 16 87 61 49 23 45 18 70
#> [301] 68 58 44 23 54 43 67 31 21 38 57 40  2 68 58 26 66 21 78 71  5 87 11 18  9
#> [326] 78 89  7 62 67 15 12 52  7 23 73 21 41  1 89 58 20 20 63 55 67 18 50  1 22
#> [351]  4  5 69 70  9 39  4 15 63 73 24 17 37 79 42 43 81 87 41 46 78 84 59 47 17
#> [376] 65 78 38 76 47 82 80 90 16 18 61 74 28 49  1 46 63 67 75 29 15 21  3 26 71
#> [401] 31 25 25 35 37 38 68 84 68 72 75 53 15 54 62 70 83 46 73 53 72  4 61 34 33
#> [426] 68 28 82 16 63 35  1  4 86 57 12  5 88 24 21 47 30 74 43 55  9 73 45 35 70
#> [451] 89 55 68 14 76 90 10  5 38 43 32 41 31 27 36 64 40  5 25 49 26 15 15  3 84
#> [476]  5 45 88 66 31 20 51 64 82 66 44 71 68 18 84  9 89 85 30 69 60 41  9 49 35