Compare the stability and error of various k values to help determine the correct number of signatures (k).
Usage
compare_k_vals(
musica,
modality,
reps = 100,
min_k = 1,
max_k = 10,
error_type = "prop",
algorithm = "nmf"
)
Arguments
- musica
A
musica
object.- modality
The modality to use, either "SBS96", "DBS78", or "IND83".
- reps
Number of times prediction is performed. For each replicate, the count table data is perturbed. Multiple replicates allows for stability analysis by calculating silhouette width on the multiple results. Default
100
.- min_k
Lower range of number of signatures for discovery. Default
1
.- max_k
Upper range of number of signatures for discovery. Default
10
.- error_type
Whether to calculate reconstruction error by proportions ("prop") or raw counts ("raw"). Default
"prop"
.- algorithm
Algorithm for signature discovery. Default
"nmf"
.
Examples
data(musica)
compare_k_vals(musica, "SBS96", reps = 3, min_k = 1, max_k = 5)
#>
#> k = 1:
#> Calculating signatures on original count table...
#>
#> Replicate 1 of 3...
#> Replicate 2 of 3...
#> Replicate 3 of 3...
#>
#> k = 2:
#> Calculating signatures on original count table...
#>
#> Replicate 1 of 3...
#> Replicate 2 of 3...
#> Replicate 3 of 3...
#>
#> k = 3:
#> Calculating signatures on original count table...
#>
#> Replicate 1 of 3...
#> Replicate 2 of 3...
#> Replicate 3 of 3...
#>
#> k = 4:
#> Calculating signatures on original count table...
#>
#> Replicate 1 of 3...
#> Replicate 2 of 3...
#> Replicate 3 of 3...
#>
#> k = 5:
#> Calculating signatures on original count table...
#>
#> Replicate 1 of 3...
#> Replicate 2 of 3...
#> Replicate 3 of 3...
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_line()`).
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_point()`).
#> k sil_width min_sil_width max_sil_width sd_sil_width sterror_sil_width
#> 1 1 NA NA NA NA NA
#> 2 2 0.76434462 0.73576651 0.8038029 0.0210121 0.007428898
#> 3 3 0.43603280 -0.07114908 0.8078214 0.2949283 0.085138456
#> 4 4 0.09268357 -0.27594425 0.8124093 0.4133481 0.103337018
#> 5 5 0.06672168 -0.31252943 0.8107605 0.3758637 0.084045671
#> error min_error max_error sd_error sterror_error
#> 1 7.009688 6.430394 7.412877 0.4139008 0.2069504
#> 2 5.096309 4.654886 5.443521 0.3370649 0.1685324
#> 3 4.395687 4.031071 4.682656 0.2697601 0.1348800
#> 4 3.379200 3.217509 3.729880 0.2376476 0.1188238
#> 5 2.478940 2.305402 2.793636 0.2163521 0.1081761