diff -Nru ade4-1.7-15/ChangeLog ade4-1.7-16/ChangeLog --- ade4-1.7-15/ChangeLog 2020-02-13 09:04:34.000000000 +0000 +++ ade4-1.7-16/ChangeLog 2020-10-28 09:03:20.000000000 +0000 @@ -1,3 +1,61 @@ +2020-10-28 Aurélie Siberchicot + + * DESCRIPTION: ---------- release of ade4 1.7-16 ---------- + +2020-10-28 Aurélie Siberchicot + + * man/loocv.bca.Rd: Correct typo + +2020-10-27 Aurélie Siberchicot + + * man/loocv.bca.Rd, man/loocv.discrimin.Rd, man/loocv.dudi.Rd, + man/pcw.Rd, man/varipart.Rd: Correct typos + +2020-10-20 Aurélie Siberchicot + + * DESCRIPTION, man/arrival.Rd, man/casitas.Rd, man/kcponds.Rd, + man/mbpcaiv.Rd, man/mbpls.Rd, man/multiblock.Rd, man/pcw.Rd, + man/presid2002.Rd, man/randboot.multiblock.Rd, + man/testdim.multiblock.Rd: Update some URL in rd files + +2020-10-19 Jean Thioulouse + + * man/loocv.discrimin.Rd: Update loocv.discrimin.Rd use generic loocv instead of loocv.discrimin in first exemple + (skulls) + +2020-10-19 Stéphane Dray + + * DESCRIPTION, NAMESPACE, R/loocv.R, man/loocv.bca.Rd, + man/loocv.discrimin.Rd, man/loocv.dudi.Rd: Add a new generic method + "loocv" These new functions allows to perform leave one-out cross-validation + for several simple dudi, between and discrimin classes + +2020-09-28 Aurélie Siberchicot + + * R/suprow.R: Update a warning in 'suprow.dudi' + +2020-06-24 Aurélie Siberchicot + + * inst/CITATION: Update the CITATION file + +2020-06-18 Aurélie Siberchicot + + * DESCRIPTION: Remove date + +2020-06-18 Aurélie Siberchicot + + * man/apis108.Rd: Update URL + +2020-04-23 Stéphane Dray + + * : commit 9991a008cd8276469ed5987dfebc7bab48241ac1 Author: + Stéphane Dray Date: Thu Apr 23 + 17:21:53 2020 +0200 + +2020-02-13 Stéphane Dray + + * ChangeLog: ---------- release of ade4 1.7-15 ---------- + 2020-02-13 Stéphane Dray * DESCRIPTION: ---------- release of ade4 1.7-15 ---------- diff -Nru ade4-1.7-15/debian/changelog ade4-1.7-16/debian/changelog --- ade4-1.7-15/debian/changelog 2020-11-01 05:37:16.000000000 +0000 +++ ade4-1.7-16/debian/changelog 2020-11-01 05:35:03.000000000 +0000 @@ -1,15 +1,15 @@ -ade4 (1.7-15-1cran1ppabionic0) bionic; urgency=medium +ade4 (1.7-16-1cran1.1804.0) bionic; urgency=medium - * Compilation for Ubuntu 18.04.3 LTS + * Compilation for Ubuntu 18.04.5 LTS * Build for c2d4u for R 3.5.0 - -- Michael Rutter Sun, 16 Feb 2020 02:02:19 +0000 + -- Michael Rutter Sun, 01 Nov 2020 05:35:03 +0000 -ade4 (1.7-15-1cran1) testing; urgency=low +ade4 (1.7-16-1cran1) testing; urgency=low * cran2deb svn: 362M with DB version 1. - -- cran2deb4ubuntu Sat, 15 Feb 2020 09:46:30 -0500 + -- cran2deb4ubuntu Sat, 31 Oct 2020 10:30:28 -0400 ade4 (1.7-8-1cran1) testing; urgency=low @@ -61,6 +61,13 @@ -- cran2deb4ubuntu Sun, 19 Apr 2015 09:38:06 -0400 +ade4 (1.7-15-1cran1) testing; urgency=low + + * cran2deb svn: 362M with DB version 1. + + -- cran2deb4ubuntu Sat, 15 Feb 2020 09:46:41 -0500 + + ade4 (1.7-13-1cran1) testing; urgency=low * cran2deb svn: 362M with DB version 1. diff -Nru ade4-1.7-15/debian/compat ade4-1.7-16/debian/compat --- ade4-1.7-15/debian/compat 2020-11-01 05:37:16.000000000 +0000 +++ ade4-1.7-16/debian/compat 2020-10-31 14:30:28.000000000 +0000 @@ -1 +1 @@ -7 \ No newline at end of file +9 \ No newline at end of file diff -Nru ade4-1.7-15/debian/control ade4-1.7-16/debian/control --- ade4-1.7-15/debian/control 2020-11-01 05:37:16.000000000 +0000 +++ ade4-1.7-16/debian/control 2020-10-31 14:30:28.000000000 +0000 @@ -2,15 +2,16 @@ Section: gnu-r Priority: optional Maintainer: cran2deb4ubuntu -Build-Depends: r-base-dev, r-cran-mass, r-cran-pixmap, r-cran-sp, xvfb, - xauth, xfonts-base, r-base-core, debhelper (>> 4.1.0), cdbs -Standards-Version: 3.9.1 -Homepage: http://pbil.univ-lyon1.fr/ADE-4 +Build-Depends: r-base-dev, r-cran-mass, r-cran-pixmap, r-cran-sp, + r-cran-progress, xvfb, xauth, xfonts-base, r-base-core, debhelper (>> + 4.1.0), cdbs +Standards-Version: 4.1.4 +Homepage: http://pbil.univ-lyon1.fr/ADE-4/ Package: r-cran-ade4 Architecture: any Depends: r-base-core, r-cran-mass, r-cran-pixmap, r-cran-sp, - ${shlibs:Depends} + r-cran-progress, ${shlibs:Depends} Description: GNU R package "Analysis of Ecological Data: Exploratory and Euclidean Methods in Environmental Sciences" . diff -Nru ade4-1.7-15/debian/source/format ade4-1.7-16/debian/source/format --- ade4-1.7-15/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ ade4-1.7-16/debian/source/format 2020-10-31 14:30:28.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) \ No newline at end of file diff -Nru ade4-1.7-15/DESCRIPTION ade4-1.7-16/DESCRIPTION --- ade4-1.7-15/DESCRIPTION 2020-02-13 11:50:07.000000000 +0000 +++ ade4-1.7-16/DESCRIPTION 2020-10-28 11:10:02.000000000 +0000 @@ -1,20 +1,20 @@ Package: ade4 -Version: 1.7-15 -Date: 2020-02-13 +Version: 1.7-16 Title: Analysis of Ecological Data: Exploratory and Euclidean Methods in Environmental Sciences Author: Stéphane Dray , Anne-Béatrice Dufour , and Jean Thioulouse , with contributions from Thibaut Jombart, Sandrine Pavoine, Jean R. Lobry, Sébastien Ollier, Daniel Borcard, Pierre Legendre, Stéphanie Bougeard and Aurélie Siberchicot. Based on earlier work by Daniel Chessel. Maintainer: Aurélie Siberchicot Depends: R (>= 2.10) -Imports: graphics, grDevices, methods, stats, utils, MASS, pixmap, sp +Imports: graphics, grDevices, methods, stats, utils, MASS, pixmap, sp, + progress Suggests: ade4TkGUI, adegraphics, adephylo, ape, CircStats, deldir, lattice, spdep, splancs, waveslim Description: Tools for multivariate data analysis. Several methods are provided for the analysis (i.e., ordination) of one-table (e.g., principal component analysis, correspondence analysis), two-table (e.g., coinertia analysis, redundancy analysis), three-table (e.g., RLQ analysis) and K-table (e.g., STATIS, multiple coinertia analysis). The philosophy of the package is described in Dray and Dufour (2007) . License: GPL (>= 2) -URL: http://pbil.univ-lyon1.fr/ADE-4 +URL: http://pbil.univ-lyon1.fr/ADE-4/ BugReports: https://github.com/sdray/ade4/issues Encoding: UTF-8 NeedsCompilation: yes -Packaged: 2020-02-13 09:06:03 UTC; stephane +Packaged: 2020-10-28 09:07:53 UTC; siberchicot Repository: CRAN -Date/Publication: 2020-02-13 11:50:07 UTC +Date/Publication: 2020-10-28 11:10:02 UTC diff -Nru ade4-1.7-15/inst/CITATION ade4-1.7-16/inst/CITATION --- ade4-1.7-15/inst/CITATION 2018-08-31 18:44:41.000000000 +0000 +++ ade4-1.7-16/inst/CITATION 2020-10-16 11:22:21.000000000 +0000 @@ -1,9 +1,7 @@ bibentry(bibtype = "Article", title = "The {ade4} Package: Implementing the Duality Diagram for Ecologists", - author = c(person(given = "St\\'ephane", - family = "Dray"), - person(given = "Anne--B\\'eatrice", - family = "Dufour")), + author = c(person(given = "St\\'ephane", family = "Dray"), + person(given = "Anne--B\\'eatrice", family = "Dufour")), journal = "Journal of Statistical Software", year = "2007", volume = "22", @@ -16,12 +14,8 @@ bibentry(bibtype = "Article", title = "Supervised Multiblock Analysis in {R} with the {ade4} Package", - author = c(person(given = "St\\'ephanie", - family = "Bougeard", - email = "stephanie.bougeard@anses.fr"), - person(given = "St\\'ephane", - family = "Dray", - email = "stephane.dray@univ-lyon1.fr")), + author = c(person(given = "St\\'ephanie", family = "Bougeard", email = "stephanie.bougeard@anses.fr"), + person(given = "St\\'ephane", family = "Dray", email = "stephane.dray@univ-lyon1.fr")), journal = "Journal of Statistical Software", year = "2018", volume = "86", @@ -32,12 +26,9 @@ bibentry(bibtype = "Article", title = "The {ade4} Package -- {I}: One-Table Methods", - author = c(person(given = "Daniel", - family = "Chessel"), - person(given = "Anne-B\\'eatrice", - family = "Dufour"), - person(given = "Jean", - family = "Thioulouse")), + author = c(person(given = "Daniel", family = "Chessel"), + person(given = "Anne-B\\'eatrice", family = "Dufour"), + person(given = "Jean", family = "Thioulouse")), journal = "R News", year = "2004", volume = "4", @@ -48,12 +39,9 @@ bibentry(bibtype = "Article", title = "The {ade4} Package -- {II}: Two-Table and {K}-Table Methods", - author = c(person(given = "St\\'ephane", - family = "Dray"), - person(given = "Anne-B\\'eatrice", - family = "Dufour"), - person(given = "Daniel", - family = "Chessel")), + author = c(person(given = "St\\'ephane", family = "Dray"), + person(given = "Anne-B\\'eatrice", family = "Dufour"), + person(given = "Daniel", family = "Chessel")), journal = "R News", year = "2007", volume = "7", @@ -61,3 +49,16 @@ pages = "47--52", url = "https://cran.r-project.org/doc/Rnews/" ) + +bibentry(bibtype = "Book", + title = "Multivariate Analysis of Ecological Data with {ade4}", + author = c(person(given = "Jean", family = "Thioulouse"), + person(given = "St\\'ephane", family = "Dray"), + person(given = "Anne--B\\'eatrice", family = "Dufour"), + person(given = "Aur\\'elie", family = "Siberchicot"), + person(given = "Thibaut", family = "Jombart"), + person(given = "Sandrine", family = "Pavoine")), + year = "2018", + publisher = "Springer", + doi = "10.1007/978-1-4939-8850-1" +) \ No newline at end of file diff -Nru ade4-1.7-15/man/apis108.Rd ade4-1.7-16/man/apis108.Rd --- ade4-1.7-15/man/apis108.Rd 2019-05-31 11:10:44.000000000 +0000 +++ ade4-1.7-16/man/apis108.Rd 2020-10-16 11:22:21.000000000 +0000 @@ -11,7 +11,7 @@ Nimba, Celinda, Pretoria, Chalkidiki, Forli, Valenciennes, Umea and Seville). } \source{ -\url{http://www.montpellier.inra.fr/URLB/apis/libanfreq.pdf}\cr +\url{http://www1.montpellier.inra.fr/URLB/apis/libanfreq.pdf}\cr Franck P., Garnery L., Solignac M. and Cornuet J.M. (2000) Molecular confirmation of a fourth lineage in honeybees from the Near-East. \emph{Apidologie}, \bold{31}, 167--180. diff -Nru ade4-1.7-15/man/arrival.Rd ade4-1.7-16/man/arrival.Rd --- ade4-1.7-15/man/arrival.Rd 2017-05-02 08:41:43.000000000 +0000 +++ ade4-1.7-16/man/arrival.Rd 2020-10-20 11:48:48.000000000 +0000 @@ -13,7 +13,7 @@ \item{hours}{is a vector giving the number of arrivals per hour for the day considered} }} \source{ -Data taken from the Oriana software developped by Warren L. Kovach \email{sales@kovcomp.com} starting from \url{http://www.kovcomp.com/oriana/index.html}. +Data taken from the Oriana software developped by Warren L. Kovach \email{sales@kovcomp.com} starting from \url{https://www.kovcomp.co.uk/oriana/index.html}. } \references{ Fisher, N. I. (1993) \emph{Statistical Analysis of Circular Data}. Cambridge University Press. diff -Nru ade4-1.7-15/man/casitas.Rd ade4-1.7-16/man/casitas.Rd --- ade4-1.7-15/man/casitas.Rd 2019-05-31 11:10:44.000000000 +0000 +++ ade4-1.7-16/man/casitas.Rd 2020-10-20 11:43:44.000000000 +0000 @@ -20,7 +20,7 @@ Exemple du logiciel GENETIX. Belkhir k. et al. GENETIX, logiciel sous WindowsTM pour la génétique des populations. Laboratoire Génome, Populations, Interactions CNRS UMR 5000, Université de Montpellier II, Montpellier (France). \cr -\url{http://kimura.univ-montp2.fr/genetix/} +\url{https://kimura.univ-montp2.fr/genetix/} } \references{ Orth, A., T. Adama, W. Din and F. Bonhomme. (1998) Hybridation naturelle entre deux sous espèces de souris domestique diff -Nru ade4-1.7-15/man/kcponds.Rd ade4-1.7-16/man/kcponds.Rd --- ade4-1.7-15/man/kcponds.Rd 2017-11-03 11:47:29.000000000 +0000 +++ ade4-1.7-16/man/kcponds.Rd 2020-10-20 11:51:18.000000000 +0000 @@ -32,7 +32,7 @@ \source{ Cottenie, K. (2002) Local and regional processes in a zooplankton metacommunity. PhD, Katholieke Universiteit Leuven, Leuven, Belgium. \cr - \url{http://www.kuleuven.ac.be/bio/eco/phdkarlcottenie.pdf} + \url{https://bio.kuleuven.be/eco/phdkarlcottenie.pdf} } \examples{ diff -Nru ade4-1.7-15/man/loocv.bca.Rd ade4-1.7-16/man/loocv.bca.Rd --- ade4-1.7-15/man/loocv.bca.Rd 1970-01-01 00:00:00.000000000 +0000 +++ ade4-1.7-16/man/loocv.bca.Rd 2020-10-28 08:00:29.000000000 +0000 @@ -0,0 +1,77 @@ +\name{loocv.between} +\alias{loocv.between} +\title{ +Leave-one-out cross-validation for a \code{bca} +} +\description{ +Leave-one-out cross-validation to test the existence of spurious groups in \code{bca} in the case p (number of variables) > n (number of samples). +} +\usage{ +\method{loocv}{between}(x, progress = FALSE, \dots) +} +\arguments{ + \item{x}{ +the dudi of the \code{bca} on which cross-validation should be done +} + \item{progress}{ +logical to display a progress bar during computations (see the \code{progress} package) +} + \item{\dots}{further arguments passed to or from other methods} +} +\details{ +This function returns a list containing the cross-validated coordinates of the rows (the rows of the original analysis, not the rows of the \code{bca}). The analysis on which the \code{bca} was computed is redone after removing each row of the data table, one at a time. A \code{bca} is done on this new analysis and the coordinates of the missing row are computed by projection as supplementary element in the corresponding \code{bca}. This is mostly useful in the case p >> n (many variables and few samples), where \code{bca} graphs can show spurious groups (see Refs.) +} +\value{ +{A list with the cross-validated row coordinates \code{XValCoord}, the Predicted Residual Error Sum (\code{PRESS}, for each row and \code{PRESSTot}, its sum for each \code{bca} axis), the Root Mean Square Error (\code{RMSE}) and the IQR-standardized RMSE (\code{RMSEIQR}) for each \code{bca} axis. +} +} +\references{ +Cardini A, O'Higgins P, Rohlf J. Seeing Distinct Groups Where There are None: Spurious Patterns from Between-Group PCA. Evolutionary Biology (2019) 46:303-316 + +Cardini A, Polly D. Cross-validated Between Group PCA Scatterplots: A Solution to Spurious Group Separation? Evolutionary Biology (2020) https://doi.org/10.1007/s11692-020-09494-x + +Bookstein F. Pathologies of Between-Groups Principal Components Analysis in Geometric Morphometrics. Evolutionary Biology (2019) 46:271-302 +} +\author{ +Jean Thioulouse +} +\seealso{ +\link{loocv.dudi} +} +\examples{ +# Data = meaudret +data(meaudret) +pca1 <- dudi.pca(meaudret$env, scannf = FALSE, nf = 3) +bca1 <- bca(pca1, meaudret$design$site, scannf = FALSE, nf = 3) +pst1 <- paste0("Meaudret BGA randtest: p=", +randtest(bca1)$pvalue, " ratio=", round(bca1$ratio, 2)) + +if(adegraphicsLoaded()){ + sc1 <- s.class(bca1$ls, meaudret$design$site, col = TRUE, + psub.text = pst1, ellipseSize=0, chullSize=1, plot = FALSE) + xbca1 <- loocv(bca1, progress = TRUE) + sc2 <- s.class(xbca1$XValCoord, meaudret$design$site, + col = TRUE, psub.text = "Meaudret cross-validation", + ellipseSize=0, chullSize=1, plot = FALSE) + ADEgS(list(sc1, sc2)) +} +\dontrun{ +# Data = rnorm() +set.seed(9) +fac1 <- as.factor(rep(1:3, each = 10)) +tab <- as.data.frame(matrix(rnorm(10800), nrow = 30)) +pca2 <- dudi.pca(tab, scannf = FALSE) +bca2 <- bca(pca2, fac1, scannf = FALSE) +pst2 <- paste0("rnorm spurious groups: p=", +randtest(bca2)$pvalue, " ratio=", round(bca2$ratio, 2)) +sc3 <- s.class(bca2$ls, fac1, col = TRUE, +psub.text = pst2, ellipseSize=0, chullSize=1, +xlim = c(-8, 8), ylim = c(-8, 8), plot = FALSE) +xbca2 <- loocv(bca2, progress = TRUE) +sc4 <- s.class(xbca2$XValCoord, fac1, col = TRUE, +psub.text = "rnorm cross-validation", ellipseSize=0, +chullSize=1, xlim = c(-8, 8), ylim = c(-8, 8), plot = FALSE) +ADEgS(list(sc3, sc4))}} + +\keyword{dplot} +\keyword{multivariate} diff -Nru ade4-1.7-15/man/loocv.discrimin.Rd ade4-1.7-16/man/loocv.discrimin.Rd --- ade4-1.7-15/man/loocv.discrimin.Rd 1970-01-01 00:00:00.000000000 +0000 +++ ade4-1.7-16/man/loocv.discrimin.Rd 2020-10-27 15:47:22.000000000 +0000 @@ -0,0 +1,89 @@ +\name{loocv.discrimin} +\alias{loocv.discrimin} +\title{ +Leave-one-out cross-validation for a \code{discrimin} analysis +} +\description{ +Leave-one-out cross-validation to test the existence of groups in a \code{discrimin} analysis. +} +\usage{ +\method{loocv}{discrimin}(x, progress = FALSE, \dots) +} +\arguments{ + \item{x}{ +the \code{discrimin} analysis on which cross-validation should be done +} + \item{progress}{ +logical to display a progress bar during computations (see the \code{progress} package) +} + \item{\dots}{further arguments passed to or from other methods} +} +\details{ +This function returns a list containing the cross-validated coordinates of the rows. The analysis on which the \code{discrimin} was computed is redone after removing each row of the data table, one at a time. A \code{discrimin} analysis is done on this new analysis and the coordinates of the missing row are computed by projection as supplementary element in the new \code{discrimin} analysis. This can be useful to check that the groups evidenced by the \code{discrimin} analysis are supported. +} +\value{ +{A list with the cross-validated row coordinates \code{XValCoord}, the Predicted Residual Error Sum (\code{PRESS}, for each row and \code{PRESSTot}, its sum for each \code{discrimin} axis), the Root Mean Square Error (\code{RMSE}) and the IQR-standardized RMSE (\code{RMSEIQR}) for each \code{discrimin} axis. +} +} +\author{ +Jean Thioulouse +} +\seealso{ +\link{loocv.dudi} +\link{loocv.between} +} +\examples{ +\dontrun{ +# Data = skulls +data(skulls) +pcaskul <- dudi.pca(skulls, scan = FALSE) +facskul <- gl(5,30) +diskul <- discrimin(pcaskul, facskul, scan = FALSE) +xdiskul <- loocv(diskul, progress = TRUE) +pst1 <- paste0("Skulls discrimin randtest: p=", round(randtest(diskul)$pvalue, 4)) +pst2 <- paste0("Skulls cross-validation: Ax1= ", round(xdiskul$RMSEIQR[1],2), +" Ax2= ", round(xdiskul$RMSEIQR[2],2)) +if (adegraphicsLoaded()) { + sc1 <- s.class(diskul$li, facskul, col = TRUE, psub.text = pst1, ellipseSize=0, + chullSize=1, plot = FALSE) + sc2 <- s.class(xdiskul$XValCoord, facskul, col = TRUE, psub.text = pst2, + ellipseSize=0, chullSize=1, plot = FALSE) + ADEgS(list(sc1, sc2), layout=c(2,2)) +} else { + par(mfrow=c(2,2)) + s.class(diskul$li, facskul, sub = pst1) + s.class(xdiskul$XValCoord, facskul, sub = pst2) +} +data(chazeb) +pcacz <- dudi.pca(chazeb$tab, scan = FALSE) +discz <- discrimin(pcacz, chazeb$cla, scan = FALSE) +xdiscz <- loocv(discz, progress = TRUE) +pst1 <- paste0("Chazeb discrimin randtest: p=", round(randtest(discz)$pvalue, 4)) +pst2 <- paste0("Chazeb cross-validation: Axis 1= ", round(xdiscz$RMSEIQR[1],2)) +if (adegraphicsLoaded()) { + tabi <- cbind(discz$li, pcacz$tab) + gr1 <- s.class(tabi, xax=1, yax=2:7, chazeb$cla, col = TRUE, plot = FALSE) + for (i in 1:6) gr1[[i]] <- update(gr1[[i]], psub.text = names(tabi)[i+1], + plot = FALSE) + pos1 <- gr1@positions + pos1[,1] <- c(0, .3333, .6667, 0, .3333, .6667) + pos1[,2] <- c(.6667, .6667, .6667, .3333, .3333, .3333) + pos1[,3] <- c(.3333, .6667, 1, .3333, .6667, 1) + pos1[,4] <- c(1, 1, 1, .6667, .6667, .6667) + gr1@positions <- pos1 + sc1 <- s1d.gauss(discz$li, chazeb$cla, col = TRUE, psub.text = pst1, + plot = FALSE) + sc2 <- s1d.gauss(xdiscz$XValCoord, chazeb$cla, col = TRUE, psub.text = pst2, + plot = FALSE) + ADEgS(list(gr1[[1]], gr1[[2]], gr1[[3]], gr1[[4]], gr1[[5]], gr1[[6]], sc1, sc2)) +} else { + plot(discz) + sco.gauss(discz$li[,1], as.data.frame(chazeb$cla), sub = pst1, + legen = FALSE) + sco.gauss(xdiscz$XValCoord[,1], as.data.frame(chazeb$cla), sub = pst2, + legen = FALSE) +} +}} + +\keyword{dplot} +\keyword{multivariate} diff -Nru ade4-1.7-15/man/loocv.dudi.Rd ade4-1.7-16/man/loocv.dudi.Rd --- ade4-1.7-15/man/loocv.dudi.Rd 1970-01-01 00:00:00.000000000 +0000 +++ ade4-1.7-16/man/loocv.dudi.Rd 2020-10-27 16:09:24.000000000 +0000 @@ -0,0 +1,42 @@ +\name{loocv.dudi} +\alias{loocv.dudi} +\alias{loocv} +\title{ +Leave-one-out cross-validation for a \code{dudi} +} +\description{ +Leave-one-out cross-validation to check the dispersion of row coordinates in a \code{dudi}. +} +\usage{ +\method{loocv}{dudi}(x, progress = FALSE, \dots) +} +\arguments{ + \item{x}{ +the dudi of the \code{bca} on which cross-validation should be done +} + \item{progress}{ +logical to display a progress bar during computations (see the \code{progress} package) +} + \item{\dots}{further arguments passed to or from other methods} +} +\details{ +This function returns a list with two elements: \code{$XValCoord} and \code{$lsFac}, the cross-validated row coordinates and a factor to plot them. The analysis is redone after removing each row of the data table, one at a time. The coordinates of the missing row are computed by projection as supplementary element in the \code{dudi} space. This can be used to check the dispersion of the coordinates of one point and it's sensitivity to outliers. +} +\value{ +{a list with two elements: \code{$XValCoord} and \code{$lsFac} containing the cross-validated row coordinates and the factor to plot them using the \code{s.class} (see example).} +} +\author{ +Jean Thioulouse +} +\seealso{ +\link{suprow} +} +\examples{ +data(meaudret) +envpca <- dudi.pca(meaudret$env, scannf = FALSE, nf = 3) +xvpca <- loocv(envpca) +s.match(envpca$li, xvpca$XValCoord) +} + +\keyword{dplot} +\keyword{multivariate} diff -Nru ade4-1.7-15/man/mbpcaiv.Rd ade4-1.7-16/man/mbpcaiv.Rd --- ade4-1.7-15/man/mbpcaiv.Rd 2018-08-29 12:57:05.000000000 +0000 +++ ade4-1.7-16/man/mbpcaiv.Rd 2020-10-20 11:42:51.000000000 +0000 @@ -51,7 +51,7 @@ \references{Bougeard, S., Qannari, E.M. and Rose, N. (2011) Multiblock Redundancy Analysis: interpretation tools and application in epidemiology. \emph{Journal of Chemometrics}, \bold{23}, 1-9 -Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{http://doi.org/10.18637/jss.v086.i01} +Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{https://doi.org/10.18637/jss.v086.i01} } \author{Stéphanie Bougeard (\email{stephanie.bougeard@anses.fr}) and Stéphane Dray (\email{stephane.dray@univ-lyon1.fr})} diff -Nru ade4-1.7-15/man/mbpls.Rd ade4-1.7-16/man/mbpls.Rd --- ade4-1.7-15/man/mbpls.Rd 2018-08-29 12:58:38.000000000 +0000 +++ ade4-1.7-16/man/mbpls.Rd 2020-10-20 11:43:07.000000000 +0000 @@ -48,7 +48,7 @@ } \references{Bougeard, S., Qannari, E.M., Lupo, C. and Hanafi, M. (2011). From multiblock partial least squares to multiblock redundancy analysis. A continuum approach. \emph{Informatica}, 22(1), 11-26 -Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{http://doi.org/10.18637/jss.v086.i01}} +Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{https://doi.org/10.18637/jss.v086.i01}} \author{Stéphanie Bougeard (\email{stephanie.bougeard@anses.fr}) and Stéphane Dray (\email{stephane.dray@univ-lyon1.fr})} diff -Nru ade4-1.7-15/man/multiblock.Rd ade4-1.7-16/man/multiblock.Rd --- ade4-1.7-15/man/multiblock.Rd 2018-08-29 12:59:12.000000000 +0000 +++ ade4-1.7-16/man/multiblock.Rd 2020-10-20 11:43:16.000000000 +0000 @@ -17,7 +17,7 @@ \item{\dots}{other arguments to be passed to methods} } -\references{Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{http://doi.org/10.18637/jss.v086.i01}} +\references{Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{https://doi.org/10.18637/jss.v086.i01}} \author{Stéphanie Bougeard (\email{stephanie.bougeard@anses.fr}) and Stéphane Dray (\email{stephane.dray@univ-lyon1.fr})} diff -Nru ade4-1.7-15/man/pcw.Rd ade4-1.7-16/man/pcw.Rd --- ade4-1.7-15/man/pcw.Rd 2017-02-09 16:51:08.000000000 +0000 +++ ade4-1.7-16/man/pcw.Rd 2020-10-27 14:58:21.000000000 +0000 @@ -5,7 +5,7 @@ \description{ Abundance of tropical trees, environmental variables and spatial coordinates for 50 sites. Data are available at - \url{http://www.sciencemag.org/content/295/5555/666/suppl/DC1} + \url{https://science.sciencemag.org/content/suppl/2002/01/24/295.5555.666.DC1} but plots from Barro Colorado Island were removed. } \usage{data(pcw)} @@ -25,7 +25,7 @@ Condit, R., N. Pitman, E. G. Leigh, J. Chave, J. Terborgh, R. B. Foster, P. Núnez, S. Aguilar, R. Valencia, G. Villa, H. C. Muller-Landau, E. Losos, and S. P. Hubbell. (2002) Beta-diversity - in tropical forest trees. \emph{Science}, \bold{295}, 666–669. + in tropical forest trees. \emph{Science}, \bold{295}, 666-669. Pyke, C. R., R. Condit, S. Aguilar, and S. Lao. (2001) Floristic diff -Nru ade4-1.7-15/man/presid2002.Rd ade4-1.7-16/man/presid2002.Rd --- ade4-1.7-15/man/presid2002.Rd 2017-01-20 10:26:00.000000000 +0000 +++ ade4-1.7-16/man/presid2002.Rd 2020-10-20 11:44:55.000000000 +0000 @@ -21,7 +21,7 @@ } \source{ Site of the ministry of the Interior, of the Internal Security and of the local liberties\cr -\url{http://www.interieur.gouv.fr/Elections/Les-resultats/Presidentielles/elecresult__presidentielle_2002/} +\url{https://www.interieur.gouv.fr/Elections/Les-resultats/Presidentielles/elecresult__presidentielle_2002/} } \seealso{ This dataset is compatible with \code{elec88} and \code{cnc2003}} diff -Nru ade4-1.7-15/man/randboot.multiblock.Rd ade4-1.7-16/man/randboot.multiblock.Rd --- ade4-1.7-15/man/randboot.multiblock.Rd 2018-08-29 12:57:15.000000000 +0000 +++ ade4-1.7-16/man/randboot.multiblock.Rd 2020-10-20 11:43:22.000000000 +0000 @@ -20,7 +20,7 @@ \references{Carpenter, J. and Bithell, J. (2000) Bootstrap confidence intervals: when, which, what? A practical guide for medical statisticians.\emph{Statistics in medicine}, 19, 1141-1164. -Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{http://doi.org/10.18637/jss.v086.i01}} +Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{https://doi.org/10.18637/jss.v086.i01}} \author{Stéphanie Bougeard (\email{stephanie.bougeard@anses.fr}) and Stéphane Dray (\email{stephane.dray@univ-lyon1.fr})} \seealso{\code{\link{mbpcaiv}}, \code{\link{mbpls}}, diff -Nru ade4-1.7-15/man/testdim.multiblock.Rd ade4-1.7-16/man/testdim.multiblock.Rd --- ade4-1.7-15/man/testdim.multiblock.Rd 2018-08-29 12:58:14.000000000 +0000 +++ ade4-1.7-16/man/testdim.multiblock.Rd 2020-10-20 11:43:31.000000000 +0000 @@ -19,7 +19,7 @@ \references{Stone M. (1974) Cross-validatory choice and assessment of statistical predictions. \emph{Journal of the Royal Statistical Society}, \bold{36}, 111-147. -Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{http://doi.org/10.18637/jss.v086.i01} +Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. \emph{Journal of Statistical Software}, \bold{86} (1), 1-17. \url{https://doi.org/10.18637/jss.v086.i01} } \author{Stéphanie Bougeard (\email{stephanie.bougeard@anses.fr}) and Stéphane Dray (\email{stephane.dray@univ-lyon1.fr})} diff -Nru ade4-1.7-15/man/varipart.Rd ade4-1.7-16/man/varipart.Rd --- ade4-1.7-15/man/varipart.Rd 2018-08-03 15:53:24.000000000 +0000 +++ ade4-1.7-16/man/varipart.Rd 2020-10-27 14:58:27.000000000 +0000 @@ -79,7 +79,7 @@ of ecological variation. Ecology 73:1045. Peres-Neto, P. R., P. Legendre, S. Dray, and D. Borcard. 2006. Variation partitioning of -species data matrices: estimation and comparison of fractions. Ecology 87:2614–2625. +species data matrices: estimation and comparison of fractions. Ecology 87:2614-2625. } \seealso{ \code{\link{pcaiv}} diff -Nru ade4-1.7-15/MD5 ade4-1.7-16/MD5 --- ade4-1.7-15/MD5 2020-02-13 11:50:07.000000000 +0000 +++ ade4-1.7-16/MD5 2020-10-28 11:10:02.000000000 +0000 @@ -1,6 +1,6 @@ -94b7ffcbd71a2a1badc222bbf8afc28d *ChangeLog -f2098884983273a5f9630d4c74eb60c6 *DESCRIPTION -b3dfbcf921ee696ec2bf371625b722db *NAMESPACE +e41712f3cba15fb5b1864af1455f95df *ChangeLog +7f70186f7b99904f5727964e09453186 *DESCRIPTION +6a3247f02dfb32994d7c1bfdea2c45ad *NAMESPACE 6b677d2c1862d14d17ab0760f9760dcc *R/PI2newick.R 6997af57a25d43dc445092f3e845f2f1 *R/RV.rtest.R 8d43bff953af1f5d49b5e0fb16930a34 *R/RVdist.randtest.R @@ -73,16 +73,17 @@ 9d4a9f10a538cbf896a72535ea0961b3 *R/ktab.match2ktabs.R d7b3319992f78918e90fcd49bf16e23e *R/ktab.within.R 6aa6c74464a2d1a55b2562561795cdc2 *R/lingoes.R +77b75b0b5750c343c90a80a9c028ecda *R/loocv.R 865f71d4617be075737dd1d22e37297d *R/mantel.randtest.R 282b41479955a96001a1b35768643bb0 *R/mantel.rtest.R -f494217bd4284707773bef0441402956 *R/mbpcaiv.R -e5a18eae0dbb3b3da88ad67340da0036 *R/mbpls.R +61e6ea24eb1b11e1dfbca8a2edd0942c *R/mbpcaiv.R +9adff3592123f838e1e77fff35db84eb *R/mbpls.R f2069eaaf0ff7a8c492ca744e26241db *R/mcoa.R 7df34204586cf5a1d8851262ccf62b0b *R/mdpcoa.R 7c3bc2cbb167182b3fcddbd2d882c628 *R/mfa.R bc8897b6d8e662fa44e5b162fed075cb *R/mld.R c1e78e310e6e2bc4466825be29723bec *R/mstree.R -874c603e0edd7ce3207da8d2d17f8d7e *R/multiblock.R +8aceb7b693c0d266579b001deea73fef *R/multiblock.R 5e8940534b80bb3d5e6dafffabfa5a49 *R/multispati.R c27c23c9df3020fbab16df8c5177ca67 *R/multispati.randtest.R ede7143b536c3c385b3f02685273a718 *R/multispati.rtest.R @@ -162,7 +163,7 @@ 91c6e96e5a83ae05746a1de1288c145c *R/summary.4thcorner.R 834b2cb4dffc468ba24caaeb0283c40c *R/supcol.R 75906367d78ef6392d01d1768daf8f79 *R/supdist.R -c9a63e6c11929fa56e927d8537a410e2 *R/suprow.R +e33f1c8289114fabb487926fa8436ffe *R/suprow.R c3e87c6f6f8239a62e083de02646648c *R/suprow.pta.R 19128aaadc6cb691920aaeb97679551c *R/symbols.phylog.R bc70ddf20e036e5273144e0628a20165 *R/table.cont.R @@ -292,7 +293,7 @@ 53df52b0b8de963f7cd1ed72ff171da5 *data/worksurv.rda 55cd9d01e39691f67acfd1ffdd607652 *data/yanomama.rda f19df1a99aa3d39631422b7b247f4511 *data/zealand.rda -2552cb1686c21b5b3b70c944e35aad7d *inst/CITATION +d405ab13c699b4ee8333f300ed1785e0 *inst/CITATION a134ce28598a2867b151d0cf11e944b7 *inst/pictures/atyacarto.pnm 6a427fa2a11dc07d5b2686fa50405d28 *inst/pictures/atyadigi.pnm d62a9968f404a5d984e336ebd95f68e9 *inst/pictures/avijonseau.pnm @@ -319,12 +320,12 @@ e3b0339a997676fb728a424b20db4ebe *man/adegraphicsLoaded.Rd a8af05ea4d586e8c7b625a1f0339682f *man/aminoacyl.Rd 249b4c19f78f6aa3474ecc5f7e177075 *man/amova.Rd -970ff230f7e4c37b8db612c5dfdfa7bb *man/apis108.Rd +9b1de95ac28e695890066928148e95ac *man/apis108.Rd 208ec14214b92c594f5cfe076af1cac8 *man/apqe.Rd 18ca41e0078353333d595ad74220dc6a *man/aravo.Rd 2b3a479de8f346040a701a4cb10d3d98 *man/ardeche.Rd 447412b7f57ebf964e0be55eb27fe7f3 *man/area.plot.Rd -4ffac3a403122350d3bf25b048d22108 *man/arrival.Rd +d1e2492547f7244a362a8519e2b9ffd1 *man/arrival.Rd 26759451a77308d6f556575ec677e0d7 *man/as.taxo.Rd d48c9dd29ea109fc24fd73d9b82ec60e *man/atlas.Rd f0cba96fb22a52646c8b24985117704e *man/atya.Rd @@ -349,7 +350,7 @@ d0ab9fd2335bbc6fc9ccf329c3e79b7b *man/carni19.Rd f24f566df0b44c9b44180a3aa3565ad3 *man/carni70.Rd 8db45c0d262f6993068d8a78141550bf *man/carniherbi49.Rd -d5ec74578ed136724aed7b89f862c67b *man/casitas.Rd +4ccf0b89085c82b39617671cb9cc58ab *man/casitas.Rd 36917a4def5673847ad737e21ca0ff09 *man/chatcat.Rd 148d03c767a82f8d666d5862eaaa3b46 *man/chats.Rd db6510a81935c5bb821a0f631a001db0 *man/chazeb.Rd @@ -415,7 +416,7 @@ d8932e7c9545fb802e44acaee5e715c2 *man/is.euclid.Rd faa31ce6d9bc268b91f6db62072891fa *man/julliot.Rd 2bbbff77a1a6fa0d5bb10828c61153bb *man/jv73.Rd -5be96bdf1fbbbc7963849c03b4b3b3e2 *man/kcponds.Rd +f4fc6375fdf07689163f62a4e42b358e *man/kcponds.Rd afc00e97c0ed1bf5b8eb912e21fdd0b6 *man/kdist.Rd b0961249596434ce3a0159a22b41af52 *man/kdist2ktab.Rd 5c5bf2d6728f253c759d57886e8f2920 *man/kdisteuclid.Rd @@ -436,6 +437,9 @@ 8079d383b8fe439a05b5327598c2d8c0 *man/lascaux.Rd a60aec1e73f6e5e44469dc5cae1b6515 *man/lingoes.Rd d4c0558a22707b775e0ff79c7771adf3 *man/lizards.Rd +43dad9f48768d1454f04560426d9634a *man/loocv.bca.Rd +2460374c81a0976c3a713eab05179ef7 *man/loocv.discrimin.Rd +e7031c3e7a6577642215a02b93a578d9 *man/loocv.dudi.Rd ffb4c26da7697a5ed7b1e1edec99d13e *man/macaca.Rd 2e0a5f29e020638da962402a07c41c94 *man/macon.Rd 738d6ad074c9750d7f583d3580886a35 *man/macroloire.Rd @@ -444,8 +448,8 @@ 8b4cdae21e7d8f90d7fcaa9a5250a054 *man/mantel.rtest.Rd fe18b1f6484a339f1641fc864446894e *man/maples.Rd e5bd6190c3964632a6eac8982a5244c9 *man/mariages.Rd -2083f479afedf29247df0fdc61395abc *man/mbpcaiv.Rd -d2d5dd3666ef4cadcb90ab0ac181a0d9 *man/mbpls.Rd +9ba6c227e04469429168582e9a9a3b0d *man/mbpcaiv.Rd +378f539fc0aac14deca2a3bb9cd04171 *man/mbpls.Rd 4fff9cfa974199382a0386f57f28f21a *man/mcoa.Rd faf07f3c20cd21f6fac74cc9aeecac1d *man/mdpcoa.Rd 701ca4c18001cbe33d42124c74595898 *man/meau.Rd @@ -458,7 +462,7 @@ 5ae787bce8773ba944d9daffc2ac6640 *man/monde84.Rd aa0678333c8ba7621a3470615cd2a9f1 *man/morphosport.Rd e5c6a90a580066a1cb959074111a49bd *man/mstree.Rd -0a66f03fa824c011f95cc83fffe697a6 *man/multiblock.Rd +d8b686219e71014db4761a0f583073c9 *man/multiblock.Rd cecb185ac49a0adafc53cbd8471efb90 *man/multispati.Rd 025c831146e303e447aaa9ff8bfd5823 *man/multispati.randtest.Rd 30f6c9a3a1689cae14882fb9d301d778 *man/multispati.rtest.Rd @@ -478,14 +482,14 @@ b33e7fc3381597afc498baead8ca5047 *man/pcaiv.Rd 0fd2c833f564dc8b178b8328c0573d70 *man/pcaivortho.Rd e5af7e7dca04d7a7914bdae08c680c55 *man/pcoscaled.Rd -d4a610cb68738e3538148f6836eac7ee *man/pcw.Rd +4b32aba5f366309250ee7a5795daa58a *man/pcw.Rd 0608d931a3b59ae1577b1b39560db4d1 *man/perthi02.Rd 568f545e65ad7feb3b70f9b725af2690 *man/phylog.Rd 2696ba19f5ba9f562ba5f3ba2ad0833d *man/piosphere.Rd 1002aa586842dd548805751aaaf8e59d *man/plot.between.Rd e2d88196076415810091c8368d110dd2 *man/plot.phylog.Rd 1ecaf862a6ae3394050be4b63ee96ab9 *man/plot.within.Rd -9cee92f46a8db2514211816cb6f16e98 *man/presid2002.Rd +55cac3301626df21c8543d62519d1c70 *man/presid2002.Rd 1e74d3ade86110c4032df7c415a8c3e0 *man/procella.Rd dec90bd68c3510fb1b3aa8f763513309 *man/procuste.Rd 4baf94d13d9feb9f5d82a1af9e857d42 *man/procuste.randtest.Rd @@ -493,7 +497,7 @@ 92f7f004083ccb02f0a6c54342127372 *man/pta.Rd b497a56dd3ede8cd6c40d7316397a682 *man/quasieuclid.Rd dbabb33255dfdbc2a709b9f43b16c644 *man/randboot.Rd -b3312d143490ca1848f89e91c3bb7eb0 *man/randboot.multiblock.Rd +ebc9228ddb7078707b753945e065bee5 *man/randboot.multiblock.Rd 66af2805133b21892d1a27c25998c46a *man/randtest.Rd 2146def722f2489173b73281f8f7eb5b *man/randtest.amova.Rd 1d37cb1c819aa6421c568e977eb13787 *man/randtest.between.Rd @@ -569,7 +573,7 @@ 5dda2bd3b7a9baec7611872a472320d0 *man/tarentaise.Rd 49707fd1338711908204bc755bff9b74 *man/taxo.eg.Rd a52e54243d7afbe5ede4597a081c7637 *man/testdim.Rd -3183df2fe77649d04a60823bc095af96 *man/testdim.multiblock.Rd +354b20ef5260c11f76dce7e0cb21cf16 *man/testdim.multiblock.Rd a7dd35af6744709d16b452fcfe204d1c *man/tintoodiel.Rd 0873ff2c03cfa3379873314253f90b90 *man/tithonia.Rd 1234e35f8fdc5cae3b06ff17652f6f78 *man/tortues.Rd @@ -580,7 +584,7 @@ e852befdc36a81e8785d75b7cf4c0f1e *man/ungulates.Rd 77ba948fc7720a971e8c3724e0f0a023 *man/uniquewt.df.Rd 990dce46e5096ae2710a21272b40cbfe *man/variance.phylog.Rd -444080d8d1ca325add04965c6a51c54c *man/varipart.Rd +96dcd326f778582ac773e0cbac8bb125 *man/varipart.Rd bb50bf8f6978c7cce94bb949afd3366a *man/vegtf.Rd ba7ac081a6b0ab9ad0dcd1fe5671a2d5 *man/veuvage.Rd 7632fa15447224d022a1ce1ee19d2e94 *man/wca.Rd diff -Nru ade4-1.7-15/NAMESPACE ade4-1.7-16/NAMESPACE --- ade4-1.7-15/NAMESPACE 2019-10-21 11:23:56.000000000 +0000 +++ ade4-1.7-16/NAMESPACE 2020-10-20 06:28:59.000000000 +0000 @@ -30,6 +30,9 @@ S3method("kplot","pta") S3method("kplot","sepan") S3method("kplot","statis") +S3method("loocv","dudi") +S3method("loocv","between") +S3method("loocv","discrimin") S3method("plot","4thcorner") S3method("plot","betcoi") S3method("plot","betrlq") @@ -176,10 +179,11 @@ ##################################### importFrom("graphics", "abline", "arrows", "axis", "barplot", "box", "boxplot", "frame", "hist", "image", "layout", "lines", "mtext", "par", "plot.default", "plot", "plot.new", "points", "polygon", "rect", "segments", "strheight", "strwidth", "symbols", "text", "title") importFrom("grDevices", "chull", "dev.cur", "gray", "grey", "n2mfrow") -importFrom("stats", "shapiro.test", "anova", "as.dist", "as.formula", "biplot", "coefficients", "cor", "cov", "cutree", "density", "dist", "dnorm", "hclust", "is.ts", "lm", "lm.wfit", "loess", "model.frame", "model.matrix", "na.omit", "p.adjust", "p.adjust.methods", "pf", "plot.ts", "poly", "ppoints", "predict", "quantile", "residuals", "screeplot", "sd", "symnum", "ts", "ts.union", "var", "weighted.mean") +importFrom("stats", "IQR", "shapiro.test", "anova", "as.dist", "as.formula", "biplot", "coefficients", "cor", "cov", "cutree", "density", "dist", "dnorm", "hclust", "is.ts", "lm", "lm.wfit", "loess", "model.frame", "model.matrix", "na.omit", "p.adjust", "p.adjust.methods", "pf", "plot.ts", "poly", "ppoints", "predict", "quantile", "residuals", "screeplot", "sd", "symnum", "ts", "ts.union", "var", "weighted.mean") importFrom("utils", "modifyList", "read.table", "write.table") importFrom("methods", "setOldClass") importFrom("MASS", "ginv", "kde2d") +importFrom("progress", "progress_bar") ##################################### ## Export ## @@ -196,7 +200,7 @@ export("cailliez", "dist.binary", "dist.ktab", "dist.prop", "dist.quant", "is.euclid", "lingoes", "quasieuclid", "supdist") ## ******* generic ******* -export("bca", "col.names", "col.names<-", "inertia", "kplot", "reconst", "randboot", "randtest", "rtest", "scatter", "score", "supcol", "suprow", "tab.names", "tab.names<-", "testdim", "wca" ) +export("bca", "col.names", "col.names<-", "inertia", "kplot", "loocv", "reconst", "randboot", "randtest", "rtest", "scatter", "score", "supcol", "suprow", "tab.names", "tab.names<-", "testdim", "wca" ) ## ******* graphics ******* export("s.arrow", "s.class", "s.chull", "s.corcircle", "s.distri", "s.hist", "s.image", "s.kde2d", "s.label", "s.logo", "s.match", "s.match.class", "s.multinom", "s.traject", "s.value") diff -Nru ade4-1.7-15/R/loocv.R ade4-1.7-16/R/loocv.R --- ade4-1.7-15/R/loocv.R 1970-01-01 00:00:00.000000000 +0000 +++ ade4-1.7-16/R/loocv.R 2020-10-20 06:28:59.000000000 +0000 @@ -0,0 +1,240 @@ +"loocv" <- function(x, ...) { + UseMethod("loocv") +} + +loocv.between <- function(x, progress = FALSE, ...) + ## Leave-one-out cross-validation for bca + ## x = the bca to be cross-validated + ## progress = logical to display a progress bar + ## Returns a list with the cross-validated row coordinates (XValCoord), + ## the predicted residual error sum of squares (PRESS) for each individual, + ## the total PRESS for each axis, (PRESSTot), + ## the root-mean-square error (RMSE), and + ## RMSEIQR, the interquartile range normalized RMSE. + # +{ + if (!inherits(x, "dudi")) + stop("Object of class dudi expected") + if (!inherits(x, "between")) + stop("Object of class between expected") + bcaCall <- x$call + nf1 <- x$nf + ## Get the parameters of the original analysis: + ## dudi, factor, and number of rows + dudiCall <- eval.parent(bcaCall[[2]]) + fac <- eval.parent(bcaCall[[3]]) + lig1 <- nrow(dudiCall$tab) + if (length(fac) != lig1) + stop("Non convenient dimension") + xcoo1 <- as.data.frame(matrix(0, lig1, nf1)) + mean.w <- function(x, w, fac, cla.w) { + z <- x * w + z <- tapply(z, fac, sum)/cla.w + return(z) + } + if (progress) pb <- progress_bar$new(total = lig1, + format = " Computing [:bar] :percent eta: :eta") + for (ind1 in 1:lig1) { + if (progress) pb$tick() + ## Remove each row of the data table, one at a time, + ## then do the analysis and the bca on the new table + ## and estimate the coordinates of the missing row + # + ## The original analysis can be any dudi, so wee need to start from dudiCall$call: + jcall1 <- dudiCall$call + ## Change the df argument to discard row #ind1: + jcall1[[2]] <- eval.parent(jcall1[[2]])[-ind1, ] + ## Check that the scannf argument is set to FALSE: + if (any(names(jcall1) == "scannf")) jcall1[[which(names(jcall1) == "scannf")]] <- FALSE + else { + ## If scannf is not in the args list, add it and is set to FALSE: + jcall1[[length(jcall1) + 1]] <- quote(FALSE) + names(jcall1)[length(jcall1)] <- "scannf" + } + ## Run the analysis without row #ind1: + if (inherits(dudiCall, "fca") || inherits(dudiCall, "fpca")) { + colblo1 <- attr(jcall1[[2]], "col.blocks") + jcall1[[2]] <- prep.fuzzy.var(jcall1[[2]], colblo1) + } + jdudi1 <- eval.parent(jcall1) + ## Check that axes are in the same direction as orignal analysis axes; + ## if not, change the sign + ## for (j in 1:nf1) + # if (cor(jdudi1$li[,j], dudiCall$li[-ind1,j]) < 0) jdudi1$li[,j] <- -jdudi1$li[,j] + ## then do the BGA on this analysis: + jfac1 <- fac[-ind1] + cla.w1 <- tapply(jdudi1$lw, jfac1, sum) + tabmoy <- apply(jdudi1$tab, 2, mean.w, w = jdudi1$lw, fac = jfac1, cla.w = cla.w1) + tabmoy <- data.frame(tabmoy) + jres <- as.dudi(tabmoy, jdudi1$cw, as.vector(cla.w1), scannf = FALSE, + nf = nf1, call = match.call(), type = "bet") + ## Check that jackknifed axes are in the same direction as original bca axes; + ## if not, change the sign + for (j in 1:nf1) + if (cor(jres$c1[,j], x$c1[,j]) < 0) jres$c1[,j] <- -jres$c1[,j] + U <- as.matrix(jres$c1) * unlist(jres$cw) + ## Compute #ind1 row coordinates in this BGA and store it in xcoo1: + xcoo1[ind1,] <- as.matrix(dudiCall$tab[ind1,]) %*% U + } + PRESS1 <- as.data.frame(matrix(0, lig1, nf1)) + for (j in 1:nf1) PRESS1[,j] <- (xcoo1[,j] - x$ls[,j])^2 + PRESSTot <- colSums(PRESS1) + RMSE <- sqrt(PRESSTot/lig1) + RMSEIQR <- sqrt(PRESSTot/lig1) + for (j in 1:nf1) RMSEIQR[j] <- RMSEIQR[j]/IQR(x$ls[,j]) + names(xcoo1) <- names(PRESS1) <- names(PRESSTot) <- names(RMSE) <- names(RMSEIQR) <- names(x$ls) + res1 <- list(xcoo1, PRESS1, PRESSTot, RMSE, RMSEIQR) + names(res1) <- c("XValCoord", "PRESS", "PRESSTot", "RMSE", "RMSEIQR") + return(res1) +} + +loocv.discrimin <- function(x, progress = FALSE, ...) + ## Leave-one-out cross-validation for discriminant analysis (aka CVA) + ## x = the discrimin analysis to be cross-validated + ## progress = logical to display a progress bar + ## Returns a list with the cross-validated row coordinates (XValCoord), + ## the predicted residual error sum of squares (PRESS) for each individual, + ## the total PRESS for each axis, (PRESSTot), + ## the root-mean-square error (RMSE), and + ## RMSEIQR, the interquartile range normalized RMSE. + # +{ + if (!inherits(x, "discrimin")) + stop("Object of class discrimin expected") + discCall <- x$call + ## Get the parameters of the original analysis: + ## dudi, factor, and number of rows + nf1 <- x$nf + dudiOrig <- eval.parent(discCall[[2]]) + rank <- dudiOrig$rank + dudiOrig <- redo.dudi(dudiOrig, rank) + fac <- eval.parent(discCall[[3]]) + lig1 <- nrow(dudiOrig$tab) + if (length(fac) != lig1) + stop("Non convenient dimension") + xcoo1 <- as.data.frame(matrix(0, lig1, nf1)) + mean.w <- function(x, w, fac, cla.w) { + z <- x * w + z <- tapply(z, fac, sum)/cla.w + return(z) + } + if (progress) pb <- progress_bar$new(total = lig1, + format = " Computing [:bar] :percent eta: :eta") + for (ind1 in 1:lig1) { + if (progress) pb$tick() + ## Remove each row of the data table, one at a time, + ## then do the original analysis and the discriminant analysis + ## on the new table and estimate the coordinates of the missing row + # + ## The original analysis can be any dudi, so wee need to start from dudiOrig$call: + origCall <- dudiOrig$call + ## Change the df argument to discard row #ind1: + origCall[[2]] <- eval.parent(origCall[[2]])[-ind1, ] + ## Check that the scannf argument is set to FALSE: + if (any(names(origCall) == "scannf")) origCall[[which(names(origCall) == "scannf")]] <- FALSE + else { + ## If scannf is not in the args list, add it and is set to FALSE: + origCall[[length(origCall) + 1]] <- quote(FALSE) + names(origCall)[length(origCall)] <- "scannf" + } + if (inherits(dudiOrig, "fca") || inherits(dudiOrig, "fpca")) { + colblo1 <- attr(origCall[[2]], "col.blocks") + origCall[[2]] <- prep.fuzzy.var(origCall[[2]], colblo1) + } + ## Run the analysis without row #ind1: + dudi1 <- eval.parent(origCall) + rank1 <- dudi1$rank + dudi1 <- redo.dudi(dudi1, rank1) + ## Check that axes are in the same direction as orignal analysis axes; + ## if not, change the sign + ## for (j in 1:nf1) + # if (cor(dudi1$li[,j], dudiOrig$li[-ind1,j]) < 0) dudi1$li[,j] <- -dudi1$li[,j] + ## then do the discriminant analysis: + jfac1 <- fac[-ind1] + disc2 <- discrimin(dudi1, jfac1, scannf = FALSE) + ## Check that jackknifed axes are in the same direction as original discrimin axes; + ## if not, change the sign + for (j in 1:nf1) + if (cor(disc2$fa[,j], x$fa[,j]) < 0) disc2$fa[,j] <- -disc2$fa[,j] + ## Compute #ind1 row coordinates in this discriminant analysis and store it in xcoo1: + xcoo1[ind1,] <- as.matrix(dudiOrig$tab[ind1,]) %*% as.matrix(disc2$fa) + } + PRESS1 <- as.data.frame(matrix(0, lig1, nf1)) + for (j in 1:nf1) PRESS1[,j] <- (xcoo1[,j] - x$li[,j])^2 + PRESSTot <- colSums(PRESS1) + RMSE <- sqrt(PRESSTot/lig1) + RMSEIQR <- sqrt(PRESSTot/lig1) + for (j in 1:nf1) RMSEIQR[j] <- RMSEIQR[j]/IQR(x$li[,j]) + names(xcoo1) <- names(PRESS1) <- names(PRESSTot) <- names(RMSE) <- names(RMSEIQR) <- names(x$li[1:nf1]) + res1 <- list(xcoo1, PRESS1, PRESSTot, RMSE, RMSEIQR) + names(res1) <- c("XValCoord", "PRESS", "PRESSTot", "RMSE", "RMSEIQR") + return(res1) +} + +loocv.dudi <- function(x, progress = FALSE, ...) + ## Leave-one-out cross-validation for a dudi analysis + ## x = the dudi to be cross-validated + ## progress = logical to display a progress bar + ## Returns a list with the cross-validated row coordinates (XValCoord), + ## the predicted residual error sum of squares (PRESS) for each individual, + ## the total PRESS for each axis, (PRESSTot), + ## the root-mean-square error (RMSE), and + ## RMSEIQR, the interquartile range normalized RMSE. + # +{ + if (!inherits(x, "dudi")) + stop("Object of class dudi expected") + if (!(inherits(x, "pca") | inherits(x, "coa") | inherits(x, "acm"))) + stop("Leave-one-out cross-validation not available for this type of analysis") + dudiCall <- x$call + nf1 <- x$nf + tab1 <- eval.parent(dudiCall[[2]]) + lig1 <- nrow(tab1) + xcoo1 <- as.data.frame(matrix(0, lig1, nf1)) + if (progress) pb <- progress_bar$new(total = lig1, + format = " Computing [:bar] :percent eta: :eta") + for (ind1 in 1:lig1) { + if (progress) pb$tick() + ## Remove each row of the data table, one at a time, + ## then do the analysis on the new table and estimate the coordinates + ## of all the rows except the one that was removed + # + tab2 <- tab1[-ind1, ] + ## Check that the scannf argument is set to FALSE: + if (any(names(dudiCall) == "scannf")) dudiCall[[which(names(dudiCall) == "scannf")]] <- FALSE + else { + ## If scannf is not in the args list, add it and is set to FALSE: + dudiCall[[length(dudiCall) + 1]] <- quote(FALSE) + names(dudiCall)[length(dudiCall)] <- "scannf" + } + ## Set the nf argument to the value of the nf of the analysis: + if (any(names(dudiCall) == "nf")) dudiCall[[which(names(dudiCall) == "nf")]] <- nf1 + ## If nf is not in the args list, add it and is set to nf1: + else { + dudiCall[[length(dudiCall) + 1]] <- nf1 + names(dudiCall)[length(dudiCall)] <- "nf" + } + ## Run the analysis without row #ind1: + dudiCall[[2]] <- tab2 + jdudi <- eval.parent(dudiCall) + ## Check that axes are in the same direction as orignal analysis axes; if not, change the sign + for (j in 1:nf1) + if (cor(jdudi$c1[, j], x$c1[, j]) < 0) jdudi$c1[,j] <- -jdudi$c1[,j] + + ## Compute #ind1 row coordinates in the analysis and store it in xcoo1: + xcoo1[ind1, ] <- as.matrix(x$tab[ind1, , drop = FALSE]) %*% (as.matrix(jdudi$c1) * jdudi$cw) + + } + + + PRESS1 <- as.data.frame(matrix(0, lig1, nf1)) + for (j in 1:nf1) PRESS1[,j] <- (xcoo1[,j] - x$li[,j])^2 + PRESSTot <- colSums(PRESS1) + RMSE <- sqrt(PRESSTot/lig1) + RMSEIQR <- sqrt(PRESSTot/lig1) + for (j in 1:nf1) RMSEIQR[j] <- RMSEIQR[j]/IQR(x$li[,j]) + names(xcoo1) <- names(PRESS1) <- names(PRESSTot) <- names(RMSE) <- names(RMSEIQR) <- names(x$li[1:nf1]) + res1 <- list(xcoo1, PRESS1, PRESSTot, RMSE, RMSEIQR) + names(res1) <- c("XValCoord", "PRESS", "PRESSTot", "RMSE", "RMSEIQR") + return(res1) +} diff -Nru ade4-1.7-15/R/mbpcaiv.R ade4-1.7-16/R/mbpcaiv.R --- ade4-1.7-15/R/mbpcaiv.R 2020-02-13 08:57:14.000000000 +0000 +++ ade4-1.7-16/R/mbpcaiv.R 2020-10-16 11:22:21.000000000 +0000 @@ -24,12 +24,8 @@ nf <- 2 ## Only works with centred pca (dudi.pca with center=TRUE) with uniform row weights - # if (!any(dudi.type(dudiY$call) == c(3,4))) - # stop("Only implemented for centred pca") - - # Vérifier la formule / arrondi - #if (any(dudiY$lw != 1/nrow(dudiY$tab))) - # stop("Only implemented for uniform row weights") + if (!any(dudi.type(dudiY$call) == c(3,4))) + stop("Only implemented for centred pca") option <- match.arg(option) @@ -38,7 +34,7 @@ ## ------------------------------------------------------------------------------- ## Preparation of the data frames - Y <- scalewt(as.matrix(dudiY$tab), wt = dudiY$lw, center = TRUE, scale = scale) + Y <- as.matrix(dudiY$tab) nblo <- length(ktabX$blo) Xk <- lapply(unclass(ktabX)[1 : nblo], scalewt, wt = ktabX$lw, center = TRUE, scale = scale) @@ -185,19 +181,6 @@ res$XYcoef <- lapply(1:ncolY, function(x) t(apply(sweep(res$faX, 2 , res$Yco[x,] / norm.li, "*"), 1, cumsum))) names(res$XYcoef) <- colnames(dudiY$tab) - ## Computing the intercept - X <- cbind.data.frame(lapply(unclass(ktabX)[1 : nblo], scalewt, wt = dudiY$lw, center = FALSE, scale = scale)) - if (any(apply(X, 2, weighted.mean, w = dudiY$lw) < sqrt(.Machine$double.eps)) == FALSE & scale == TRUE) { - ## i.e. center=F, scale=T - meanY <- apply(sweep(as.matrix(dudiY$tab), 2, sqrt(apply(dudiY$tab, 2, varwt, wt = dudiY$lw)), "/"), 2, weighted.mean, w = dudiY$lw) - meanX <- apply(sweep(as.matrix(X), 2, sqrt(apply(X, 2, varwt, wt = dudiY$lw)), "/"), 2, weighted.mean, w = dudiY$lw) - } else { - meanY <- apply(as.matrix(dudiY$tab), 2, weighted.mean, w = dudiY$lw) - meanX <- apply(as.matrix(X), 2, weighted.mean, w = dudiY$lw) - } - res$intercept <- lapply(1:ncolY, function(x) (meanY[x] - meanX %*% res$XYcoef[[x]])) - names(res$intercept) <- colnames(dudiY$tab) - ##----------------------------------------------------------------------- ## Variable and block importances ##----------------------------------------------------------------------- @@ -240,7 +223,6 @@ res$Tli <- do.call("rbind", res$Tli) res <- modifyList(res, lapply(res[c("Yc1", "Yco", "lY", "Tfa", "Tl1", "Tli", "cov2", "faX", "vip", "vipc", "bip", "bipc")], function(x) x[, 1:res$nf, drop = FALSE])) res$XYcoef <- lapply(res$XYcoef, function(x) x[, 1:res$nf, drop = FALSE]) - res$intercept <- lapply(res$intercept, function(x) x[, 1:res$nf, drop = FALSE]) res$call <- match.call() class(res) <- c("multiblock", "mbpcaiv") return(res) diff -Nru ade4-1.7-15/R/mbpls.R ade4-1.7-16/R/mbpls.R --- ade4-1.7-15/R/mbpls.R 2020-02-13 08:58:37.000000000 +0000 +++ ade4-1.7-16/R/mbpls.R 2020-10-16 11:22:21.000000000 +0000 @@ -24,8 +24,8 @@ nf <- 2 ## Only works with centred pca (dudi.pca with center=TRUE) with uniform row weights - #if (!any(dudi.type(dudiY$call) == c(3,4))) - # stop("Only implemented for centred pca") + if (!any(dudi.type(dudiY$call) == c(3,4))) + stop("Only implemented for centred pca") # Vérifier la formule / arrondi #if (any(dudiY$lw != 1/nrow(dudiY$tab))) @@ -38,7 +38,7 @@ ## ------------------------------------------------------------------------------- ## Preparation of the data frames - Y <- scalewt(as.matrix(dudiY$tab), wt = dudiY$lw, center = TRUE, scale = scale) + Y <- as.matrix(dudiY$tab) nblo <- length(ktabX$blo) Xk <- lapply(unclass(ktabX)[1 : nblo], scalewt, wt = ktabX$lw, center = TRUE, scale = scale) @@ -177,19 +177,6 @@ res$XYcoef <- lapply(1:ncolY, function(x) t(apply(sweep(res$faX, 2 , res$Yco[x,] / norm.li, "*"), 1, cumsum))) names(res$XYcoef) <- colnames(dudiY$tab) - ## Computing the intercept - X <- cbind.data.frame(lapply(unclass(ktabX)[1 : nblo], scalewt, wt = dudiY$lw, center = FALSE, scale = scale)) - if (any(apply(X, 2, weighted.mean, w = dudiY$lw) < sqrt(.Machine$double.eps)) == FALSE & scale == TRUE) { - ## i.e. center=F, scale=T - meanY <- apply(sweep(as.matrix(dudiY$tab), 2, sqrt(apply(dudiY$tab, 2, varwt, wt = dudiY$lw)), "/"), 2, weighted.mean, w = dudiY$lw) - meanX <- apply(sweep(as.matrix(X), 2, sqrt(apply(X, 2, varwt, wt = dudiY$lw)), "/"), 2, weighted.mean, w = dudiY$lw) - } else { - meanY <- apply(as.matrix(dudiY$tab), 2, weighted.mean, w = dudiY$lw) - meanX <- apply(as.matrix(X), 2, weighted.mean, w = dudiY$lw) - } - res$intercept <- lapply(1:ncolY, function(x) (meanY[x] - meanX %*% res$XYcoef[[x]])) - names(res$intercept) <- colnames(dudiY$tab) - ##----------------------------------------------------------------------- ## Variable and block importances ##----------------------------------------------------------------------- @@ -232,7 +219,6 @@ res <- modifyList(res, lapply(res[c("Yc1", "Yco", "lY", "Tc1", "TlX", "cov2", "faX", "vip", "vipc", "bip", "bipc")], function(x) x[, 1:res$nf, drop = FALSE])) res$XYcoef <- lapply(res$XYcoef, function(x) x[, 1:res$nf, drop = FALSE]) - res$intercept <- lapply(res$intercept, function(x) x[, 1:res$nf, drop = FALSE]) res$call <- match.call() class(res) <- c("multiblock", "mbpls") return(res) diff -Nru ade4-1.7-15/R/multiblock.R ade4-1.7-16/R/multiblock.R --- ade4-1.7-15/R/multiblock.R 2020-02-13 08:58:37.000000000 +0000 +++ ade4-1.7-16/R/multiblock.R 2020-10-16 11:22:21.000000000 +0000 @@ -16,7 +16,6 @@ Y <- eval.parent(appel$dudiY) nr <- nrow(Y$tab) ncY <- ncol(Y$tab) - h <- object$rank nblo <- length(object$blo) ## number of X tables ncX <- sum(X$blo) ## total number of variables in X @@ -37,7 +36,8 @@ for (i in 1 : nrepet){ s <- sample(x = nr, replace = TRUE) Xboot <- X[, s, ] - Yboot <- Y[s, ] + Yboot <- Y[s, ] + Yboot$call <- Y$call # to pass dudi.type resboot <- do.call(method, list(dudiY = Yboot, ktabX = Xboot, scale = scale, option = option, scannf = FALSE, nf = as.integer(optdim))) @@ -94,21 +94,18 @@ Xv <- X[, -s, ] Yc <- Y[s, ] Yv <- Y[-s, ] + Yc$call <- Yv$call <- Y$call # to pass dudi.type ## Applying the multiblock method to the calibration/validation datasets rescal <- do.call(method, list(dudiY = Yc, ktabX = Xc, scale = scale, option = option, scannf = FALSE, nf = h)) resval <- do.call(method, list(dudiY = Yv, ktabX = Xv, scale = scale, option = option, scannf = FALSE, nf = h)) ## Compute Root Mean Square Errors of Calibration (RMSEC) and Validation (RMSEV) - nblo <- length(Xc$blo) - Xc.mat <- cbind.data.frame(unclass(Xc)[1:nblo]) - Xv.mat <- cbind.data.frame(unclass(Xv)[1:nblo]) for(j in 1 : min(rescal$rank, resval$rank, h)){ XYcoef.cal <- sapply(rescal$XYcoef, function(x) x[, j]) - intercept.cal <- sapply(rescal$intercept, function(x) x[, j]) - residYc <- as.matrix(Yc$tab) - (matrix(rep(intercept.cal, each = Nc), ncol = q) + as.matrix(Xc.mat) %*% XYcoef.cal) - RMSEC[i, j] <- sqrt(sum(residYc^2) / (Nc * q)) - residYv <- as.matrix(Yv$tab) - (matrix(rep(intercept.cal, each = Nv), ncol = q) + as.matrix(Xv.mat) %*% XYcoef.cal) + residYc <- as.matrix(rescal$tabY) - as.matrix(rescal$tabX) %*% XYcoef.cal + RMSEC[i, j] <- sqrt(sum(residYc^2) / (Nc * q)) + residYv <- as.matrix(resval$tabY) - as.matrix(resval$tabX) %*% XYcoef.cal RMSEV[i, j] <- sqrt(sum(residYv^2) / (Nv * q)) } } diff -Nru ade4-1.7-15/R/suprow.R ade4-1.7-16/R/suprow.R --- ade4-1.7-15/R/suprow.R 2018-03-14 15:05:38.000000000 +0000 +++ ade4-1.7-16/R/suprow.R 2020-10-16 11:22:21.000000000 +0000 @@ -35,8 +35,8 @@ "suprow.dudi" <- function (x, Xsup, ...) { # modif pour Culhane, Aedin" # suprow renvoie une liste à deux éléments tabsup et lisup - warning("The use of the 'suprow.dudi' method requires that the - supplementary table has been transformed as the original table") + warning("The use of the 'suprow.dudi' method requires that the ", + "supplementary table has been transformed as the original table") Xsup <- data.frame(Xsup) if (!inherits(x, "dudi")) stop("Object of class 'dudi' expected") @@ -155,4 +155,4 @@ coosup <- data.frame(coosup, row.names = row.names(Xsup)) names(coosup) <- names(x$li) return(list(tabsup = Xsup, lisup = coosup)) -} \ No newline at end of file +}