diff -Nru r-cran-energy-1.7-0/debian/changelog r-cran-energy-1.7-2/debian/changelog --- r-cran-energy-1.7-0/debian/changelog 2017-11-03 05:36:42.000000000 +0000 +++ r-cran-energy-1.7-2/debian/changelog 2017-11-03 05:36:42.000000000 +0000 @@ -1,8 +1,12 @@ -r-cran-energy (1.7-0-2build1) artful; urgency=medium +r-cran-energy (1.7-2-1) unstable; urgency=medium - * No-change rebuild to pick up r-api-3.4 + * New upstream release + + * debian/control: Set Standards-Version: to current version + * debian/control: Set Build-Depends: to current R version + * debian/compat: Increase to 10 - -- Graham Inggs Thu, 28 Sep 2017 08:02:18 +0000 + -- Dirk Eddelbuettel Wed, 20 Sep 2017 06:21:48 -0500 r-cran-energy (1.7-0-2) unstable; urgency=medium diff -Nru r-cran-energy-1.7-0/debian/compat r-cran-energy-1.7-2/debian/compat --- r-cran-energy-1.7-0/debian/compat 2017-11-03 05:36:42.000000000 +0000 +++ r-cran-energy-1.7-2/debian/compat 2017-11-03 05:36:42.000000000 +0000 @@ -1 +1 @@ -7 +10 diff -Nru r-cran-energy-1.7-0/debian/control r-cran-energy-1.7-2/debian/control --- r-cran-energy-1.7-0/debian/control 2017-11-03 05:36:42.000000000 +0000 +++ r-cran-energy-1.7-2/debian/control 2017-11-03 05:36:42.000000000 +0000 @@ -2,8 +2,8 @@ Section: gnu-r Priority: optional Maintainer: Dirk Eddelbuettel -Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.4.0), cdbs, r-cran-boot, r-cran-rcpp -Standards-Version: 3.9.8 +Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.4.1), cdbs, r-cran-boot, r-cran-rcpp +Standards-Version: 4.0.0 Package: r-cran-energy Architecture: any diff -Nru r-cran-energy-1.7-0/DESCRIPTION r-cran-energy-1.7-2/DESCRIPTION --- r-cran-energy-1.7-0/DESCRIPTION 2016-08-26 05:34:19.000000000 +0000 +++ r-cran-energy-1.7-2/DESCRIPTION 2017-09-14 22:25:08.000000000 +0000 @@ -1,7 +1,7 @@ Package: energy Title: E-Statistics: Multivariate Inference via the Energy of Data -Version: 1.7-0 -Date: 2016-08-25 +Version: 1.7-2 +Date: 2017-09-14 Author: Maria L. Rizzo and Gabor J. Szekely Description: E-statistics (energy) tests and statistics for multivariate and univariate inference, including distance correlation, one-sample, two-sample, and multi-sample tests for @@ -14,8 +14,9 @@ Imports: Rcpp (>= 0.12.6), stats, boot LinkingTo: Rcpp Suggests: MASS +URL: https://github.com/mariarizzo/energy License: GPL (>= 2) NeedsCompilation: yes Repository: CRAN -Packaged: 2016-08-26 00:41:32 UTC; Maria -Date/Publication: 2016-08-26 07:34:19 +Packaged: 2017-09-14 17:47:42 UTC; Maria +Date/Publication: 2017-09-14 22:25:08 UTC diff -Nru r-cran-energy-1.7-0/man/dcov.test.Rd r-cran-energy-1.7-2/man/dcov.test.Rd --- r-cran-energy-1.7-0/man/dcov.test.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/dcov.test.Rd 2017-09-14 16:43:42.000000000 +0000 @@ -1,13 +1,15 @@ \name{dcov.test} \alias{distance covariance} \alias{dcov.test} -\title{ Distance Covariance Test} +\alias{dcor.test} +\title{ Distance Covariance Test and Distance Correlation test} \description{ - Distance covariance test of multivariate independence. + Distance covariance test and distance correlation test of multivariate independence. Distance covariance and distance correlation are multivariate measures of dependence.} \usage{ -dcov.test(x, y, index = 1.0, R=0) +dcov.test(x, y, index = 1.0, R = NULL) +dcor.test(x, y, index = 1.0, R) } \arguments{ \item{x}{ data or distances of first sample} @@ -16,8 +18,8 @@ \item{index}{ exponent on Euclidean distance, in (0,2]} } \details{ - \code{dcov.test} performs a nonparametric - test of multivariate independence. The test decision is + \code{dcov.test} and \code{dcor.test} are nonparametric + tests of multivariate independence. The test decision is obtained via permutation bootstrap, with \code{R} replicates. The sample sizes (number of rows) of the two samples must @@ -25,13 +27,16 @@ \code{x}, \code{y} can optionally be \code{\link{dist}} objects; otherwise these arguments are treated as data. - The statistic is + The \code{dcov} test statistic is \eqn{n \mathcal V_n^2}{nV_n^2} where \eqn{\mathcal V_n(x,y)}{V_n(x,y)} = dcov(x,y), which is based on interpoint Euclidean distances \eqn{\|x_{i}-x_{j}\|}{||x_{i}-x_{j}||}. The \code{index} is an optional exponent on Euclidean distance. +Similarly, the \code{dcor} test statistic is based on the normalized +coefficient, the distance correlation. (See the manual page for \code{dcor}.) + Distance correlation is a new measure of dependence between random vectors introduced by Szekely, Rizzo, and Bakirov (2007). For all distributions with finite first moments, distance @@ -61,18 +66,19 @@ theoretical properties of the test, including statistical consistency. } \value{ -\code{dcov.test} returns a list with class \code{htest} containing +\code{dcov.test} or \code{dcor.test} returns a list with class \code{htest} containing \item{ method}{ description of test} \item{ statistic}{ observed value of the test statistic} - \item{ estimate}{ dCov(x,y)} + \item{ estimate}{ dCov(x,y) or dCor(x,y)} \item{ estimates}{ a vector: [dCov(x,y), dCor(x,y), dVar(x), dVar(y)]} \item{ replicates}{ replicates of the test statistic} \item{ p.value}{ approximate p-value of the test} + \item{ n}{ sample size} \item{ data.name}{ description of data} } -\note{For the test of independence, +\note{For the dcov test of independence, the distance covariance test statistic is the V-statistic -\eqn{\mathrm{n\, dCov^2} = n \mathcal{V}_n^2}{n V_n^2} (not dCov). +\eqn{\mathrm{n\, dCov^2} = n \mathcal{V}_n^2}{n V_n^2} (not dCov). } \seealso{ \code{\link{dcov} } \code{\link{dcor} } \code{\link{DCOR}} @@ -102,7 +108,10 @@ x <- iris[1:50, 1:4] y <- iris[51:100, 1:4] set.seed(1) + dcor.test(dist(x), dist(y), R=199) + set.seed(1) dcov.test(x, y, R=199) + \dontrun{ set.seed(1) dcov.test(dist(x), dist(y), R=199) #same thing diff -Nru r-cran-energy-1.7-0/man/disco.Rd r-cran-energy-1.7-2/man/disco.Rd --- r-cran-energy-1.7-0/man/disco.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/disco.Rd 2017-08-18 12:57:08.000000000 +0000 @@ -8,8 +8,8 @@ and anova. } \usage{ -disco(x, factors, distance, index=1.0, R=0, method=c("disco","discoB","discoF")) -disco.between(x, factors, distance, index=1.0, R=0) +disco(x, factors, distance, index=1.0, R, method=c("disco","discoB","discoF")) +disco.between(x, factors, distance, index=1.0, R) } \arguments{ \item{x}{ data matrix or distance matrix} @@ -110,7 +110,7 @@ disco(Y, factors=rate, R=99, method="discoB") ## Just extract the decomposition table - disco(Y, factors=rate)$stats + disco(Y, factors=rate, R=0)$stats ## Compare eqdist.e methods for rate ## disco between stat is half of original when sample sizes equal @@ -118,7 +118,7 @@ eqdist.e(Y, sizes=c(10, 10), method="discoB") ## The between-sample distance component - disco.between(Y, factors=rate) + disco.between(Y, factors=rate, R=0) } \keyword{ htest } \keyword{ multivariate } diff -Nru r-cran-energy-1.7-0/man/energy-deprecated.Rd r-cran-energy-1.7-2/man/energy-deprecated.Rd --- r-cran-energy-1.7-0/man/energy-deprecated.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/energy-deprecated.Rd 2017-08-14 17:07:12.000000000 +0000 @@ -6,7 +6,7 @@ Computes a multivariate nonparametric E-statistic and test of independence.} \usage{ indep.e(x, y) -indep.etest(x, y, R=0) +indep.etest(x, y, R) } \arguments{ \item{x}{ matrix: first sample, observations in rows} diff -Nru r-cran-energy-1.7-0/man/energy-package.Rd r-cran-energy-1.7-2/man/energy-package.Rd --- r-cran-energy-1.7-0/man/energy-package.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/energy-package.Rd 2017-08-18 13:24:47.000000000 +0000 @@ -26,6 +26,10 @@ M. L. Rizzo and G. J. Szekely (2016). Energy Distance, \emph{WIRES Computational Statistics}, Wiley, Volume 8 Issue 1, 27-38. Available online Dec., 2015, \url{http://dx.doi.org/10.1002/wics.1375}. + +G. J. Szekely and M. L. Rizzo (2017). The Energy of Data. +\emph{The Annual Review of Statistics and Its Application} +4:447-79. \url{10.1146/annurev-statistics-060116-054026} } \keyword{ package } \keyword{ multivariate } diff -Nru r-cran-energy-1.7-0/man/eqdist.etest.Rd r-cran-energy-1.7-2/man/eqdist.etest.Rd --- r-cran-energy-1.7-0/man/eqdist.etest.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/eqdist.etest.Rd 2017-08-14 13:03:28.000000000 +0000 @@ -9,7 +9,7 @@ } \usage{ eqdist.etest(x, sizes, distance = FALSE, - method=c("original","discoB","discoF"), R = 0) + method=c("original","discoB","discoF"), R) eqdist.e(x, sizes, distance = FALSE, method=c("original","discoB","discoF")) ksample.e(x, sizes, distance = FALSE, diff -Nru r-cran-energy-1.7-0/man/indep.test.Rd r-cran-energy-1.7-2/man/indep.test.Rd --- r-cran-energy-1.7-0/man/indep.test.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/indep.test.Rd 2017-08-14 13:08:09.000000000 +0000 @@ -7,7 +7,7 @@ \code{\link{dcov.test}}. } \usage{ -indep.test(x, y, method = c("dcov","mvI"), index = 1, R=0) +indep.test(x, y, method = c("dcov","mvI"), index = 1, R) } \arguments{ \item{x}{ matrix: first sample, observations in rows} diff -Nru r-cran-energy-1.7-0/man/mvI.test.Rd r-cran-energy-1.7-2/man/mvI.test.Rd --- r-cran-energy-1.7-0/man/mvI.test.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/mvI.test.Rd 2017-08-14 17:03:10.000000000 +0000 @@ -6,7 +6,7 @@ Computes the multivariate nonparametric E-statistic and test of independence based on independence coefficient \eqn{\mathcal I_n}{I_n}.} \usage{ - mvI.test(x, y, R=0) + mvI.test(x, y, R) mvI(x, y) } \arguments{ diff -Nru r-cran-energy-1.7-0/man/mvnorm-etest.Rd r-cran-energy-1.7-2/man/mvnorm-etest.Rd --- r-cran-energy-1.7-0/man/mvnorm-etest.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/mvnorm-etest.Rd 2017-08-14 13:02:56.000000000 +0000 @@ -7,7 +7,7 @@ Performs the E-statistic (energy) test of multivariate or univariate normality. } \usage{ - mvnorm.etest(x, R=0) + mvnorm.etest(x, R) mvnorm.e(x) normal.e(x) } @@ -36,6 +36,8 @@ The \eqn{\mathcal{E}}{E}-test of multivariate (univariate) normality is implemented by parametric bootstrap with \code{R} replicates. + + If \code{R=0} the summary for the test gives the test statistic only (no p-value). } \value{ The value of the \eqn{\mathcal{E}}{E}-statistic for univariate diff -Nru r-cran-energy-1.7-0/man/poisson.mtest.Rd r-cran-energy-1.7-2/man/poisson.mtest.Rd --- r-cran-energy-1.7-0/man/poisson.mtest.Rd 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/man/poisson.mtest.Rd 2017-08-14 16:59:34.000000000 +0000 @@ -7,7 +7,7 @@ with unknown parameter. } \usage{ -poisson.mtest(x, R = 0) +poisson.mtest(x, R) poisson.m(x) } \arguments{ diff -Nru r-cran-energy-1.7-0/MD5 r-cran-energy-1.7-2/MD5 --- r-cran-energy-1.7-0/MD5 2016-08-26 05:34:19.000000000 +0000 +++ r-cran-energy-1.7-2/MD5 2017-09-14 22:25:08.000000000 +0000 @@ -1,17 +1,17 @@ -034a1a1d71370f0779e5156ca2214d9f *DESCRIPTION -604a445db55ed22dd1a3bd81742848db *NAMESPACE -57aa5a28bfc8bd66447cb3ddd7dd2bc2 *NEWS +65a6927f246f71c78ca2940088747d97 *DESCRIPTION +06ac70e0e00da5ebc888991d170fedc9 *NAMESPACE +6ca0ab4c1370e6aff3a350cf6b1debb4 *NEWS 60c944921e1c68681babcce658ef512c *R/Ecluster.R -c4137b9919f0ca46ed5a510da10c8100 *R/Eeqdist.R -ff264782affcfc5744480189a69d034e *R/Eindep.R -539ef4cbac5648338a04b75d175076d4 *R/Emvnorm.R -8cdef4328b0f26f1a0b5b4fa07aae066 *R/Epoisson.R -47b5f604b8151f7a49c133fbd7ec1545 *R/RcppExports.R +8b428dedf82ffb7e15422ff9f49addf4 *R/Eeqdist.R +9af28751dd6b8ed9afdc45ed3fec5cff *R/Eindep.R +a0d3a418969b10f0312159869dfae2ae *R/Emvnorm.R +ee422cbbaab6e95389cbf3c90db51441 *R/Epoisson.R +df14913c2355403486761709b1d0571e *R/RcppExports.R f09a74b96ef85633d5a8f3a875ef84db *R/centering.R 0c3566c2bc56e52b05e733e2ef9e6c69 *R/dcorT.R -3286ce9ae6131db918caa7cbe6c4f9a5 *R/dcov.R +ae0b5579d71db5b253d1ece0801b02fa *R/dcov.R aa0cd56cb4314d09fa6fe7381e2732f0 *R/dcovu.R -de7562d6c9ab374cf34e4570129f6038 *R/disco.R +d0e402aef2cafec0f7fad15a91e6835e *R/disco.R ab6155ea80b037f78dfbee4e179d4c4f *R/edist.R b59b194449218e1668ddbdc5811d010c *R/pdcor.R 99d4997266887901ee6a62763e5ecfb8 *R/pdcov-test.R @@ -19,29 +19,30 @@ 0106d2186ba21e28b9eef5f747c224bb *man/centering.Rd 21887eadf04293b14c48b56186a9a7ab *man/dcor.ttest.Rd c3c4f6a98c07966047d0114a96dbebc4 *man/dcov.Rd -ae780b98d53832c9b9d9f486c058c64d *man/dcov.test.Rd +7abdb2f8b9fff293f984ba7c9e4b1f61 *man/dcov.test.Rd 20cc1dbf1690caba9464df08f1b542d5 *man/dcovu.Rd -532590b3ac7bd7387112c6be913ebaaa *man/disco.Rd +681fa084592005760e5fd97e550c70e6 *man/disco.Rd bc9faea760233d2ff7c38702cf061d4c *man/edist.Rd -f457ce66d2dbb347fc77ab69944be046 *man/energy-deprecated.Rd -05481cc36ce4cf27d42065c5cf7099cb *man/energy-package.Rd +e4429a99d2add1f38a742331f6d578d9 *man/energy-deprecated.Rd +97bdc56c7e04ba90c96f18ab4e9311b9 *man/energy-package.Rd b918f4703f7ff7a298dce7ed3e324477 *man/energy.hclust.Rd -d89c02577273274fcda34c6a2e0f4931 *man/eqdist.etest.Rd -d953c42e0f998a49b86607b15f72967e *man/indep.test.Rd -19b7bd7b3baae3a20d224e5db04d630c *man/mvI.test.Rd -724fa436f64a683d9cdf89449c778e2e *man/mvnorm-etest.Rd +296495b40f99e3d4264f8285f2072ac4 *man/eqdist.etest.Rd +ab71ed8778965add0a0a215d3e6e177e *man/indep.test.Rd +f0a60791a303c425609a68651c549e26 *man/mvI.test.Rd +ec44802e62875b25b1b167756d09075a *man/mvnorm-etest.Rd 6e62676733a8a8cdbaed67b8d0c00048 *man/pdcor.Rd -5ef7194c5e567e40611fede069de5392 *man/poisson.mtest.Rd +ee92472463df0214c11d4e2d825987bc *man/poisson.mtest.Rd 727842fcced81550ab308552381b5b1b *src/ECl.cc 60f2661bf08b2295e345cf799b8bb28e *src/ECl.h f93deb94d53b0be60435ac02150a8009 *src/Ecluster.cc 2a0d7e13abeedc9d58e8c8b438d93f50 *src/Eindep.c -6595598537f8e39a793e9b6341bf35d0 *src/RcppExports.cpp +ca127e0cff65055beff4b60d5fb5b8d3 *src/RcppExports.cpp c560954ffd313a1b0aeb9ede7f73c4d1 *src/U-product.cpp 932a45c4fe940a27be100c2c5ca3468c *src/centering.cpp da0b2398098bc08ae54f647b29cf60b5 *src/dcov.c fe3940cdfcef45def8b3aec42b66c1cd *src/dcovU.cpp aff0782a38beac801051d6f741566a1a *src/energy.c +345eebf91336a105c74f7c99a4c321a5 *src/energy_init.c 663ee0e9767da39329a65a8bd86b7134 *src/mvnorm.cpp 6f5eba31cc00fe9daecaabfcfa182975 *src/partial-dcor.cpp 991223944feae331d405ae200899f71a *src/projection.cpp diff -Nru r-cran-energy-1.7-0/NAMESPACE r-cran-energy-1.7-2/NAMESPACE --- r-cran-energy-1.7-0/NAMESPACE 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/NAMESPACE 2017-08-14 17:59:13.000000000 +0000 @@ -1,4 +1,4 @@ -useDynLib(energy) +useDynLib(energy, .registration=TRUE) importFrom(Rcpp, evalCpp) importFrom("stats", "as.dist", "dist", "dnorm", "hclust", "model.matrix", @@ -12,6 +12,7 @@ dcor, DCOR, dcor.t, + dcor.test, dcor.ttest, dcov, dcov.test, diff -Nru r-cran-energy-1.7-0/NEWS r-cran-energy-1.7-2/NEWS --- r-cran-energy-1.7-0/NEWS 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/NEWS 2017-09-14 16:07:22.000000000 +0000 @@ -1,3 +1,14 @@ +Changes to version 1.7-2 + + o User level changes + - Provided new dcor.test function, similar to dcov.test but using the + distance correlation as the test statistic. + - Number of replicates R for Monte Carlo and permutation tests now matches + the argument of the boot::boot function (no default value, user must specify). + - If user runs a test with 0 replicates, p-value printed is NA + o Internal changes + - energy_init.c added for registering routines + Changes to version 1.7-0 o Partial Distance Correlation statistics and tests added diff -Nru r-cran-energy-1.7-0/R/dcov.R r-cran-energy-1.7-2/R/dcov.R --- r-cran-energy-1.7-0/R/dcov.R 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/R/dcov.R 2017-09-14 17:39:43.000000000 +0000 @@ -1,5 +1,16 @@ dcov.test <- -function(x, y, index=1.0, R=0) { +function(x, y, index=1.0, R=NULL) { + ## check for valid number of replicates R + method <- "Specify the number of replicates R (R > 0) to perform the test of independence" + if (! is.null(R)) { + R <- floor(R) + if (R < 1) R <- 0 + if (R > 0) + method <- "dCov test of independence" + } else { + R <- 0 + } + # distance covariance test for multivariate independence if (!(class(x) == "dist")) x <- dist(x) if (!(class(y) == "dist")) y <- dist(y) @@ -11,7 +22,7 @@ if (n != m) stop("Sample sizes must agree") if (! (all(is.finite(c(x, y))))) stop("Data contains missing or infinite values") - + stat <- dcorr <- reps <- 0 dcov <- rep(0, 4) if (R > 0) reps <- rep(0, R) @@ -38,17 +49,58 @@ dataname <- paste("index ", index, ", replicates ", R, sep="") pval <- ifelse (R < 1, NA, a$pval) e <- list( - method = paste("dCov test of independence", sep = ""), statistic = stat, + method = method, estimate = V, estimates = dcorr, p.value = pval, replicates = n* a$reps^2, + n = n, data.name = dataname) class(e) <- "htest" return(e) } +dcor.test <- + function(x, y, index=1.0, R) { + # distance correlation test for multivariate independence + # like dcov.test but using dcor as the test statistic + if (is.null(R)) R <- 0 + R <- ifelse(R > 0, floor(R), 0) + RESULT <- dcov.test(x, y, index=1.0, R) + # this test statistic is n times the square of dCov statistic + DCOVteststat <- RESULT$statistic + DCOVreplicates <- RESULT$replicates + + # RESULT$estimates = [dCov,dCor,dVar(x),dVar(y)] + # dVar are invariant under permutation of sample indices + + DCORteststat <- RESULT$estimates[2] + dvarX <- RESULT$estimates[3] + dvarY <- RESULT$estimates[4] + n <- RESULT$n + DCORreps <- sqrt(DCOVreplicates / n) / sqrt(dvarX * dvarY) + + if (R > 0) + p.value <- (1 + sum(DCORreps >= DCORteststat)) / (1 + R) else p.value <- NA + + names(DCORteststat) <- "dCor" + dataname <- paste("index ", index, ", replicates ", R, sep="") + method <- ifelse(R > 0, "dCor test of independence", + "Specify the number of replicates R>0 to perform the test of independence") + e <- list( + method = method, + statistic = DCORteststat, + estimates = RESULT$estimates, + p.value = p.value, + replicates = DCORreps, + n = n, + data.name = dataname) + class(e) <- "htest" + return(e) + } + + .dcov <- function(x, y, index=1.0) { # distance covariance statistic for independence diff -Nru r-cran-energy-1.7-0/R/disco.R r-cran-energy-1.7-2/R/disco.R --- r-cran-energy-1.7-0/R/disco.R 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/R/disco.R 2017-08-18 12:45:01.000000000 +0000 @@ -17,7 +17,7 @@ -disco <- function(x, factors, distance = FALSE, index = 1, R = 0, +disco <- function(x, factors, distance = FALSE, index = 1, R, method = c("disco", "discoB", "discoF")) { ## x is response or Euclidean distance matrix or dist() object factors ## is a matrix or data frame of group labels distance=TRUE if x is @@ -84,7 +84,7 @@ e } -disco.between <- function(x, factors, distance = FALSE, index = 1, R = 0) { +disco.between <- function(x, factors, distance = FALSE, index = 1, R) { ## disco test based on the between-sample component similar to disco ## except that 'disco' test is based on the F ratio disco.between test ## for one factor (balanced) is asymptotically equivalent to k-sample E diff -Nru r-cran-energy-1.7-0/R/Eeqdist.R r-cran-energy-1.7-2/R/Eeqdist.R --- r-cran-energy-1.7-0/R/Eeqdist.R 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/R/Eeqdist.R 2017-08-14 13:04:02.000000000 +0000 @@ -18,7 +18,7 @@ } eqdist.etest <- -function(x, sizes, distance = FALSE, method = c("original","discoB","discoF"), R = 0) +function(x, sizes, distance = FALSE, method = c("original","discoB","discoF"), R) { ## multivariate E-test of the multisample hypothesis of equal distributions ## x: matrix of pooled sample or distance matrix diff -Nru r-cran-energy-1.7-0/R/Eindep.R r-cran-energy-1.7-2/R/Eindep.R --- r-cran-energy-1.7-0/R/Eindep.R 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/R/Eindep.R 2017-08-14 13:07:54.000000000 +0000 @@ -1,5 +1,5 @@ indep.test<- -function(x, y, method = c("dcov","mvI"), index = 1, R = 0) { +function(x, y, method = c("dcov","mvI"), index = 1, R) { # two energy tests for multivariate independence type <- match.arg(method) if (type == "dcov") @@ -34,7 +34,7 @@ } mvI.test<- -function(x, y, R=0) { +function(x, y, R) { # energy test for multivariate independence x <- as.matrix(x) y <- as.matrix(y) @@ -64,12 +64,14 @@ names(est) <- "I" names(stat) <- "nI^2" dataname <- paste("x (",n," by ",ncol(x), "), y(",n," by ", ncol(y), "), replicates ", R, sep="") + if (R > 0) + p.value = a$pval else p.value = NA e <- list( method = "mvI energy test of independence", statistic = stat, estimate = est, replicates = n*reps, - p.value = a$pval, + p.value = p.value, data.name = dataname) class(e) <- "htest" e @@ -106,7 +108,7 @@ indep.etest<- -function(x, y, R=0) { +function(x, y, R) { # energy test for multivariate independence (deprecated) .Deprecated(new = "indep.test", package = "energy", msg = "indep.etest will become defunct in future release. Use indep.test with method mvI.") @@ -135,10 +137,12 @@ stat <- sqrt(a$stat) names(stat) <- "I" dataname <- paste("x (",n," by ",ncol(x), "), y(",n," by ", ncol(y), "), replicates ", R, sep="") + if (R > 0) + p.value <- a$pval else p.value <- NA e <- list( method = paste("Energy test of independence", sep = ""), statistic = stat, - p.value = a$pval, + p.value = p.value, data.name = dataname) class(e) <- "htest" e diff -Nru r-cran-energy-1.7-0/R/Emvnorm.R r-cran-energy-1.7-2/R/Emvnorm.R --- r-cran-energy-1.7-0/R/Emvnorm.R 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/R/Emvnorm.R 2017-08-14 13:04:20.000000000 +0000 @@ -1,4 +1,4 @@ -mvnorm.etest <- function(x, R = 0) { +mvnorm.etest <- function(x, R) { # parametric bootstrap E-test for multivariate normality if (is.vector(x)) { n <- length(x) @@ -15,7 +15,8 @@ return(matrix(rnorm(n * d), nrow = n, ncol = d)) }) } - p <- 1 - mean(bootobj$t < bootobj$t0) + if (R > 0) + p <- 1 - mean(bootobj$t < bootobj$t0) else p <- NA names(bootobj$t0) <- "E-statistic" e <- list(statistic = bootobj$t0, p.value = p, diff -Nru r-cran-energy-1.7-0/R/Epoisson.R r-cran-energy-1.7-2/R/Epoisson.R --- r-cran-energy-1.7-0/R/Epoisson.R 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/R/Epoisson.R 2017-08-14 14:50:45.000000000 +0000 @@ -1,11 +1,12 @@ poisson.mtest <- -function(x, R = 0) { +function(x, R) { # parametric bootstrap mean distance test of Poisson distribution n <- length(x) lambda <- mean(x) bootobj <- boot::boot(x, statistic = poisson.m, R = R, sim = "parametric", ran.gen = function(x, y) {rpois(n, lambda)}) - p <- 1 - mean(bootobj$t < bootobj$t0) + if (R > 0) + p <- 1 - mean(bootobj$t < bootobj$t0) else p <- NA names(bootobj$t0) <- "test statistic" names(lambda) <- "mean" e <- list( diff -Nru r-cran-energy-1.7-0/R/RcppExports.R r-cran-energy-1.7-2/R/RcppExports.R --- r-cran-energy-1.7-0/R/RcppExports.R 2016-08-26 00:41:31.000000000 +0000 +++ r-cran-energy-1.7-2/R/RcppExports.R 2017-08-13 22:07:17.000000000 +0000 @@ -1,35 +1,35 @@ -# This file was generated by Rcpp::compileAttributes +# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 D_center <- function(Dx) { - .Call('energy_D_center', PACKAGE = 'energy', Dx) + .Call(`_energy_D_center`, Dx) } U_center <- function(Dx) { - .Call('energy_U_center', PACKAGE = 'energy', Dx) + .Call(`_energy_U_center`, Dx) } dcovU_stats <- function(Dx, Dy) { - .Call('energy_dcovU_stats', PACKAGE = 'energy', Dx, Dy) + .Call(`_energy_dcovU_stats`, Dx, Dy) } mvnEstat <- function(y) { - .Call('energy_mvnEstat', PACKAGE = 'energy', y) + .Call(`_energy_mvnEstat`, y) } partial_dcor <- function(Dx, Dy, Dz) { - .Call('energy_partial_dcor', PACKAGE = 'energy', Dx, Dy, Dz) + .Call(`_energy_partial_dcor`, Dx, Dy, Dz) } partial_dcov <- function(Dx, Dy, Dz) { - .Call('energy_partial_dcov', PACKAGE = 'energy', Dx, Dy, Dz) + .Call(`_energy_partial_dcov`, Dx, Dy, Dz) } projection <- function(Dx, Dz) { - .Call('energy_projection', PACKAGE = 'energy', Dx, Dz) + .Call(`_energy_projection`, Dx, Dz) } U_product <- function(U, V) { - .Call('energy_U_product', PACKAGE = 'energy', U, V) + .Call(`_energy_U_product`, U, V) } diff -Nru r-cran-energy-1.7-0/src/energy_init.c r-cran-energy-1.7-2/src/energy_init.c --- r-cran-energy-1.7-0/src/energy_init.c 1970-01-01 00:00:00.000000000 +0000 +++ r-cran-energy-1.7-2/src/energy_init.c 2017-09-14 17:47:42.000000000 +0000 @@ -0,0 +1,54 @@ +#include +#include +#include // for NULL +#include + +/* declarations to register native routines in this package */ + +/* .C calls */ +extern void dCOV(void *, void *, void *, void *, void *, void *, void *); +extern void dCOVtest(void *, void *, void *, void *, void *, void *, void *, void *); +extern void Emin_hclust(void *, void *, void *, void *, void *); +extern void indepE(void *, void *, void *, void *, void *); +extern void indepEtest(void *, void *, void *, void *, void *, void *, void *); +extern void ksampleEtest(void *, void *, void *, void *, void *, void *, void *, void *, void *); +extern void poisMstat(void *, void *, void *); + +/* .Call calls */ +extern SEXP _energy_D_center(SEXP); +extern SEXP _energy_dcovU_stats(SEXP, SEXP); +extern SEXP _energy_mvnEstat(SEXP); +extern SEXP _energy_partial_dcor(SEXP, SEXP, SEXP); +extern SEXP _energy_partial_dcov(SEXP, SEXP, SEXP); +extern SEXP _energy_projection(SEXP, SEXP); +extern SEXP _energy_U_center(SEXP); +extern SEXP _energy_U_product(SEXP, SEXP); + +static const R_CMethodDef CEntries[] = { + {"dCOV", (DL_FUNC) &dCOV, 7}, + {"dCOVtest", (DL_FUNC) &dCOVtest, 8}, + {"Emin_hclust", (DL_FUNC) &Emin_hclust, 5}, + {"indepE", (DL_FUNC) &indepE, 5}, + {"indepEtest", (DL_FUNC) &indepEtest, 7}, + {"ksampleEtest", (DL_FUNC) &ksampleEtest, 9}, + {"poisMstat", (DL_FUNC) &poisMstat, 3}, + {NULL, NULL, 0} +}; + +static const R_CallMethodDef CallEntries[] = { + {"_energy_D_center", (DL_FUNC) &_energy_D_center, 1}, + {"_energy_dcovU_stats", (DL_FUNC) &_energy_dcovU_stats, 2}, + {"_energy_mvnEstat", (DL_FUNC) &_energy_mvnEstat, 1}, + {"_energy_partial_dcor", (DL_FUNC) &_energy_partial_dcor, 3}, + {"_energy_partial_dcov", (DL_FUNC) &_energy_partial_dcov, 3}, + {"_energy_projection", (DL_FUNC) &_energy_projection, 2}, + {"_energy_U_center", (DL_FUNC) &_energy_U_center, 1}, + {"_energy_U_product", (DL_FUNC) &_energy_U_product, 2}, + {NULL, NULL, 0} +}; + +void R_init_energy(DllInfo *dll) +{ + R_registerRoutines(dll, CEntries, CallEntries, NULL, NULL); + R_useDynamicSymbols(dll, FALSE); +} diff -Nru r-cran-energy-1.7-0/src/RcppExports.cpp r-cran-energy-1.7-2/src/RcppExports.cpp --- r-cran-energy-1.7-0/src/RcppExports.cpp 2016-08-26 00:41:32.000000000 +0000 +++ r-cran-energy-1.7-2/src/RcppExports.cpp 2017-09-14 17:47:42.000000000 +0000 @@ -1,4 +1,4 @@ -// This file was generated by Rcpp::compileAttributes +// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include @@ -7,96 +7,96 @@ // D_center NumericMatrix D_center(NumericMatrix Dx); -RcppExport SEXP energy_D_center(SEXP DxSEXP) { +RcppExport SEXP _energy_D_center(SEXP DxSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type Dx(DxSEXP); - __result = Rcpp::wrap(D_center(Dx)); - return __result; + rcpp_result_gen = Rcpp::wrap(D_center(Dx)); + return rcpp_result_gen; END_RCPP } // U_center NumericMatrix U_center(NumericMatrix Dx); -RcppExport SEXP energy_U_center(SEXP DxSEXP) { +RcppExport SEXP _energy_U_center(SEXP DxSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type Dx(DxSEXP); - __result = Rcpp::wrap(U_center(Dx)); - return __result; + rcpp_result_gen = Rcpp::wrap(U_center(Dx)); + return rcpp_result_gen; END_RCPP } // dcovU_stats NumericVector dcovU_stats(NumericMatrix Dx, NumericMatrix Dy); -RcppExport SEXP energy_dcovU_stats(SEXP DxSEXP, SEXP DySEXP) { +RcppExport SEXP _energy_dcovU_stats(SEXP DxSEXP, SEXP DySEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type Dx(DxSEXP); Rcpp::traits::input_parameter< NumericMatrix >::type Dy(DySEXP); - __result = Rcpp::wrap(dcovU_stats(Dx, Dy)); - return __result; + rcpp_result_gen = Rcpp::wrap(dcovU_stats(Dx, Dy)); + return rcpp_result_gen; END_RCPP } // mvnEstat double mvnEstat(NumericMatrix y); -RcppExport SEXP energy_mvnEstat(SEXP ySEXP) { +RcppExport SEXP _energy_mvnEstat(SEXP ySEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type y(ySEXP); - __result = Rcpp::wrap(mvnEstat(y)); - return __result; + rcpp_result_gen = Rcpp::wrap(mvnEstat(y)); + return rcpp_result_gen; END_RCPP } // partial_dcor NumericVector partial_dcor(NumericMatrix Dx, NumericMatrix Dy, NumericMatrix Dz); -RcppExport SEXP energy_partial_dcor(SEXP DxSEXP, SEXP DySEXP, SEXP DzSEXP) { +RcppExport SEXP _energy_partial_dcor(SEXP DxSEXP, SEXP DySEXP, SEXP DzSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type Dx(DxSEXP); Rcpp::traits::input_parameter< NumericMatrix >::type Dy(DySEXP); Rcpp::traits::input_parameter< NumericMatrix >::type Dz(DzSEXP); - __result = Rcpp::wrap(partial_dcor(Dx, Dy, Dz)); - return __result; + rcpp_result_gen = Rcpp::wrap(partial_dcor(Dx, Dy, Dz)); + return rcpp_result_gen; END_RCPP } // partial_dcov double partial_dcov(NumericMatrix Dx, NumericMatrix Dy, NumericMatrix Dz); -RcppExport SEXP energy_partial_dcov(SEXP DxSEXP, SEXP DySEXP, SEXP DzSEXP) { +RcppExport SEXP _energy_partial_dcov(SEXP DxSEXP, SEXP DySEXP, SEXP DzSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type Dx(DxSEXP); Rcpp::traits::input_parameter< NumericMatrix >::type Dy(DySEXP); Rcpp::traits::input_parameter< NumericMatrix >::type Dz(DzSEXP); - __result = Rcpp::wrap(partial_dcov(Dx, Dy, Dz)); - return __result; + rcpp_result_gen = Rcpp::wrap(partial_dcov(Dx, Dy, Dz)); + return rcpp_result_gen; END_RCPP } // projection NumericMatrix projection(NumericMatrix Dx, NumericMatrix Dz); -RcppExport SEXP energy_projection(SEXP DxSEXP, SEXP DzSEXP) { +RcppExport SEXP _energy_projection(SEXP DxSEXP, SEXP DzSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type Dx(DxSEXP); Rcpp::traits::input_parameter< NumericMatrix >::type Dz(DzSEXP); - __result = Rcpp::wrap(projection(Dx, Dz)); - return __result; + rcpp_result_gen = Rcpp::wrap(projection(Dx, Dz)); + return rcpp_result_gen; END_RCPP } // U_product double U_product(NumericMatrix U, NumericMatrix V); -RcppExport SEXP energy_U_product(SEXP USEXP, SEXP VSEXP) { +RcppExport SEXP _energy_U_product(SEXP USEXP, SEXP VSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< NumericMatrix >::type U(USEXP); Rcpp::traits::input_parameter< NumericMatrix >::type V(VSEXP); - __result = Rcpp::wrap(U_product(U, V)); - return __result; + rcpp_result_gen = Rcpp::wrap(U_product(U, V)); + return rcpp_result_gen; END_RCPP }