Runs PCA on a SNPDataLong object (via runPCA) and then
performs anticlustering on the selected principal components.
runAnticlusteringPCA(
object,
K = 2,
n_pcs = 20,
center = TRUE,
scale = TRUE,
anticlust_method = c("exchange", "fast")
)An object of class SNPDataLong.
Number of groups for anticlustering, or a vector of group sizes (as in anticlust).
Number of top principal components to use. If < 1, it is
interpreted as the proportion of variance to be explained (e.g. 0.8).
The fast matrix-free PCA path is used when a fixed number (>= 1) is
requested and RSpectra is installed.
Logical or numeric, passed to runPCA. Default
TRUE.
Logical or numeric, passed to runPCA. Default
TRUE.
Which anticlust optimiser to use.
"exchange" (default) calls anticlust::anticlustering;
"fast" calls anticlust::fast_anticlustering, which scales to
large numbers of individuals and may return different assignments.
A list with components:
Integer vector with anticlustering group assignments.
The PCA result object (a prcomp-like list), as returned
by runPCA.
Numeric matrix of the PCs used for anticlustering.
if (FALSE) { # requireNamespace("anticlust", quietly = TRUE) && exists("nelore_imputed")
res <- runAnticlusteringPCA(nelore_imputed, K = 2, n_pcs = 0.8)
table(res$groups)
}