Without further wrangling, the current structure of the faintCompare object only allows extracting one summary statistic at a time. I think it would be more convenient if we stored the values in a data frame so that extraction can be done in one go. Also, the object does not contain the posterior samples used for comparison. While not strictly necessary for the purpose of the function, we might still want to include them to save additional calls to extract_cell_draws in case the samples are actually needed (e.g., for plotting or testing).
The object could have this structure:
> x <- compare_groups(fit, gender == "F", gender == "M")
> x %>% str()
List of 3
$ hdi : num 0.95
$ comparison:'data.frame': 1 obs. of 7 variables:
..$ higher : chr "gender == \"F\""
..$ lower : chr "gender == \"M\""
..$ mean_diff: num 108
..$ l_ci : num 95.4
..$ u_ci : num 122
..$ post_prob: num 1
..$ post_odds: num Inf
$ samples :List of 2
..$ higher: draws_df [400 x 4] (S3: draws_df/draws/tbl_df/tbl/data.frame)
.. ..$ draws : num [1:400] 251 248 246 249 245 ...
.. ..$ .chain : int [1:400] 1 1 1 1 1 1 1 1 1 1 ...
.. ..$ .iteration: int [1:400] 1 2 3 4 5 6 7 8 9 10 ...
.. ..$ .draw : int [1:400] 1 2 3 4 5 6 7 8 9 10 ...
..$ lower : draws_df [400 x 4] (S3: draws_df/draws/tbl_df/tbl/data.frame)
.. ..$ draws : num [1:400] 134 150 132 143 143 ...
.. ..$ .chain : int [1:400] 1 1 1 1 1 1 1 1 1 1 ...
.. ..$ .iteration: int [1:400] 1 2 3 4 5 6 7 8 9 10 ...
.. ..$ .draw : int [1:400] 1 2 3 4 5 6 7 8 9 10 ...
- attr(*, "class")= chr "faintCompare"
Sounds good. - If we should be worried about object size, we might include an option like "include_samples" defaulting to TRUE but allowing to not have the posterior samples included.
Without further wrangling, the current structure of the
faintCompare
object only allows extracting one summary statistic at a time. I think it would be more convenient if we stored the values in a data frame so that extraction can be done in one go. Also, the object does not contain the posterior samples used for comparison. While not strictly necessary for the purpose of the function, we might still want to include them to save additional calls toextract_cell_draws
in case the samples are actually needed (e.g., for plotting or testing).The object could have this structure: