Wrap named analysis groups so downstream shift-magnitude verbs know to run
once per group rather than pooling every input into one result. Each group
can be a transition table, BMM bifrost_search object, list of runs to pool,
or a precomputed shift-magnitude object accepted by the downstream verb. When
grouped inputs include precomputed shift_magnitude_comparison objects,
compare_shift_magnitudes() requires their stored settings to match the
settings requested for the grouped call.
Arguments
- ...
Named analysis groups. Use quoted names for labels that are not syntactic R names, such as
"GIC + BIC" = runs.- .list
Optional named list of analysis groups. Use this when groups are already stored in a list.
- labels
Optional replacement labels, one per analysis group. Defaults to names from the supplied groups, falling back to
"Analysis 1","Analysis 2", and so on when names are absent.
Examples
transitions <- data.frame(
rate_change = c("increase", "increase", "decrease", "decrease"),
rate_delta = c(2, 3, -1, -1.5)
)
groups <- shift_magnitude_groups(
"GIC + BIC" = list(gic = transitions, bic = transitions),
GIC = list(gic = transitions)
)
compare_shift_magnitudes(groups, ks_reps = 99)
#> $`GIC + BIC`
#> $values
#> rate_change raw_value source value
#> 1 increase 2.0 gic 0.6931472
#> 2 increase 3.0 gic 1.0986123
#> 3 decrease -1.0 gic 0.0000000
#> 4 decrease -1.5 gic 0.4054651
#> 5 increase 2.0 bic 0.6931472
#> 6 increase 3.0 bic 1.0986123
#> 7 decrease -1.0 bic 0.0000000
#> 8 decrease -1.5 bic 0.4054651
#>
#> $summary
#> rate_change n mean median sd min max
#> 1 increase 4 0.8958797 0.8958797 0.2340954 0.6931472 1.0986123
#> 2 decrease 4 0.2027326 0.2027326 0.2340954 0.0000000 0.4054651
#> mean_signed_raw mean_abs_raw median_abs_raw
#> 1 2.50 2.50 2.50
#> 2 -1.25 1.25 1.25
#>
#> $modal
#> mode_increase mode_decrease mode_difference linear_ratio
#> 1 0.7131033 0.01995616 0.6931472 2
#>
#> $tests
#> test statistic parameter p_value mean_increase mean_decrease mean_difference
#> 1 ks 1 NA 0.04 0.8958797 0.2027326 0.6931472
#> median_increase median_decrease median_difference conf_low conf_high
#> 1 0.8958797 0.2027326 0.6931472 NA NA
#> method bootstrap_mean_p bootstrap_R
#> 1 Monte-Carlo two-sample Kolmogorov-Smirnov test NA NA
#>
#> $settings
#> $settings$measure
#> [1] "rate_delta"
#>
#> $settings$transform
#> [1] "log_absolute"
#>
#> $settings$tests
#> [1] "ks"
#>
#> $settings$alternative
#> [1] "two.sided"
#>
#> $settings$ks_simulate_p_value
#> [1] TRUE
#>
#> $settings$ks_B
#> [1] 99
#>
#> $settings$bootstrap_p_value
#> [1] FALSE
#>
#> $settings$bootstrap_R
#> [1] 100
#>
#> $settings$seed
#> NULL
#>
#>
#> attr(,"class")
#> [1] "shift_magnitude_comparison" "list"
#>
#> $GIC
#> $values
#> rate_change raw_value source value
#> 1 increase 2.0 gic 0.6931472
#> 2 increase 3.0 gic 1.0986123
#> 3 decrease -1.0 gic 0.0000000
#> 4 decrease -1.5 gic 0.4054651
#>
#> $summary
#> rate_change n mean median sd min max
#> 1 increase 2 0.8958797 0.8958797 0.2867071 0.6931472 1.0986123
#> 2 decrease 2 0.2027326 0.2027326 0.2867071 0.0000000 0.4054651
#> mean_signed_raw mean_abs_raw median_abs_raw
#> 1 2.50 2.50 2.50
#> 2 -1.25 1.25 1.25
#>
#> $modal
#> mode_increase mode_decrease mode_difference linear_ratio
#> 1 1.095835 0.002777444 1.093057 2.983382
#>
#> $tests
#> test statistic parameter p_value mean_increase mean_decrease mean_difference
#> 1 ks 1 NA 0.27 0.8958797 0.2027326 0.6931472
#> median_increase median_decrease median_difference conf_low conf_high
#> 1 0.8958797 0.2027326 0.6931472 NA NA
#> method bootstrap_mean_p bootstrap_R
#> 1 Monte-Carlo two-sample Kolmogorov-Smirnov test NA NA
#>
#> $settings
#> $settings$measure
#> [1] "rate_delta"
#>
#> $settings$transform
#> [1] "log_absolute"
#>
#> $settings$tests
#> [1] "ks"
#>
#> $settings$alternative
#> [1] "two.sided"
#>
#> $settings$ks_simulate_p_value
#> [1] TRUE
#>
#> $settings$ks_B
#> [1] 99
#>
#> $settings$bootstrap_p_value
#> [1] FALSE
#>
#> $settings$bootstrap_R
#> [1] 100
#>
#> $settings$seed
#> NULL
#>
#>
#> attr(,"class")
#> [1] "shift_magnitude_comparison" "list"
#>
#> attr(,"settings")
#> attr(,"settings")$measure
#> [1] "rate_delta"
#>
#> attr(,"settings")$transform
#> [1] "log_absolute"
#>
#> attr(,"settings")$tests
#> [1] "ks"
#>
#> attr(,"settings")$alternative
#> [1] "two.sided"
#>
#> attr(,"settings")$ks_simulate_p_value
#> [1] TRUE
#>
#> attr(,"settings")$ks_B
#> [1] 99
#>
#> attr(,"settings")$bootstrap_p_value
#> [1] FALSE
#>
#> attr(,"settings")$bootstrap_R
#> [1] 100
#>
#> attr(,"settings")$seed
#> NULL
#>
#> attr(,"class")
#> [1] "shift_magnitude_comparison_set" "list"
