getNcomp | R Documentation |
Compute the average silhouette coefficient for a given set of components on a mixOmics result. Foreach given ncomp, the mixOmics method is performed with the sames arguments and the given 'ncomp'. Longitudinal clustering is performed and average silhouette coefficient is computed.
getNcomp(object, max.ncomp = NULL, X, Y = NULL, indY = NULL, ...)
object |
A mixOmics object of the class 'pca', 'spca', 'mixo_pls', 'mixo_spls', 'block.pls', 'block.spls' |
max.ncomp |
integer, maximum number of component to include. If no argument is given, 'max.ncomp=object$ncomp' |
X |
a numeric matrix/data.frame or a list of data.frame for |
Y |
(only for |
indY |
(optional and only for |
... |
Other arguments to be passed to methods (pca, pls, block.pls) |
getNcomp
returns a list with class "ncomp.tune.silhouette" containing the following components:
ncomp |
a vector containing the tested ncomp |
silhouette |
a vector containing the average silhouette coefficient by ncomp |
dmatrix |
the distance matrix used to compute silhouette coefficient |
getCluster
, silhouette
, pca
, pls
, block.pls
# random input data
demo <- suppressWarnings(get_demo_cluster())
# pca
pca.res <- mixOmics::pca(X=demo$X, ncomp = 5)
res.ncomp <- getNcomp(pca.res, max.ncomp = 4, X = demo$X)
plot(res.ncomp)
# pls
pls.res <- mixOmics::pls(X=demo$X, Y=demo$Y)
res.ncomp <- getNcomp(pls.res, max.ncomp = 4, X = demo$X, Y=demo$Y)
plot(res.ncomp)
# block.pls
block.pls.res <- suppressWarnings(mixOmics::block.pls(X=list(X=demo$X, Z=demo$Z), Y=demo$Y))
res.ncomp <- suppressWarnings(getNcomp(block.pls.res, max.ncomp = 4,
X=list(X=demo$X, Z=demo$Z), Y=demo$Y))
plot(res.ncomp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.