A short description of the post.
suppressPackageStartupMessages(library(rethinking))
data("reedfrogs")
head(reedfrogs)
density pred size surv propsurv
1 10 no big 9 0.9
2 10 no big 10 1.0
3 10 no big 7 0.7
4 10 no big 10 1.0
5 10 no small 9 0.9
6 10 no small 9 0.9
using the model described here
unique(reedfrogs$density)
[1] 10 25 35
library(tidyverse)
logit_average_survival <- rnorm(1, mean = 0, sd = 1)
logit_sd_survival <- rexp(1, rate = 1)
reedfrogs |>
select(density) |>
mutate(logit_tank_surv = rnorm(length(density), mean = logit_average_survival, sd = logit_sd_survival))
density logit_tank_surv
1 10 -1.335524
2 10 -1.277999
3 10 -1.355838
4 10 -1.353502
5 10 -1.362266
6 10 -1.338766
7 10 -1.340498
8 10 -1.299335
9 10 -1.356863
10 10 -1.358920
11 10 -1.505802
12 10 -1.400428
13 10 -1.386897
14 10 -1.350286
15 10 -1.329579
16 10 -1.422029
17 25 -1.359439
18 25 -1.433124
19 25 -1.334523
20 25 -1.412781
21 25 -1.420665
22 25 -1.368886
23 25 -1.391480
24 25 -1.368529
25 25 -1.309513
26 25 -1.381868
27 25 -1.365324
28 25 -1.328151
29 25 -1.381126
30 25 -1.363846
31 25 -1.285698
32 25 -1.356013
33 35 -1.455749
34 35 -1.374884
35 35 -1.329634
36 35 -1.354929
37 35 -1.320607
38 35 -1.365575
39 35 -1.353362
40 35 -1.349175
41 35 -1.378484
42 35 -1.318553
43 35 -1.384873
44 35 -1.359884
45 35 -1.405353
46 35 -1.367551
47 35 -1.384558
48 35 -1.345401
data.frame(y = letters) |>
mutate(ff = rnorm(1))
y ff
1 a 0.2052047
2 b 0.2052047
3 c 0.2052047
4 d 0.2052047
5 e 0.2052047
6 f 0.2052047
7 g 0.2052047
8 h 0.2052047
9 i 0.2052047
10 j 0.2052047
11 k 0.2052047
12 l 0.2052047
13 m 0.2052047
14 n 0.2052047
15 o 0.2052047
16 p 0.2052047
17 q 0.2052047
18 r 0.2052047
19 s 0.2052047
20 t 0.2052047
21 u 0.2052047
22 v 0.2052047
23 w 0.2052047
24 x 0.2052047
25 y 0.2052047
26 z 0.2052047