[adegenet-commits] r1117 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 25 18:32:37 CEST 2013
Author: greatsage
Date: 2013-04-25 18:32:37 +0200 (Thu, 25 Apr 2013)
New Revision: 1117
Modified:
pkg/R/dapc.R
pkg/man/dapc.Rd
Log:
fixed classes
Modified: pkg/R/dapc.R
===================================================================
--- pkg/R/dapc.R 2013-04-25 14:56:56 UTC (rev 1116)
+++ pkg/R/dapc.R 2013-04-25 16:32:37 UTC (rev 1117)
@@ -986,7 +986,6 @@
## ############
## ## crossval
## ############
-xval <- function (object, n.pca, n.da, training.set, ...) UseMethod("xval")
xval.dapc <- function(object, n.pca, n.da, training.set = 90, ...){
training.set = training.set/100
@@ -1010,6 +1009,11 @@
return(res)
} # end of xval.dapc
+xval <- function (object, n.pca, n.da, training.set, ...) UseMethod("xval")
+xval.genind <- function(object, n.pca, n.da, training.set = 90, ...){
+ res = xval.dapc(object = object, n.pca = n.pca, n.da = n.da, training.set = training.set)
+ return(res)
+}
## ###############
## ## randtest.dapc
## ###############
Modified: pkg/man/dapc.Rd
===================================================================
--- pkg/man/dapc.Rd 2013-04-25 14:56:56 UTC (rev 1116)
+++ pkg/man/dapc.Rd 2013-04-25 16:32:37 UTC (rev 1117)
@@ -9,8 +9,9 @@
\alias{print.dapc}
\alias{summary.dapc}
\alias{predict.dapc}
+\alias{xval.dapc}
\alias{xval}
-\alias{xval.dapc}
+\alias{xval.genind}
\alias{as.lda}
\alias{as.lda.dapc}
\title{Discriminant Analysis of Principal Components (DAPC)}
@@ -40,8 +41,11 @@
- \code{summary.dapc}: extracts useful information from a \code{dapc} object.\cr
- \code{predict.dapc}: predicts group memberships based on DAPC results.\cr
- \code{xval.dapc}: performs cross-validation of DAPC function varying the number of PCs and keeping the number of DAs fixed.
+ - \code{xval}: performs cross-validation of DAPC function varying the number of PCs and keeping the number of DAs fixed.
+ - \code{xval.genind}: performs cross-validation of DAPC function varying the number of PCs and keeping the number of DAs fixed.
+
DAPC implementation calls upon \code{\link[ade4]{dudi.pca}} from the
\code{ade4} package (except for \linkS4class{genlight} objects)
and \code{\link[MASS]{lda}} from the \code{MASS} package. The
@@ -78,6 +82,8 @@
method = c("plug-in", "predictive", "debiased"), ...)
\method{xval}{dapc}(object, n.pca, n.da, training.set = 90, \ldots)
+
+\method{xval}{genind}(object, n.pca, n.da, training.set = 90, \ldots)
}
\arguments{
\item{x}{\code{a data.frame}, \code{matrix}, or \code{\linkS4class{genind}}
@@ -192,7 +198,7 @@
\code{assign.prop} (proportion of overall correct assignment),
\code{assign.per.pop} (proportion of correct assignment per group),
\code{prior.grp.size} (prior group sizes), and \code{post.grp.size} (posterior
- group sizes), \code{xval.dapc} (returns a list of four lists, each one with as
+ group sizes), \code{xval.dapc}, \code{xval.genind} and \code{xval} (all return a list of four lists, each one with as
many items as cross-validation runs. The first item is a list of \code{assign} components,
the secon is a list of \code{posterior} components, the thirs is a list of \code{ind.score}
components and the fourth is a list of \code{match.prp} items, i.e. the prortion of the validation
@@ -326,6 +332,12 @@
plot(unlist(crossval.test$match.prp))
+# the use can also just call xval:
+crossval.test2 <- xval(microbov, n.pca = 40, n.da = 15, training.set = 90)
+plot(unlist(crossval.test2$match.prp))
+
+
+
}
More information about the adegenet-commits
mailing list