Model and Parameter Selection in msma

Atsushi Kawaguchi

2026-08-26

1 Overview

The package provides functions for selecting component numbers and regularization parameters:

BIC is useful for a quick deterministic search. Cross-validation may be more computationally expensive.

dat <- simdata(n = 35, rho = 0.8, Xps = c(4, 4), Yps = c(3, 3), seed = 4)
X <- dat$X
Y <- dat$Y

2 Selecting the number of components

search_comp <- ncompsearch(X, comps = 1:3, criterion = "BIC", intseed = 1)
search_comp
#> Optimal number of components: (block) 3, (super) 1
#> Criterion: BIC
plot(search_comp)

For nested analysis, candidates may be supplied as a list for root and super components.

search_nested <- ncompsearch(
  X,
  comps = list(1:4, 1:3),
  criterion = "BIC",
  intseed = 1
)

3 Selecting regularization parameters

The following example is shown but not evaluated during package building to keep the vignette lightweight.

search_lambda <- regparasearch(
  X = X,
  comp = 2,
  criterion = "BIC",
  maxrep = 5,
  intseed = 1
)
search_lambda

4 Combined selection

optparasearch() supports four workflows:

opt <- optparasearch(
  X = X,
  search.method = "ncomp1st",
  criterion = "BIC",
  intseed = 1
)

fit <- msma(
  X = X,
  comp = opt$optncomp,
  lambdaX = opt$optlambdaX,
  lambdaXsup = opt$optlambdaXsup,
  intseed = 1
)

5 PLS selection

X-side and Y-side parameters are selected separately in PLS.

opt_pls <- optparasearch(
  X = X, Y = Y,
  search.method = "regparaonly",
  criterion = "BIC",
  intseed = 1
)

fit_pls <- msma(
  X = X, Y = Y,
  comp = opt_pls$optncomp,
  lambdaX = opt_pls$optlambdaX,
  lambdaY = opt_pls$optlambdaY,
  lambdaXsup = opt_pls$optlambdaXsup,
  lambdaYsup = opt_pls$optlambdaYsup,
  intseed = 1
)

6 Cross-validation

cv <- cvmsma(
  X = X, Y = Y,
  comp = 1,
  lambdaX = c(0.1, 0.1),
  lambdaY = c(0.1, 0.1),
  nfold = 5,
  seed = 1,
  intseed = 1
)
cv

7 Version 3.2 super-level methods

Model-selection functions accept the super-level method arguments where applicable.

search_snmf <- ncompsearch(
  X,
  comps = list(1:3, 1:3),
  criterion = "BIC",
  sprmethod = "sNMF",
  nneg = "posneg",
  intseed = 1
)

8 Computational recommendations

9 Session information

sessionInfo()
#> R Under development (unstable) (2026-08-25 r90447 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 11 x64 (build 26200)
#> 
#> Matrix products: default
#>   LAPACK version 3.12.1
#> 
#> locale:
#> [1] LC_COLLATE=C                    LC_CTYPE=Japanese_Japan.utf8   
#> [3] LC_MONETARY=Japanese_Japan.utf8 LC_NUMERIC=C                   
#> [5] LC_TIME=Japanese_Japan.utf8    
#> 
#> time zone: Asia/Tokyo
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] msma_3.2
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.39   R6_2.6.1        fastmap_1.2.0   xfun_0.60      
#>  [5] cachem_1.1.0    knitr_1.51      htmltools_0.5.9 rmarkdown_2.31 
#>  [9] lifecycle_1.0.5 cli_3.6.6       sass_0.4.10     jquerylib_0.1.4
#> [13] compiler_4.7.0  tools_4.7.0     evaluate_1.0.5  bslib_0.12.0   
#> [17] yaml_2.3.12     otel_0.2.0      rlang_1.3.0     jsonlite_2.0.0