Usage
## S3 method for class 'data.frame':
find.clusters(x, clust=NULL, n.pca=NULL,
n.clust=NULL, stat=c("BIC","AIC", "WSS"),
choose.n.clust=TRUE,criterion=c("diffNgroup",
"min","goesup", "smoothNgoesup", "goodfit"),
max.n.clust=round(nrow(x)/10), n.iter=1e5, n.start=10,
center=TRUE, scale=TRUE, pca.select=c("nbEig","percVar"),
perc.pca=NULL, ..., dudi=NULL)## S3 method for class 'matrix':
find.clusters(x, \ldots)
## S3 method for class 'genind':
find.clusters(x, clust=NULL, n.pca=NULL, n.clust=NULL,
stat=c("BIC","AIC", "WSS"), choose.n.clust=TRUE,
criterion=c("diffNgroup", "min","goesup", "smoothNgoesup",
"goodfit"), max.n.clust=round(nrow(x@tab)/10), n.iter=1e5,
n.start=10, scale=FALSE, truenames=TRUE, ...)
## S3 method for class 'genlight':
find.clusters(x, clust=NULL, n.pca=NULL,
n.clust=NULL, stat=c("BIC", "AIC",
"WSS"),choose.n.clust=TRUE, criterion=c("diffNgroup",
"min","goesup","smoothNgoesup", "goodfit"),
max.n.clust=round(nInd(x)/10), n.iter=1e5,n.start=10,
scale=FALSE, pca.select=c("nbEig","percVar"),
perc.pca=NULL,glPca=NULL, ...)
Arguments
x
a data.frame, matrix, or genind
object. For the data.frame and matrix arguments, only
quantitative variables should be provided.
clust
an optional factor indicating a prior group membership of
individuals. If provided, sub-clusters will be sought within each prior
group.
n.pca
an integer indicating the number of axes retained in the
Principal Component Analysis (PCA) step. If NULL, interactive selection
is triggered.
n.clust
an optinal integer indicating the number of clusters to
be sought. If provided, the function will only run K-means once, for this
number of clusters. If left as NULL, several K-means are run for a
range of k (number o
stat
a character string matching 'BIC', 'AIC', or 'WSS', which
indicates the statistic to be computed for each model (i.e., for each value of
k). BIC: Bayesian Information Criterion. AIC: Aikaike's Information
Criterion. W
choose.n.clust
a logical indicating whether the number of
clusters should be chosen by the user (TRUE, default), or automatically,
based on a given criterion (argument criterion). It is HIGHLY
RECOMMENDED to choose the number of clu
criterion
a character string matching "diffNgroup",
"min","goesup", "smoothNgoesup", or "conserv", indicating the criterion for automatic
selection of the optimal number of clusters. See details for
an explanation of these proc
max.n.clust
an integer indicating the maximum number of
clusters to be tried. Values of 'k' will be picked up between 1 and max.n.clust
n.iter
an integer indicating the number of iterations to be used
in each run of K-means algorithm. Corresponds to iter.max of
kmeans function.
n.start
an integer indicating the number of randomly
chosen starting centroids to be used in each run of the K-means
algorithm. Using more starting points ensures convergence of the
algorithm. Corresponds to nstart of k
center
a logical indicating whether variables should be centred to
mean 0 (TRUE, default) or not (FALSE). Always TRUE for genind
objects.
scale
a logical indicating whether variables should be
scaled (TRUE) or not (FALSE, default). Scaling consists in dividing
variables by their (estimated) standard deviation to account for
trivial differences in variances. In allele freq
pca.select
a character indicating the mode of selection of PCA
axes, matching either "nbEig" or "percVar". For "nbEig", the user
has to specify the number of axes retained (interactively, or via
n.pca). For "percVar", the user h
perc.pca
a numeric value between 0 and 100 indicating the
minimal percentage of the total variance of the data to be expressed by the
retained axes of PCA.
truenames
a logical indicating whether true (i.e., user-specified)
labels should be used in object outputs (TRUE, default) or not
(FALSE), in which case generic labels are used.
...
further arguments to be passed to other functions. For
find.clusters.matrix, arguments are to match those of the
data.frame method.
dudi
optionally, a multivariate analysis with the class
dudi (from the ade4 package). If provided, prior PCA will be
ignored, and this object will be used as a prior step for variable
orthogonalisation.
glPca
an optional glPca object; if provided,
dimension reduction is not performed (saving computational time) but
taken directly from this object.