R/plot_boostrap_coclustering.R
plot_bootstrap_coclustering.Rd
From the results of a call to mobster_boostrap
, and
the results of a call to bootstrapped_statistics
, a figure (heatmap-style)
for the boostrapped co-clustering probability is produced assembling plots
with cowplot::plot_grid
.
plot_bootstrap_coclustering( x, bootstrap_results, bootstrap_statistics, colors = c(Tail = "gainsboro") )
x | A MOBSTER fit. |
---|---|
bootstrap_results | Results of a call to |
colors | If provided, these colours will be used for each cluster.
If a subset of colours is provided, palette Set1 from |
bootstrap_statisticsResults | of a call to |
A cowplot
figure of the bootstrapped co-clustering probability.
# 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.#> 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #>#> ! mobster automatic setup FAST for the analysis.#> without parallel) 2 x 2 x 2 = 8 models by reICL.#>#>#> #>#> ℹ MOBSTER fits completed in 8.7s.#>#> [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────#> C1] and 48% [C2], with π > 0.#> ✖ No tail fit.#>#> C1 [n = 102, 52%] with mean = 0.58.#> 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 ────────#> C1] and 48% [C2], with π > 0.#> ✖ No tail fit.#>#> C1 [n = 102, 52%] with mean = 0.58.#> 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#>#>#>#>#> [ MOBSTER fit ] #>#> ✔ Loaded input data, n = 200.#> 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #>#> ! mobster automatic setup FAST for the analysis.#> without parallel) 2 x 2 x 2 = 8 models by reICL.#>#>#> #>#> ℹ MOBSTER fits completed in 8.5s.#>#> [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────#> C1] and 49% [C2], with π > 0.#> ✖ No tail fit.#>#> C1 [n = 101, 51%] with mean = 0.58.#> 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.#> 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #>#> ! mobster automatic setup FAST for the analysis.#> without parallel) 2 x 2 x 2 = 8 models by reICL.#>#>#> #>#> ℹ MOBSTER fits completed in 7.2s.#>#> [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────#> C2] and 50% [C1], with π > 0.#> ✖ No tail fit.#>#> C1 [n = 99, 50%] with mean = 0.6.#> 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.#> 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #>#> ! mobster automatic setup FAST for the analysis.#> without parallel) 2 x 2 x 2 = 8 models by reICL.#>#>#> #>#> ℹ MOBSTER fits completed in 9s.#>#> [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────#> C1] and 47% [C2], with π > 0.#> ✖ No tail fit.#>#> C1 [n = 106, 53%] with mean = 0.59.#> 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.#> 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #>#> ! mobster automatic setup FAST for the analysis.#> without parallel) 2 x 2 x 2 = 8 models by reICL.#>#>#> #>#> ℹ MOBSTER fits completed in 9.7s.#>#> [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────#> C1] and 46% [C2], with π > 0.#> ✖ No tail fit.#>#> C1 [n = 108, 54%] with mean = 0.59.#> 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.#> 1,2 Beta(s). Pareto tail: TRUE and FALSE. Output #>#> ! mobster automatic setup FAST for the analysis.#> without parallel) 2 x 2 x 2 = 8 models by reICL.#>#>#> #>#> ℹ MOBSTER fits completed in 9.9s.#>#> [ MOBSTER ] My MOBSTER model n = 200 with k = 2 Beta(s) without tail ────────#> C1] and 42% [C2], with π > 0.#> ✖ No tail fit.#>#> C1 [n = 114, 58%] with mean = 0.57.#> 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.#>#> ── 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_coclustering(x$best, boot_results, boot_stats)