select_joint_k.Rd
This function determines a single optimal number of components (k) to represent a multi-view dataset by analyzing the joint variance explained curve. It offers multiple methods for selecting k and includes a built-in self-test to verify its own correctness.
A list of numeric matrices [subjects x features]. Required unless `self_test = TRUE`.
The decomposition method. One of `"pca"` (fast SVD-based) or `"spca"`.
The maximum number of components to consider.
A single sparsity parameter (0-1) for SPCA. Ignored for PCA.
The method for choosing k. One of `"elbow"` (point of maximum deviation from a straight line of improvement) or `"threshold"`.
The proportion of variance (0-1) to be explained. Only used when `selection_method = "threshold"`.
Logical. If TRUE, the function will ignore all other inputs, run a built-in suite of tests on simulated data, and print the results. This is for verifying the function's integrity. Defaults to FALSE.
If `self_test = FALSE`, a list containing:
`optimal_k`: The selected optimal number of components.
`joint_variance_curve`: A tibble with `k` and the cumulative proportion of variance explained at each `k`.
`plot`: A ggplot object visualizing the results.
If `self_test = TRUE`, it prints test results and returns invisibly.