dudi.pca
from the ade4
package and
lda
from the MASS
package. dapc
performs the DAPC on a data.frame
, a matrix
, or a
object, and returns an object with class
dapc
. If data are stored in a data.frame
or a matrix
,
these have to be quantitative data (i.e., numeric
or integers
),
as opposed to characters
or factors
.
Other functions are:
- print.dapc
: prints the content of a dapc
object.
- summary.dapc
: extracts useful information from a dapc
object.
- scatter.dapc
: produces scatterplots of principal components (or
'discriminant functions'), with a screeplot of eigenvalues as inset.
- assignplot
: plot showing the probabilities of assignment of
individuals to the different clusters.
## S3 method for class 'data.frame':
dapc(x, grp, n.pca=NULL, n.da=NULL, center=TRUE,
scale=FALSE,var.contrib=FALSE, pca.select=c("nbEig","percVar"),
perc.pca=NULL, ..., dudi=NULL)## S3 method for class 'matrix':
dapc(x, \ldots)
## S3 method for class 'genind':
dapc(x, pop=NULL, n.pca=NULL, n.da=NULL, scale=FALSE,
scale.method=c("sigma", "binom"), truenames=TRUE, all.contrib=FALSE,
pca.select=c("nbEig","percVar"), perc.pca=NULL, ...)
## S3 method for class 'dudi':
dapc(x, grp, \ldots)
## S3 method for class 'dapc':
print(x, \dots)
## S3 method for class 'dapc':
summary(object, \dots)
## S3 method for class 'dapc':
scatter(x, xax=1, yax=2,
col=rainbow(length(levels(x$grp))), posi="bottomleft", bg="grey",
ratio=0.3, csub=1.2, ...)
assignplot(x, only.grp=NULL, subset=NULL, cex.lab=.75, pch=3)
a data.frame
, matrix
, or genind
object. For the data.frame
and matrix
arguments, only
quantitative variables should be provided.factor
indicating the group membership of individualsinteger
indicating the number of axes retained in the
Principal Component Analysis (PCA) step. If NULL
, interactive selection is triggered.integer
indicating the number of axes retained in the
Discriminant Analysis step. If NULL
, interactive selection is triggered.logical
indicating whether variables should be centred to
mean 0 (TRUE, default) or not (FALSE). Always TRUE for 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. Further scaling optilogical
indicating whether the
contribution of original variables (alleles, for 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 has to 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.dapc.matrix
, arguments are to match those of
dapc.data.frame
.dapc
object.character
specifying the scaling method to be used
for allele frequencies, which must match "sigma" (usual estimate of standard
deviation) or "binom" (based on binomial distribution). See scaleGen<
logical
indicating whether true (i.e., user-specified)
labels should be used in object outputs (TRUE, default) or not (FALSE).integers
specifying which principal components of DAPC
should be shown in x and y axes.add.scatter
documentation in the
ade4 package for
more details.character
vector indicating which groups should be
displayed. Values should match values of x$grp
. If NULL
, all
results are displayedinteger
or logical
vector indicating which
individuals should be displayed. If NULL
, all
results are displayednumeric
indicating the size of labels.numeric
indicating the type of point to be used to indicate
the prior group of individuals (see points
documentation for
more details).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.dapc
is a list with the following
components:summary.dapc
returns a list with 6 components: n.dim
(number
of retained DAPC axes), n.pop
(number of groups/populations),
assign.prop
(proportion of overall correct assignment),
assign.per.pop
(proportion of correct assignment per group),
prior.grp.size
(prior group sizes), and post.grp.size
(posterior
group sizes). - scatter.dapc, assignplot
return the matched call.
DAPC does not infer genetic clusters ex nihilo; for this, see the
find.clusters
function.
find.clusters
: to identify clusters without prior. - dapcIllus
: a set of simulated data illustrating the DAPC
## data(dapcIllus), data(eHGDP), and data(H3N2) illustrate the dapc
## see ?dapcIllus, ?eHGDP, ?H3N2
##
example(dapcIllus)
example(eHGDP)
example(H3N2)
Run the code above in your browser using DataLab