R/RcppExports.R

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Multivariate Gaussian random generator in C++
#'
#' \code{rmvnorm} generates random samples from a multivariate Gaussian distribution with mean \eqn{\mu} and variance-covariance matrix \eqn{\Sigma} assumed positive semi-definite.
#'
#' @param n Number of samples to be drawn from the distribution (default: 1).
#' @param mean Mean vector of the distribution (default: 0).
#' @param squareRootSigma Square-root of the variance-covariance matrix of the distribution (default = 1).
#' @return A matrix of size \eqn{n\times} \code{length(mean)} containing \eqn{n} randomly sampled vectors of size \code{length(mean)}.
#' @keywords internal
rmvnorm <- function(n, mean, squareRootSigma) {
    .Call('_fdahotelling_rmvnorm', PACKAGE = 'fdahotelling', n, mean, squareRootSigma)
}

#' Positive eigenvalues of the sample covariance matrix
#'
#' \code{eigenvalues} computes the positive eigenvalues of the sample covariance matrix using the \code{RcppArmadillo} interface for fast eigen-decomposition via divide and conquer method.
#'
#' @param x Dataframe or matrix containing the data collected from 1st population.
#' @param y Dataframe or matrix containing the data collected from 2nd population (default: \code{NULL}).
#' @return A numeric vector with the positive eigenvalues of the sample covariance matrix or sample pooled covariance matrix when a second dataset is provided.
#' @keywords internal
eigenvalues <- function(x, y) {
    .Call('_fdahotelling_eigenvalues', PACKAGE = 'fdahotelling', x, y)
}

#' Pseudoinverse of the sample covariance matrix
#'
#' \code{pseudoinverse} computes the Moore-Penrose inverse of the sample covariance matrix using the \code{RcppArmadillo} interface for fast pseudoinverse calculations via divide and conquer method.
#'
#' @param x Dataframe or matrix containing the data collected from 1st population.
#' @param y Dataframe or matrix containing the data collected from 2nd population (default: \code{NULL}).
#' @param tolerance Positive value \eqn{\tau} such that positive eigenvalues of the sample covariance matrix that are below \eqn{\tau} tr\eqn{\Sigma} are discarded for inverse computation (default: 0).
#' @return A matrix containing the pseudoinverse of the sample covariance matrix.
#' @keywords internal
pseudoinverse <- function(x, y, tolerance = 0.0) {
    .Call('_fdahotelling_pseudoinverse', PACKAGE = 'fdahotelling', x, y, tolerance)
}

#' Compute Hotelling's \eqn{T^2} statistic
#'
#' \code{stat_hotelling_impl} computes the generalized Hotelling's \eqn{T^2} statistic using the \code{RcppArmadillo} interface for fast pseudoinverse calculations via divide and conquer method.
#'
#' @inheritParams statistics
#' @param use_correction Flag to turn on and off a statistic adjustment factor that makes it Fisher-distributed under the normality assumption (default: \code{FALSE}).
#' @param tolerance Positive value \eqn{\tau} such that positive eigenvalues of the sample covariance matrix that are below \eqn{\tau} tr\eqn{\Sigma} are discarded for inverse computation (default: 0).
#' @return A named numeric vector of size 1 storing the Hotelling's \eqn{T^2} statistic defined as \deqn{\int_D}.
#' @keywords internal
stat_hotelling_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0, use_correction = FALSE, tolerance = 0.0) {
    .Call('_fdahotelling_stat_hotelling_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size, use_correction, tolerance)
}

#' @keywords internal
stat_L1_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0) {
    .Call('_fdahotelling_stat_L1_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size)
}

#' @keywords internal
stat_L2_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0) {
    .Call('_fdahotelling_stat_L2_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size)
}

#' @keywords internal
stat_Linf_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0) {
    .Call('_fdahotelling_stat_Linf_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size)
}

#' @keywords internal
stat_L1_std_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0) {
    .Call('_fdahotelling_stat_L1_std_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size)
}

#' @keywords internal
stat_L2_std_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0) {
    .Call('_fdahotelling_stat_L2_std_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size)
}

#' @keywords internal
stat_Linf_std_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0) {
    .Call('_fdahotelling_stat_Linf_std_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size)
}

#' @keywords internal
stat_all_impl <- function(x, y, mu, paired = FALSE, step_size = 0.0) {
    .Call('_fdahotelling_stat_all_impl', PACKAGE = 'fdahotelling', x, y, mu, paired, step_size)
}
astamm/fdahotelling documentation built on May 10, 2019, 2:05 p.m.