From the results of a call to mobster_boostrap, and the results of a call to bootstrapped_statistics, a boxplot with the mixing proportions is produced.

plot_bootstrap_mixing_proportions(
  x,
  bootstrap_results,
  bootstrap_statistics,
  colors = c(Tail = "gainsboro")
)

Arguments

x

A MOBSTER fit.

bootstrap_results

Results of a call to mobster_boostrap.

colors

If provided, these colours will be used for each cluster. If a subset of colours is provided, palette Set1 from RColorBrewer is used. By default the tail colour is provided as 'gainsboro'.

bootstrap_statisticsResults

of a call to bootstrapped_statistics.

Value

A barplot of the bootstrapped mixing proportions.

Examples

# Random small dataset dataset = random_dataset(N = 200, seed = 123, Beta_variance_scaling = 100) x = mobster_fit(dataset$data, auto_setup = 'FAST')
#> [ MOBSTER fit ] #>
#> Loaded input data, n = 200.
#> ❯ n = 200. Mixture with k = 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #> clusters with π > 0.02 and n > 10.
#> ! mobster automatic setup FAST for the analysis.
#> ❯ Scoring (without parallel) 2 x 2 x 2 = 8 models by reICL.
#>
#> [easypar] 2020-10-29 11:33:49 - Overriding parallel execution setup [FALSE] with global option : FALSE
#> #>
#> MOBSTER fits completed in 8.9s.
#>
#> ── [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────
#> ● Clusters: π = 52% [C1] and 48% [C2], with π > 0.
#> No tail fit.
#>
#> ● Beta C1 [n = 102, 52%] with mean = 0.58.
#> ● Beta C2 [n = 98, 48%] with mean = 0.11.
#> Score(s): NLL = -108.12; ICL = -182.58 (-182.58), H = 1.88 (1.88). Fit #> converged by MM in 66 steps.
# Just 5 resamples of a nonparametric bootstrap run, disabling the parallel engine options(easypar.parallel = FALSE) boot_results = mobster_bootstrap(x$best, n.resamples = 5, auto_setup = 'FAST')
#> [ MOBSTER bootstrap ~ 5 resamples from nonparametric bootstrap ] #>
#> ── [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────
#> ● Clusters: π = 52% [C1] and 48% [C2], with π > 0.
#> No tail fit.
#>
#> ● Beta C1 [n = 102, 52%] with mean = 0.58.
#> ● Beta C2 [n = 98, 48%] with mean = 0.11.
#> Score(s): NLL = -108.12; ICL = -182.58 (-182.58), H = 1.88 (1.88). Fit #> converged by MM in 66 steps.
#>
#> Creating nonparametric bootstrap resamples
#> Creating nonparametric bootstrap resamples ... done
#>
#>
#> ── Running fits ─────────────────────────────────── Might take some time ... ──
#> [easypar] 2020-10-29 11:33:58 - Overriding parallel execution setup [TRUE] with global option : FALSE
#> [ MOBSTER fit ] #>
#> Loaded input data, n = 200.
#> ❯ n = 200. Mixture with k = 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #> clusters with π > 0.02 and n > 10.
#> ! mobster automatic setup FAST for the analysis.
#> ❯ Scoring (without parallel) 2 x 2 x 2 = 8 models by reICL.
#>
#> [easypar] 2020-10-29 11:33:58 - Overriding parallel execution setup [FALSE] with global option : FALSE
#> #>
#> MOBSTER fits completed in 8.6s.
#>
#> ── [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────
#> ● Clusters: π = 51% [C1] and 49% [C2], with π > 0.
#> No tail fit.
#>
#> ● Beta C1 [n = 101, 51%] with mean = 0.58.
#> ● Beta C2 [n = 99, 49%] with mean = 0.11.
#> Score(s): NLL = -118.81; ICL = -204.17 (-204.17), H = 1.66 (1.66). Fit #> converged by MM in 61 steps.
#> [ MOBSTER fit ] #>
#> Loaded input data, n = 200.
#> ❯ n = 200. Mixture with k = 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #> clusters with π > 0.02 and n > 10.
#> ! mobster automatic setup FAST for the analysis.
#> ❯ Scoring (without parallel) 2 x 2 x 2 = 8 models by reICL.
#>
#> [easypar] 2020-10-29 11:34:07 - Overriding parallel execution setup [FALSE] with global option : FALSE
#> #>
#> MOBSTER fits completed in 7.4s.
#>
#> ── [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────
#> ● Clusters: π = 50% [C2] and 50% [C1], with π > 0.
#> No tail fit.
#>
#> ● Beta C1 [n = 99, 50%] with mean = 0.6.
#> ● Beta C2 [n = 101, 50%] with mean = 0.12.
#> Score(s): NLL = -110.86; ICL = -188.81 (-188.81), H = 1.12 (1.12). Fit #> converged by MM in 57 steps.
#> [ MOBSTER fit ] #>
#> Loaded input data, n = 200.
#> ❯ n = 200. Mixture with k = 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #> clusters with π > 0.02 and n > 10.
#> ! mobster automatic setup FAST for the analysis.
#> ❯ Scoring (without parallel) 2 x 2 x 2 = 8 models by reICL.
#>
#> [easypar] 2020-10-29 11:34:14 - Overriding parallel execution setup [FALSE] with global option : FALSE
#> #>
#> MOBSTER fits completed in 9s.
#>
#> ── [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────
#> ● Clusters: π = 53% [C1] and 47% [C2], with π > 0.
#> No tail fit.
#>
#> ● Beta C1 [n = 106, 53%] with mean = 0.59.
#> ● Beta C2 [n = 94, 47%] with mean = 0.11.
#> Score(s): NLL = -117.56; ICL = -201.98 (-201.98), H = 1.35 (1.35). Fit #> converged by MM in 76 steps.
#> [ MOBSTER fit ] #>
#> Loaded input data, n = 200.
#> ❯ n = 200. Mixture with k = 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #> clusters with π > 0.02 and n > 10.
#> ! mobster automatic setup FAST for the analysis.
#> ❯ Scoring (without parallel) 2 x 2 x 2 = 8 models by reICL.
#>
#> [easypar] 2020-10-29 11:34:23 - Overriding parallel execution setup [FALSE] with global option : FALSE
#> #>
#> MOBSTER fits completed in 9.8s.
#>
#> ── [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────
#> ● Clusters: π = 54% [C1] and 46% [C2], with π > 0.
#> No tail fit.
#>
#> ● Beta C1 [n = 108, 54%] with mean = 0.59.
#> ● Beta C2 [n = 92, 46%] with mean = 0.13.
#> Score(s): NLL = -101.74; ICL = -170.66 (-170.66), H = 1.02 (1.02). Fit #> converged by MM in 13 steps.
#> [ MOBSTER fit ] #>
#> Loaded input data, n = 200.
#> ❯ n = 200. Mixture with k = 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #> clusters with π > 0.02 and n > 10.
#> ! mobster automatic setup FAST for the analysis.
#> ❯ Scoring (without parallel) 2 x 2 x 2 = 8 models by reICL.
#>
#> [easypar] 2020-10-29 11:34:33 - Overriding parallel execution setup [FALSE] with global option : FALSE
#> #>
#> MOBSTER fits completed in 9.9s.
#>
#> ── [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────
#> ● Clusters: π = 58% [C1] and 42% [C2], with π > 0.
#> No tail fit.
#>
#> ● Beta C1 [n = 114, 58%] with mean = 0.57.
#> ● Beta C2 [n = 86, 42%] with mean = 0.11.
#> Score(s): NLL = -105.37; ICL = -177.17 (-177.17), H = 1.78 (1.78). Fit #> interrupted by MM in 100 steps.
boot_stats = bootstrapped_statistics(x$best, boot_results)
#>
#> ── Computing model frequency ───────────────────────────────────────────────────
#> # A tibble: 1 x 3 #> Model Frequency fit.model #> <fct> <dbl> <lgl> #> 1 K = 2 without tail 1 TRUE
#>
#> ── Computing confidence Intervals (CI) for empirical quantiles ─────────────────
#> #> Mixing proportions #> # A tibble: 3 x 8 #> cluster statistics min lower_quantile higher_quantile max fit.value #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 C1 Mixing pr… 0.499 0.500 0.574 0.578 0.517 #> 2 C2 Mixing pr… 0.422 0.426 0.500 0.501 0.483 #> 3 Tail Mixing pr… 0 0 0 0 0 #> # … with 1 more variable: init.value <dbl> #> #> Tail shape/ scale #> # A tibble: 0 x 8 #> # … with 8 variables: cluster <chr>, statistics <chr>, min <dbl>, #> # lower_quantile <dbl>, higher_quantile <dbl>, max <dbl>, fit.value <dbl>, #> # init.value <dbl> #> #> Beta peaks #> # A tibble: 4 x 8 #> cluster statistics min lower_quantile higher_quantile max fit.value #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 C1 Mean 0.574 0.575 0.599 0.600 0.581 #> 2 C1 Variance 0.00709 0.00712 0.00868 0.00874 0.00893 #> 3 C2 Mean 0.107 0.107 0.127 0.129 0.112 #> 4 C2 Variance 0.00317 0.00317 0.00447 0.00455 0.00341 #> # … with 1 more variable: init.value <dbl>
#>
#> ── Computing co-clustering probability for nonparametric bootstrap ─────────────
plot_bootstrap_mixing_proportions(x$best, boot_results, boot_stats)