From 125e2520f954f96ea8c136afc12e722b3f2811b8 Mon Sep 17 00:00:00 2001 From: dicook Date: Sun, 1 Sep 2024 15:15:23 +1000 Subject: [PATCH] skewness index added --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 4 ++++ R/interesting-indices.r | 19 +++++++++++++++++++ man/tourr-package.Rd | 1 + 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e62e0b17..91528567 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tourr Title: Tour Methods for Multivariate Data Visualisation -Version: 1.2.1 +Version: 1.2.2 Authors@R: c( person("Hadley", "Wickham", email = "h.wickham@gmail.com", role = c("aut", "ctb"), comment = c(ORCID = "0000-0003-4757-117X")), person("Dianne", "Cook", email = "dicook@monash.edu", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3813-7155")), diff --git a/NAMESPACE b/NAMESPACE index dfd15912..e0c6e112 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -108,6 +108,7 @@ export(search_better_random) export(search_geodesic) export(search_polish) export(search_posse) +export(skewness) export(slice_index) export(sphere_data) export(splines2d) diff --git a/NEWS.md b/NEWS.md index 4cbeb51c..46e3124e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# tourr 1.2.2 + +* New skewness index, as defined in original Cook, Buja, Cabrera paper + # tourr 1.2.1 * anomaly tour is initialised with a random basis diff --git a/R/interesting-indices.r b/R/interesting-indices.r index 1eecf72d..9d399e69 100644 --- a/R/interesting-indices.r +++ b/R/interesting-indices.r @@ -128,6 +128,25 @@ cmass <- function() { } } +#' Skewness index. +#' +#' Calculates the skewness index. See Cook, Buja and Cabrera (1993) +#' Projection pursuit indexes based on orthonormal function expansions +#' for equations. +#' +#' @keywords hplot +#' @export +skewness <- function() { + function(mat) { + n <- nrow(mat) + d <- ncol(mat) + + idx <- mean(rowSums(mat * exp(-0.5 * mat^2))) + + idx + } +} + #' LDA projection pursuit index. #' #' Calculate the LDA projection pursuit index. See Cook and Swayne (2007) diff --git a/man/tourr-package.Rd b/man/tourr-package.Rd index 608bdc6c..33774211 100644 --- a/man/tourr-package.Rd +++ b/man/tourr-package.Rd @@ -14,6 +14,7 @@ Implements geodesic interpolation and basis generation functions that allow you Useful links: \itemize{ \item \url{https://github.com/ggobi/tourr} + \item \url{https://ggobi.github.io/tourr/} \item Report bugs at \url{https://github.com/ggobi/tourr/issues} }