Package 'hermiter'

Title: Efficient Sequential and Batch Estimation of Univariate and Bivariate Probability Density Functions and Cumulative Distribution Functions along with Quantiles (Univariate) and Nonparametric Correlation (Bivariate)
Description: Facilitates estimation of full univariate and bivariate probability density functions and cumulative distribution functions along with full quantile functions (univariate) and nonparametric correlation (bivariate) using Hermite series based estimators. These estimators are particularly useful in the sequential setting (both stationary and non-stationary) and one-pass batch estimation setting for large data sets. Based on: Stephanou, Michael, Varughese, Melvin and Macdonald, Iain. "Sequential quantiles via Hermite series density estimation." Electronic Journal of Statistics 11.1 (2017): 570-607 <doi:10.1214/17-EJS1245>, Stephanou, Michael and Varughese, Melvin. "On the properties of Hermite series based distribution function estimators." Metrika (2020) <doi:10.1007/s00184-020-00785-z> and Stephanou, Michael and Varughese, Melvin. "Sequential estimation of Spearman rank correlation using Hermite series estimators." Journal of Multivariate Analysis (2021) <doi:10.1016/j.jmva.2021.104783>.
Authors: Michael Stephanou [aut, cre], Melvin Varughese [ctb]
Maintainer: Michael Stephanou <[email protected]>
License: MIT + file LICENSE
Version: 2.3.1
Built: 2024-11-19 03:25:55 UTC
Source: https://github.com/mikejareds/hermiter

Help Index


Efficient Sequential and Batch Estimation of Univariate and Bivariate Probability Density Functions and Cumulative Distribution Functions along with Quantiles (Univariate) and Nonparametric Correlation (Bivariate)

Description

Facilitates estimation of full univariate and bivariate probability density functions and cumulative distribution functions along with full quantile functions (univariate) and nonparametric correlation (bivariate) using Hermite series based estimators. These estimators are particularly useful in the sequential setting (both stationary and non-stationary) and one-pass batch estimation setting for large data sets. Based on: Stephanou, Michael, Varughese, Melvin and Macdonald, Iain. "Sequential quantiles via Hermite series density estimation." Electronic Journal of Statistics 11.1 (2017): 570-607 <doi:10.1214/17-EJS1245>, Stephanou, Michael and Varughese, Melvin. "On the properties of Hermite series based distribution function estimators." Metrika (2020) <doi:10.1007/s00184-020-00785-z> and Stephanou, Michael and Varughese, Melvin. "Sequential estimation of Spearman rank correlation using Hermite series estimators." Journal of Multivariate Analysis (2021) <doi:10.1016/j.jmva.2021.104783>.

Package Content

Index of help topics:

IQR                     Estimates the Interquartile range (IQR)
IQR.default             Estimates the Interquartile range (IQR)
IQR.hermite_estimator_univar
                        Estimates the Interquartile range (IQR)
cor                     A wrapper around the stats::cor function adding
                        two additional methods, namely method =
                        "hermite.spearman" and method =
                        "hermite.kendall" (can be abbreviated). The
                        input parameters and output value semantics
                        closely match the stats::cor method for easy
                        interchange. If neither the "hermite.spearman"
                        nor the "hermite.kendall" method is selected,
                        then this function will call stats::cor with
                        the arguments provided.
cum_prob                Estimates the cumulative probability at one or
                        more x values
cum_prob.hermite_estimator_bivar
                        Estimates the cumulative probabilities for a
                        matrix of 2-d x values
cum_prob.hermite_estimator_univar
                        Estimates the cumulative probability for a
                        vector of x values
dens                    Estimates the probability density at one or
                        more x values
dens.hermite_estimator_bivar
                        Estimates the probability densities for a
                        matrix of 2-d x values
dens.hermite_estimator_univar
                        Estimates the probability density for a vector
                        of x values
density.hermite_estimator_bivar
                        Creates an object summarizing the bivariate PDF
                        with associated generic methods print and plot.
density.hermite_estimator_univar
                        Creates an object summarizing the PDF with
                        associated generic methods print and plot.
gauss_hermite_quad_100
                        Calculates \int_{-Inf}^{Inf} f(x) e^{-x^2} dx
                        using Gauss-Hermite quadrature with 100 terms.
hcdf                    Creates an object summarizing the CDF with
                        associated generic methods print, plot and
                        summary.
hcdf.hermite_estimator_bivar
                        Creates an object summarizing the bivariate CDF
                        with associated generic methods print, plot and
                        summary.
hcdf.hermite_estimator_univar
                        Creates an object summarizing the CDF with
                        associated generic methods print, plot and
                        summary.
hermite_estimator       A class to sequentially estimate univariate and
                        bivariate pdfs and cdfs along with quantile
                        functions in the univariate setting and
                        nonparametric correlations in the bivariate
                        setting.
hermite_estimator_bivar
                        A class to sequentially estimate bivariate
                        pdfs, cdfs and nonparametric correlations
hermite_estimator_univar
                        A class to sequentially estimate univariate
                        pdfs, cdfs and quantile functions
hermite_function        Outputs orthonormal Hermite functions
hermite_function_N      Convenience function to output orthonormal
                        Hermite functions The method calculates the
                        orthonormal Hermite functions, h_k(x) from
                        k=0,...,N for the vector of values, x.
hermite_function_sum_N
                        Convenience function to output the sum of
                        orthonormal Hermite functions The method
                        calculates the sum of orthonormal Hermite
                        functions, sum_{i} h_k(x_{i}) from k=0,...,N
                        for the vector of values, x.
hermite_function_sum_serial
                        Outputs the sum of orthonormal Hermite
                        functions
hermite_int_full        Convenience function to output the integral of
                        the orthonormal Hermite functions on the full
                        domain
hermite_int_full_domain
                        Outputs integral of the orthonormal Hermite
                        functions on the full domain
hermite_int_lower       Convenience function to output a definite
                        integral of the orthonormal Hermite functions
hermite_int_upper       Convenience function to output a definite
                        integral of the orthonormal Hermite functions
hermite_integral_val    Outputs lower integral of the orthonormal
                        Hermite functions
hermite_integral_val_upper
                        Outputs upper integral of the orthonormal
                        Hermite functions
hermite_normalization   Outputs Hermite normalization factors
hermite_normalization_N
                        Convenience function to output Hermite
                        normalization factors
hermite_polynomial      Outputs physicist version of Hermite
                        Polynomials
hermite_polynomial_N    Convenience function to output physicist
                        Hermite polynomials The method calculates the
                        physicist version of Hermite polynomials,
                        H_k(x) from k=0,...,N for the vector of values,
                        x.
hermiter-package        Efficient Sequential and Batch Estimation of
                        Univariate and Bivariate Probability Density
                        Functions and Cumulative Distribution Functions
                        along with Quantiles (Univariate) and
                        Nonparametric Correlation (Bivariate)
initialize_batch_bivar
                        Initializes the Hermite series based estimator
                        with a batch of data
initialize_batch_univar
                        Initializes the Hermite series based estimator
                        with a batch of data
kendall                 Estimates the Kendall rank correlation
                        coefficient
kendall.hermite_estimator_bivar
                        Estimates the Kendall rank correlation
                        coefficient
median.hermite_estimator_univar
                        Estimates the median
merge_hermite           Merges a list of Hermite estimators
merge_hermite_bivar     Merges a list of bivariate Hermite estimators
merge_hermite_univar    Merges a list of Hermite estimators
merge_moments_and_count_bivar
                        Internal method to consistently merge the
                        number of observations, means and variances of
                        two bivariate Hermite estimators
merge_moments_and_count_univar
                        Internal method to consistently merge the
                        number of observations, means and variances of
                        two Hermite estimators
merge_pair              Merges two Hermite estimators
merge_pair.hermite_estimator_bivar
                        Merges two bivariate Hermite estimators
merge_pair.hermite_estimator_univar
                        Merges two Hermite estimators
merge_standardized_helper_bivar
                        Internal method to merge a list of standardized
                        bivariate Hermite estimators
merge_standardized_helper_univar
                        Internal method to merge a list of standardized
                        Hermite estimators
plot.hcdf_bivar         Plots the hcdf_bivar object as output by the
                        hcdf function when evaluated on a
                        hermite_estimator_bivar object.
plot.hcdf_univar        Plots the hcdf_univar object as output by the
                        hcdf function when evaluated on a
                        hermite_estimator_univar object.
plot.hdensity_bivar     Plots the hdensity_bivar object as output by
                        the density function when evaluated on a
                        hermite_estimator_bivar object.
plot.hdensity_univar    Plots the hdensity_univar object as output by
                        the density function when evaluated on a
                        hermite_estimator_univar object.
print.hcdf_bivar        Prints the hcdf_bivar object as output by the
                        hcdf function when evaluated on a
                        hermite_estimator_bivar object.
print.hcdf_univar       Prints the hcdf_univar object as output by the
                        hcdf function when evaluated on a
                        hermite_estimator_univar object.
print.hdensity_bivar    Prints the hdensity_bivar object as output by
                        the density function when evaluated on a
                        hermite_estimator_bivar object.
print.hdensity_univar   Prints the hdensity_univar object as output by
                        the density function when evaluated on a
                        hermite_estimator_univar object.
print.hermite_estimator_bivar
                        Prints bivariate hermite_estimator object.
print.hermite_estimator_univar
                        Prints univariate hermite_estimator object.
quant                   Estimates the quantiles at a vector of
                        probability values
quant.hermite_estimator_univar
                        Estimates the quantiles at a vector of
                        probability values
quantile.hermite_estimator_univar
                        Estimates the quantiles at a vector of
                        probability values
spearmans               Estimates the Spearman's rank correlation
                        coefficient
spearmans.hermite_estimator_bivar
                        Estimates the Spearman's rank correlation
                        coefficient
standardizeInputs       Standardizes the observation x and updates the
                        online moment inputs
standardizeInputsEW     Standardizes the observation x and updates the
                        online moment inputs
summary.hcdf_bivar      Summarizes the hcdf_bivar object as output by
                        the hcdf function when evaluated on a
                        hermite_estimator_bivar object.
summary.hcdf_univar     Summarizes the hcdf_univar object as output by
                        the hcdf function when evaluated on a
                        hermite_estimator_univar object.
summary.hermite_estimator_bivar
                        Summarizes bivariate hermite_estimator object.
summary.hermite_estimator_univar
                        Summarizes univariate hermite_estimator object.
update_sequential       Updates the Hermite series based estimator
                        sequentially
update_sequential.hermite_estimator_bivar
                        Updates the Hermite series based estimator
                        sequentially
update_sequential.hermite_estimator_univar
                        Updates the Hermite series based estimator
                        sequentially

Maintainer

Michael Stephanou <[email protected]>

Author(s)

Michael Stephanou [aut, cre], Melvin Varughese [ctb]


A wrapper around the stats::cor function adding two additional methods, namely method = "hermite.spearman" and method = "hermite.kendall" (can be abbreviated). The input parameters and output value semantics closely match the stats::cor method for easy interchange. If neither the "hermite.spearman" nor the "hermite.kendall" method is selected, then this function will call stats::cor with the arguments provided.

Description

A wrapper around the stats::cor function adding two additional methods, namely method = "hermite.spearman" and method = "hermite.kendall" (can be abbreviated). The input parameters and output value semantics closely match the stats::cor method for easy interchange. If neither the "hermite.spearman" nor the "hermite.kendall" method is selected, then this function will call stats::cor with the arguments provided.

Usage

cor(x, y = NULL, use = "everything", method = "pearson", ...)

Arguments

x

a numeric vector, matrix or data frame.

y

NULL (default) or a vector, matrix or data frame with compatible dimensions to x. The default is equivalent to y = x (but more efficient).

use

not used by hermite.spearman and hermite.kendall methods. For stats::cor this is an optional character string giving a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs".

method

a character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", "spearman", "hermite.spearman" or "hermite.kendall": can be abbreviated.

...

Additional arguments for the constructor of the hermite_estimator object if method is "hermite.spearman" or "hermite.kendall".


Estimates the cumulative probability at one or more x values

Description

This method calculates the cumulative probability at a vector of x values in the univariate case. In the bivariate case, the method calculates the probability density values for a matrix of x values, each row of which represents a 2-d point.

Usage

cum_prob(h_est_obj, x, clipped, accelerate_series = TRUE)

Arguments

h_est_obj

A hermite_estimator_univar or hermite_estimator_bivar object.

x

A numeric vector (univariate) or a numeric matrix (bivariate). Values at which to calculate the cumulative probability.

clipped

A boolean value. This value determines whether cumulative probabilities are clipped to lie between 0 and 1.

accelerate_series

A boolean value. This value determines whether Hermite series acceleration is applied.

Details

The object must be updated with observations prior to the use of the method.

Value

A numeric vector of cumulative probability values.

Examples

## Not run: 
hermite_est <- hermite_estimator(N = 10, standardize = TRUE, 
est_type="univariate", observations = rnorm(30))
cdf_est <- cum_prob(hermite_est, c(0, 0.5, 1))
hermite_est <- hermite_estimator(N = 10, standardize = TRUE, 
est_type="bivariate", observations = matrix(rnorm(60), 
nrow=30, ncol=2,byrow=TRUE))
cdf_est <- cum_prob(hermite_est, matrix(c(0,0,0.5,0.5,1,1),nrow=3,
ncol=2,byrow=TRUE))

## End(Not run)

Estimates the cumulative probabilities for a matrix of 2-d x values

Description

This method calculates the cumulative probability values for a matrix of 2-d x vector values using the hermite_estimator_bivar object (h_est_obj).

Usage

## S3 method for class 'hermite_estimator_bivar'
cum_prob(h_est_obj, x, clipped = FALSE, accelerate_series = FALSE)

Arguments

h_est_obj

A hermite_estimator_bivar object.

x

A numeric matrix. Each row corresponds to a 2-d coordinate.

clipped

A boolean value. This value determines whether cumulative probabilities are clipped to lie within the range [0,1].

accelerate_series

A boolean value. Series acceleration has not yet been implemented for bivariate estimators.

Details

The object must be updated with observations prior to the use of this method.

Value

A numeric vector of cumulative probability values.


Estimates the cumulative probability for a vector of x values

Description

This method calculates the cumulative probability values at a vector of x values using the hermite_estimator_univar object (h_est_obj).

Usage

## S3 method for class 'hermite_estimator_univar'
cum_prob(h_est_obj, x, clipped = FALSE, accelerate_series = TRUE)

Arguments

h_est_obj

A hermite_estimator_univar object.

x

A numeric vector. Values at which to estimate the cumulative probability

clipped

A boolean value. This value determines whether cumulative probabilities are clipped to lie within the range [0,1].

accelerate_series

A boolean value. This value determines whether Hermite series acceleration is applied.

Details

The object must be updated with observations prior to the use of this method.

Value

A numeric vector of cumulative probability values.


Estimates the probability density at one or more x values

Description

This method calculates the probability density values at a vector of x values in the univariate case. In the bivariate case, the method calculates the probability density values for a matrix of x values, each row of which represents a 2-d point.

Usage

dens(h_est_obj, x, clipped, accelerate_series = TRUE)

Arguments

h_est_obj

A hermite_estimator_univar or hermite_estimator_bivar object.

x

A numeric vector (univariate) or a numeric matrix (bivariate) of values at which to calculate the probability density.

clipped

A boolean value. This value determines whether probability densities are clipped to be bigger than zero.

accelerate_series

A boolean value. This value determines whether Hermite series acceleration is applied.

Details

The object must be updated with observations prior to the use of the method.

Value

A numeric vector of probability density values.

Examples

## Not run: 
hermite_est <- hermite_estimator(N = 10, standardize = TRUE, 
est_type="univariate", observations = rnorm(30))
pdf_est <- dens(hermite_est, c(0, 0.5, 1))
hermite_est <- hermite_estimator(N = 10, standardize = TRUE, 
est_type="bivariate", observations = matrix(rnorm(60), 
nrow=30, ncol=2,byrow=TRUE))
pdf_est <- dens(hermite_est, matrix(c(0,0,0.5,0.5,1,1),nrow=3,
ncol=2,byrow=TRUE))

## End(Not run)

Estimates the probability densities for a matrix of 2-d x values

Description

This method calculates the probability density values for a matrix of 2-d x vector values using the hermite_estimator_bivar object (h_est_obj).

Usage

## S3 method for class 'hermite_estimator_bivar'
dens(h_est_obj, x, clipped = FALSE, accelerate_series = FALSE)

Arguments

h_est_obj

A hermite_estimator_bivar object.

x

A numeric matrix. Each row corresponds to a 2-d coordinate.

clipped

A boolean value. This value determines whether probability densities are clipped to be bigger than zero.

accelerate_series

A boolean value. Series acceleration has not yet been implemented for bivariate estimators.

Details

The object must be updated with observations prior to the use of the method.

Value

A numeric vector of probability density values.


Estimates the probability density for a vector of x values

Description

This method calculates the probability density values at a vector of x values using the hermite_estimator_univar object (h_est_obj).

Usage

## S3 method for class 'hermite_estimator_univar'
dens(h_est_obj, x, clipped = FALSE, accelerate_series = TRUE)

Arguments

h_est_obj

A hermite_estimator_univar object.

x

A numeric vector. Values at which to estimate the probability density.

clipped

A boolean value. This value determines whether probability densities are clipped to be bigger than zero.

accelerate_series

A boolean value. This value determines whether Hermite series acceleration is applied.

Details

The object must be updated with observations prior to the use of the method.

Value

A numeric vector of probability density values.


Creates an object summarizing the bivariate PDF with associated generic methods print and plot.

Description

The hermite_estimator_bivar object, x must be updated with observations prior to the use of the method.

Usage

## S3 method for class 'hermite_estimator_bivar'
density(x, x_lower = NA, x_upper = NA, ...)

Arguments

x

A hermite_estimator_bivar object.

x_lower

A numeric vector. This vector determines the lower limit of x values at which to evaluate the density.

x_upper

A numeric vector. This vector determines the upper limit of x values at which to evaluate the density.

...

Additional arguments for the dens function.

Value

A hdensity_bivar object whose underlying structure is a list containing the following components.

x: The points at which the density is calculated. x_vals_1: Marginal quantiles of first random variable, used for plotting. x_vals_2: Marginal quantiles of second random variable, used for plotting. density_vals: The density values at the points x. num_obs: The number of observations used to form the Hermite density estimates. N: The number of terms N in the Hermite series estimator.


Creates an object summarizing the PDF with associated generic methods print and plot.

Description

The hermite_estimator_univar, x must be updated with observations prior to the use of the method.

Usage

## S3 method for class 'hermite_estimator_univar'
density(x, x_lower = NA, x_upper = NA, ...)

Arguments

x

A hermite_estimator_univar object.

x_lower

A numeric value. This value determines the lower limit of x values at which to evaluate the density.

x_upper

A numeric value. This value determines the upper limit of x values at which to evaluate the density.

...

Additional arguments for the dens function.

Value

A hdensity_univar object whose underlying structure is a list containing the following components.

x: The points at which the density is calculated. density_vals: The density values at the points x. num_obs: The number of observations used to form the Hermite density estimates. N: The number of terms N in the Hermite series estimator.


Calculates f(x)ex2dx\int_{-\infty}^{\infty} f(x) e^{-x^2} dx using Gauss-Hermite quadrature with 100 terms.

Description

Calculates f(x)ex2dx\int_{-\infty}^{\infty} f(x) e^{-x^2} dx using Gauss-Hermite quadrature with 100 terms.

Usage

gauss_hermite_quad_100(f)

Arguments

f

A function.

Value

A numeric value.


Creates an object summarizing the CDF with associated generic methods print, plot and summary.

Description

The h_est_obj object must be updated with observations prior to the use of the method.

Usage

hcdf(
  h_est_obj,
  clipped = FALSE,
  accelerate_series = TRUE,
  x_lower = NA,
  x_upper = NA
)

Arguments

h_est_obj

A hermite_estimator_univar or hermite_estimator_bivar object.

clipped

A boolean value. This value determines whether cumulative probabilities are clipped to lie between 0 and 1.

accelerate_series

A boolean value. This value determines whether Hermite series acceleration is applied.

x_lower

A numeric value (univariate) or a numeric vector (bivariate). This value determines the lower limit of x values at which to evaluate the CDF.

x_upper

A numeric value (univariate) or a numeric vector (bivariate). This value determines the upper limit of x values at which to evaluate the CDF.

Value

A hcdf_univar or hcdf_bivar object.


Creates an object summarizing the bivariate CDF with associated generic methods print, plot and summary.

Description

The hermite_estimator_bivar object h_est_obj must be updated with observations prior to the use of this method.

Usage

## S3 method for class 'hermite_estimator_bivar'
hcdf(
  h_est_obj,
  clipped = FALSE,
  accelerate_series = TRUE,
  x_lower = NA,
  x_upper = NA
)

Arguments

h_est_obj

A hermite_estimator_bivar object.

clipped

A boolean value. This value determines whether cumulative probabilities are clipped to lie within the range [0,1].

accelerate_series

A boolean value. This value determines whether Hermite series acceleration is applied.

x_lower

A numeric vector. This vector determines the lower limit of x values at which to evaluate the CDF.

x_upper

A numeric value. This vector determines the upper limit of x values at which to evaluate the CDF.

Value

A hcdf_bivar object whose underlying structure is a list containing the following components.

x: The points at which the cumulative probability is calculated. x_vals_1: Marginal quantiles of first random variable, used for plotting. x_vals_2: Marginal quantiles of second random variable, used for plotting. cum_prob_vals: The cumulative probability values at the points x. num_obs: The number of observations used to form the Hermite cumulative probability estimates. N: The number of terms N in the Hermite series estimator.


Creates an object summarizing the CDF with associated generic methods print, plot and summary.

Description

The hermite_estimator_univar object, h_est_obj must be updated with observations prior to the use of this method.

Usage

## S3 method for class 'hermite_estimator_univar'
hcdf(
  h_est_obj,
  clipped = FALSE,
  accelerate_series = TRUE,
  x_lower = NA,
  x_upper = NA
)

Arguments

h_est_obj

A hermite_estimator_univar object.

clipped

A boolean value. This value determines whether cumulative probabilities are clipped to lie within the range [0,1].

accelerate_series

A boolean value. This value determines whether Hermite series acceleration is applied.

x_lower

A numeric value. This value determines the lower limit of x values at which to evaluate the CDF.

x_upper

A numeric value. This value determines the upper limit of x values at which to evaluate the CDF.

Value

A hcdf_univar object whose underlying structure is a list containing the following components.

x: The points at which the cumulative probability is calculated. cum_prob_vals: The cumulative probability values at the points x. num_obs: The number of observations used to form the Hermite cumulative probability estimates. N: The number of terms N in the Hermite series estimator.


A class to sequentially estimate univariate and bivariate pdfs and cdfs along with quantile functions in the univariate setting and nonparametric correlations in the bivariate setting.

Description

The hermite_estimator class provides a unified interface to the univariate and bivariate Hermite series based estimators, leveraging generic methods and S3 dispatch. Methods are included for the sequential or one-pass batch estimation of the full probability density function and cumulative distribution function in the univariate and bivariate settings. Sequential or one-pass batch estimation methods are also provided for the full quantile function in the univariate setting along with the Spearman and Kendall correlation coefficients in the bivariate setting. Note that RcppParallel is utilized to speed up batch updating in the univariate case. If one wishes to switch to serial batch updating (typically slower), utilize options(hermiter.parallel = FALSE).

Usage

hermite_estimator(
  N = NA,
  standardize = TRUE,
  exp_weight_lambda = NA,
  est_type = "univariate",
  observations = c()
)

Arguments

N

An integer between 0 and 75. The upper bound has been chosen as a value that yields an estimator that is reasonably fast and that remains robust to numerical issues. The Hermite series based estimator is truncated at N+1 terms.

standardize

A boolean value. Determines whether the observations are standardized, a transformation which often improves performance.

exp_weight_lambda

A numerical value between 0 and 1. This parameter controls the exponential weighting of the Hermite series based estimator. If this parameter is NA, no exponential weighting is applied.

est_type

A string value. Options are "univariate" or "bivariate".

observations

A numeric vector or a numeric matrix. Note that for univariate estimators, x is a numeric vector of observations to be incorporated. For bivariate estimators, x is a numeric matrix with n rows for n observations and 2 columns.

Value

An S3 object of class hermite_estimator_univar or hermite_estimator_bivar.

Author(s)

Michael Stephanou <[email protected]>

Examples

## Not run: 
hermite_est <- hermite_estimator(N = 50, standardize = TRUE,
est_type="univariate")
hermite_est <- hermite_estimator(N = 50, standardize = TRUE,
est_type="univariate", observations = c(1,2,3))
hermite_est <- hermite_estimator(N = 30, standardize = TRUE, 
est_type="bivariate", observations = matrix(c(1,1,2,2,3,3), 
nrow=3, ncol=2,byrow=TRUE))

## End(Not run)

A class to sequentially estimate bivariate pdfs, cdfs and nonparametric correlations

Description

This method constructs an S3 object with methods for nonparametric estimation of bivariate pdfs and cdfs along with nonparametric correlations.

Usage

hermite_estimator_bivar(
  N = 30,
  standardize = TRUE,
  exp_weight_lambda = NA,
  observations = c()
)

Arguments

N

An integer between 0 and 75. The upper bound has been chosen as a value that yields an estimator that is reasonably fast and that remains robust to numerical issues. The Hermite series based estimator is truncated at N+1 terms.

standardize

A boolean value. Determines whether the observations are standardized, a transformation which often improves performance.

exp_weight_lambda

A numerical value between 0 and 1. This parameter controls the exponential weighting of the Hermite series based estimator. If this parameter is NA, no exponential weighting is applied.

observations

A numeric matrix. A matrix of bivariate observations to be incorporated into the estimator. Each row corresponds to a single bivariate observation.

Details

The hermite_estimator_bivar class allows the sequential or one-pass batch estimation of the full bivariate probability density function and cumulative distribution function along with the Spearman's rank correlation coefficient. It is well suited to streaming data (both stationary and non-stationary) and to efficient estimation in the context of massive or distributed data sets. Indeed,estimators constructed on different subsets of a distributed data set can be consistently merged.

Value

An S3 object of class hermite_estimator_bivar, with methods for density function and distribution function estimation along with Spearman's rank correlation estimation.

Author(s)

Michael Stephanou <[email protected]>


A class to sequentially estimate univariate pdfs, cdfs and quantile functions

Description

This method constructs an S3 object with associated methods for univariate nonparametric estimation of pdfs, cdfs and quantiles.

Usage

hermite_estimator_univar(
  N = 50,
  standardize = TRUE,
  exp_weight_lambda = NA,
  observations = c()
)

Arguments

N

An integer between 0 and 75. The upper bound has been chosen as a value that yields an estimator that is reasonably fast and that remains robust to numerical issues. The Hermite series based estimator is truncated at N+1 terms.

standardize

A boolean value. Determines whether the observations are standardized, a transformation which often improves performance.

exp_weight_lambda

A numerical value between 0 and 1. This parameter controls the exponential weighting of the Hermite series based estimator. If this parameter is NA, no exponential weighting is applied.

observations

A numeric vector. A vector of observations to be incorporated into the estimator.

Details

The hermite_estimator_univar class allows the sequential or one-pass batch estimation of the full probability density function, cumulative distribution function and quantile function. It is well suited to streaming data (both stationary and non-stationary) and to efficient estimation in the context of massive or distributed data sets. Indeed, estimators constructed on different subsets of a distributed data set can be consistently merged.

Value

An S3 object of class hermite_estimator_univar, with methods for density function, distribution function and quantile function estimation.

Author(s)

Michael Stephanou <[email protected]>


Outputs orthonormal Hermite functions

Description

The method calculates the orthonormal Hermite functions, hk(x)h_k(x) from k=0,,Nk=0,\dots,N for the vector of values, x.

Usage

hermite_function(N, x)

Arguments

N

An integer number.

x

A numeric vector.

Value

A numeric matrix with N+1 rows and length(x) columns.

Author(s)

Michael Stephanou <[email protected]>


Convenience function to output orthonormal Hermite functions The method calculates the orthonormal Hermite functions, hk(x)h_k(x) from k=0,,Nk=0,\dots,N for the vector of values, x.

Description

Convenience function to output orthonormal Hermite functions

The method calculates the orthonormal Hermite functions, hk(x)h_k(x) from k=0,,Nk=0,\dots,N for the vector of values, x.

Usage

hermite_function_N(N, x)

Arguments

N

An integer number.

x

A numeric vector.

Value

A numeric matrix with N+1 rows and length(x) columns.


Convenience function to output the sum of orthonormal Hermite functions The method calculates the sum of orthonormal Hermite functions, ihk(xi)\sum_{i} h_k(x_{i}) from k=0,,Nk=0,\dots,N for the vector of values, x.

Description

Convenience function to output the sum of orthonormal Hermite functions

The method calculates the sum of orthonormal Hermite functions, ihk(xi)\sum_{i} h_k(x_{i}) from k=0,,Nk=0,\dots,N for the vector of values, x.

Usage

hermite_function_sum_N(N, x)

Arguments

N

An integer number.

x

A numeric vector.

Value

A numeric vector of length N+1.


Outputs the sum of orthonormal Hermite functions

Description

The method calculates the sum of orthonormal Hermite functions, ihk(xi)\sum_{i} h_k(x_{i}) from k=0,,Nk=0,\dots,N for the vector of values, x.

Usage

hermite_function_sum_serial(N, x)

Arguments

N

An integer number.

x

A numeric vector.

Value

A numeric vector of length N+1.

Author(s)

Michael Stephanou <[email protected]>


Convenience function to output the integral of the orthonormal Hermite functions on the full domain

Description

The method calculates hk(t)dt\int_{-\infty}^{\infty} h_k(t) dt for k=0,,Nk=0,\dots,N.

Usage

hermite_int_full(N)

Arguments

N

An integer number.

Value

A numeric matrix with N+1 rows and 1 columns.


Outputs integral of the orthonormal Hermite functions on the full domain

Description

The method calculates hk(t)dt\int_{-\infty}^{\infty} h_k(t) dt for k=0,,Nk=0,\dots,N.

Usage

hermite_int_full_domain(N)

Arguments

N

An integer number.

Value

A numeric matrix with N+1 rows and 1 columns.

Author(s)

Michael Stephanou <[email protected]>


Convenience function to output a definite integral of the orthonormal Hermite functions

Description

The method calculates xhk(t)dt\int_{-\infty}^{x} h_k(t) dt for k=0,,Nk=0,\dots,N and the vector of values x.

Usage

hermite_int_lower(N, x, hermite_function_matrix = NULL)

Arguments

N

An integer number.

x

A numeric vector.

hermite_function_matrix

A numeric matrix. A matrix of Hermite function values.

Value

A numeric matrix with N+1 rows and length(x) columns.


Convenience function to output a definite integral of the orthonormal Hermite functions

Description

The method calculates xhk(t)dt\int_{x}^{\infty} h_k(t) dt for k=0,,Nk=0,\dots,N and the vector of values x.

Usage

hermite_int_upper(N, x, hermite_function_matrix = NULL)

Arguments

N

An integer number.

x

A numeric vector.

hermite_function_matrix

A numeric matrix. A matrix of Hermite function values.

Value

A numeric matrix with N+1 rows and length(x) columns.


Outputs lower integral of the orthonormal Hermite functions

Description

The method calculates xhk(t)dt\int_{-\infty}^{x} h_k(t) dt for k=0,,Nk=0,\dots,N and the vector of values x.

Usage

hermite_integral_val(N, x, hermite_function_mat)

Arguments

N

An integer number.

x

A numeric vector.

hermite_function_mat

A numeric matrix of Hermite function values generated by the function hermite_function.

Value

A numeric matrix with N+1 rows and length(x) columns.

Author(s)

Michael Stephanou <[email protected]>


Outputs upper integral of the orthonormal Hermite functions

Description

The method calculates xhk(t)dt\int_{x}^{\infty} h_k(t) dt for k=0,,Nk=0,\dots,N and the vector of values x.

Usage

hermite_integral_val_upper(N, x, hermite_function_mat)

Arguments

N

An integer number.

x

A numeric vector.

hermite_function_mat

A numeric matrix of Hermite function values generated by the function hermite_function.

Value

A numeric matrix with N+1 rows and length(x) columns.

Author(s)

Michael Stephanou <[email protected]>


Outputs Hermite normalization factors

Description

The method returns numeric normalization factors that, when multiplied by the physicist Hermite polynomials times a Gaussian factor i.e. expx2/2Hk(x)\exp{x^2/2}H_k(x), yields orthonormal Hermite functions hk(x)h_k(x) for k=0,,Nk=0,\dots,N.

Usage

hermite_normalization(N)

Arguments

N

An integer number.

Value

A numeric vector of length N+1

Author(s)

Michael Stephanou <[email protected]>


Convenience function to output Hermite normalization factors

Description

The method returns numeric normalization factors that, when multiplied by the physicist Hermite polynomials times a Gaussian factor i.e. expx2/2Hk(x)\exp{x^2/2}H_k(x), yields orthonormal Hermite functions hk(x)h_k(x) for k=0,,Nk=0,\dots,N.

Usage

hermite_normalization_N(N)

Arguments

N

An integer number.

Value

A numeric vector of length N+1

Author(s)

Michael Stephanou <[email protected]>


Outputs physicist version of Hermite Polynomials

Description

The method calculates the physicist version of Hermite polynomials, Hk(x)H_k(x) from k=0,,Nk=0,\dots,N for the vector of values, x.

Usage

hermite_polynomial(N, x)

Arguments

N

An integer number.

x

A numeric vector.

Value

A numeric matrix with N+1 rows and length(x) columns.

Author(s)

Michael Stephanou <[email protected]>


Convenience function to output physicist Hermite polynomials The method calculates the physicist version of Hermite polynomials, Hk(x)H_k(x) from k=0,,Nk=0,\dots,N for the vector of values, x.

Description

Convenience function to output physicist Hermite polynomials

The method calculates the physicist version of Hermite polynomials, Hk(x)H_k(x) from k=0,,Nk=0,\dots,N for the vector of values, x.

Usage

hermite_polynomial_N(N, x)

Arguments

N

An integer number.

x

A numeric vector.

Value

A numeric matrix with N+1 rows and length(x) columns.


Initializes the Hermite series based estimator with a batch of data

Description

Initializes the Hermite series based estimator with a batch of data

Usage

initialize_batch_bivar(h_est_obj, x)

Arguments

h_est_obj

A hermite_estimator_bivar object.

x

A numeric matrix. A matrix of bivariate observations to be incorporated into the estimator. Each row corresponds to a single bivariate observation.

Value

An object of class hermite_estimator_bivar.


Initializes the Hermite series based estimator with a batch of data

Description

Initializes the Hermite series based estimator with a batch of data

Usage

initialize_batch_univar(h_est_obj, x)

Arguments

h_est_obj

A hermite_estimator_univar object.

x

A numeric vector. A vector of observations to be incorporated into the estimator.

Value

An object of class hermite_estimator_univar.


Estimates the Interquartile range (IQR)

Description

This generic method dispatches to the stats::IQR function or the IQR.hermite_estimator_univar function depending on the class of x.

Usage

IQR(x, ...)

Arguments

x

A numeric vector or hermite_estimator_univar object.

...

Optional additional arguments.

Value

A numeric value.


Estimates the Interquartile range (IQR)

Description

This creates a default generic method for the stats::IQR function.

Usage

## Default S3 method:
IQR(x, ...)

Arguments

x

A numeric vector.

...

Optional additional arguments to the stats::IQR function.

Value

A numeric value.


Estimates the Interquartile range (IQR)

Description

This generic method is a convenience wrapper around the quant method to calculate the interquartile range.

Usage

## S3 method for class 'hermite_estimator_univar'
IQR(x, ...)

Arguments

x

A hermite_estimator_univar object.

...

Optional additional arguments to the quant function namely algorithm and accelerate_series.

Value

A numeric value.


Estimates the Kendall rank correlation coefficient

Description

This method calculates the Kendall rank correlation coefficient value. It is only applicable to the bivariate Hermite estimator i.e. est_type = "bivariate".

Usage

kendall(h_est_obj, clipped = FALSE)

Arguments

h_est_obj

A hermite_estimator_bivar object.

clipped

A boolean value. Indicates whether to clip the Kendall rank correlation estimates to lie between -1 and 1.

Details

The object must be updated with observations prior to the use of this method.

Value

A numeric value.

Examples

## Not run: 
hermite_est <- hermite_estimator(N = 10, standardize = TRUE,
est_type="bivariate", observations = matrix(rnorm(30*2), nrow=30, 
ncol=2, byrow = TRUE))
kendall_est <- kendall(hermite_est)

## End(Not run)

Estimates the Kendall rank correlation coefficient

Description

This method calculates the Kendall rank correlation coefficient value using the hermite_estimator_bivar object (h_est_obj).

Usage

## S3 method for class 'hermite_estimator_bivar'
kendall(h_est_obj, clipped = FALSE)

Arguments

h_est_obj

A hermite_estimator_bivar object.

clipped

A boolean value. Indicates whether to clip the Kendall rank correlation estimates to lie between -1 and 1.

Details

The object must be updated with observations prior to the use of this method.

Value

A numeric value.


Estimates the median

Description

This generic method is a convenience wrapper around the quant method to calculate the median.

Usage

## S3 method for class 'hermite_estimator_univar'
median(x, ...)

Arguments

x

A hermite_estimator_univar object.

...

Optional additional arguments to the quant function namely algorithm and accelerate_series.

Value

A numeric value.


Merges a list of Hermite estimators

Description

Note that the estimators must be of the same type to be merged i.e. all estimators must have a consistent est_type, either "univariate" or "bivariate". In addition, the N and standardize arguments must be the same for all estimators in order to merge them. Finally, note that exponentially weighted estimators cannot be merged. If the Hermite estimators are not standardized, the merged estimator will be exactly equivalent to constructing a single estimator on the data set formed by combining the data sets used to update the respective hermite_estimator inputs. If the input Hermite estimators are standardized however, then the equivalence will be approximate but still reasonably accurate in most cases.

Usage

merge_hermite(hermite_estimators)

Arguments

hermite_estimators

A list of hermite_estimator_univar or hermite_estimator_bivar objects.

Value

An object of class hermite_estimator_univar or hermite_estimator_bivar.

Examples

## Not run: 
hermite_est_1 <- hermite_estimator(N = 10, standardize = FALSE, 
observations = rnorm(30))
hermite_est_2 <- hermite_estimator(N = 10, standardize = FALSE, 
observations = rnorm(30))
hermite_merged <- merge_hermite(list(hermite_est_1, hermite_est_2))

## End(Not run)

Merges a list of bivariate Hermite estimators

Description

This method allows a list of Hermite based estimators of class hermite_estimator_bivar to be consistently merged.

Usage

merge_hermite_bivar(hermite_estimators)

Arguments

hermite_estimators

A list of hermite_estimator_bivar objects.

Details

Note that the N and standardize arguments must be the same for all estimators in order to merge them. In addition, note that exponentially weighted estimators cannot be merged. If the Hermite estimators are not standardized, the merged estimator will be exactly equivalent to constructing a single estimator on the data set formed by combining the data sets used to update the respective hermite_estimator_bivar inputs. If the input Hermite estimators are standardized however, then the equivalence will be approximate but still accurate in most cases.

Value

An object of class hermite_estimator_bivar.


Merges a list of Hermite estimators

Description

This method allows a list of Hermite based estimators of class hermite_estimator_univar to be consistently merged.

Usage

merge_hermite_univar(hermite_estimators)

Arguments

hermite_estimators

A list of hermite_estimator_univar objects.

Details

Note that the N and standardize arguments must be the same for all estimators in order to merge them. In addition, note that exponentially weighted estimators cannot be merged. If the Hermite estimators are not standardized, the merged estimator will be exactly equivalent to constructing a single estimator on the data set formed by combining the data sets used to update the respective hermite_estimator_univar inputs. If the input Hermite estimators are standardized however, then the equivalence will be approximate but still accurate in most cases.

Value

An object of class hermite_estimator_univar.


Internal method to consistently merge the number of observations, means and variances of two bivariate Hermite estimators

Description

The algorithm to merge the variances consistently comes from Schubert, Erich, and Michael Gertz. "Numerically stable parallel computation of (co-) variance." Proceedings of the 30th International Conference on Scientific and Statistical Database Management. 2018.

Usage

merge_moments_and_count_bivar(hermite_estimator1, hermite_estimator2)

Arguments

hermite_estimator1

A hermite_estimator_bivar object.

hermite_estimator2

A hermite_estimator_bivar object.

Value

An object of class hermite_estimator_bivar


Internal method to consistently merge the number of observations, means and variances of two Hermite estimators

Description

The algorithm to merge the variances consistently comes from Schubert, Erich, and Michael Gertz. "Numerically stable parallel computation of (co-) variance." Proceedings of the 30th International Conference on Scientific and Statistical Database Management. 2018.

Usage

merge_moments_and_count_univar(hermite_estimator1, hermite_estimator2)

Arguments

hermite_estimator1

A hermite_estimator_univar object.

hermite_estimator2

A hermite_estimator_univar object.

Value

An object of class hermite_estimator_univar.


Merges two Hermite estimators

Description

Note that the estimators must be of the same type to be merged i.e. both estimators must have a consistent est_type, either "univariate" or "bivariate". In addition, the N and standardize arguments must be the same for both estimators in order to merge them. Finally, note that exponentially weighted estimators cannot be merged. If the Hermite estimators are not standardized, the merged estimator will be exactly equivalent to constructing a single estimator on the data set formed by combining the data sets used to update the respective hermite_estimator inputs. If the input Hermite estimators are standardized however, then the equivalence will be approximate but still reasonably accurate in most cases.

Usage

merge_pair(h_est_obj, hermite_estimator_other)

Arguments

h_est_obj

A hermite_estimator_univar or hermite_estimator_bivar object. The first Hermite series based estimator.

hermite_estimator_other

A hermite_estimator_univar or hermite_estimator_bivar object. The second Hermite series based estimator.

Value

An object of class hermite_estimator_univar or hermite_estimator_bivar.

Examples

## Not run: 
hermite_est_1 <- hermite_estimator(N = 10, standardize = FALSE, 
observations = rnorm(30))
hermite_est_2 <- hermite_estimator(N = 10, standardize = FALSE, 
observations = rnorm(30))
hermite_merged <- merge_pair(hermite_est_1, hermite_est_2)

## End(Not run)

Merges two bivariate Hermite estimators

Description

This method allows a pair of Hermite based estimators of class hermite_estimator_bivar to be consistently merged.

Usage

## S3 method for class 'hermite_estimator_bivar'
merge_pair(h_est_obj, hermite_estimator_other)

Arguments

h_est_obj

A hermite_estimator_bivar object. The first Hermite series based estimator.

hermite_estimator_other

A hermite_estimator_bivar object. The second Hermite series based estimator.

Details

Note that the N and standardize arguments must be the same for the two estimators in order to merge them. In addition, note that exponentially weighted estimators cannot be merged. If the Hermite estimators are not standardized, the merged estimator will be exactly equivalent to constructing a single estimator on the data set formed by combining the data sets used to update the respective hermite_estimator_bivar inputs. If the input Hermite estimators are standardized however, then the equivalence will be approximate but still accurate in most cases.

Value

An object of class hermite_estimator_bivar.


Merges two Hermite estimators

Description

This method allows a pair of Hermite based estimators of class hermite_estimator_univar to be consistently merged.

Usage

## S3 method for class 'hermite_estimator_univar'
merge_pair(h_est_obj, hermite_estimator_other)

Arguments

h_est_obj

A hermite_estimator_univar object. The first Hermite series based estimator.

hermite_estimator_other

A hermite_estimator_univar object. The second Hermite series based estimator.

Details

Note that the N and standardize arguments must be the same for the two estimators in order to merge them. In addition, note that exponentially weighted estimators cannot be merged. If the Hermite estimators are not standardized, the merged estimator will be exactly equivalent to constructing a single estimator on the data set formed by combining the data sets used to update the respective hermite_estimator_univar inputs. If the input Hermite estimators are standardized however, then the equivalence will be approximate but still accurate in most cases.

Value

An object of class hermite_estimator_univar.


Internal method to merge a list of standardized bivariate Hermite estimators

Description

Internal method to merge a list of standardized bivariate Hermite estimators

Usage

merge_standardized_helper_bivar(hermite_estimators)

Arguments

hermite_estimators

A list of hermite_estimator_bivar objects.

Value

An object of class hermite_estimator_bivar.


Internal method to merge a list of standardized Hermite estimators

Description

Internal method to merge a list of standardized Hermite estimators

Usage

merge_standardized_helper_univar(hermite_estimators)

Arguments

hermite_estimators

A list of hermite_estimator_univar objects.

Value

An object of class hermite_estimator_univar.


Plots the hcdf_bivar object as output by the hcdf function when evaluated on a hermite_estimator_bivar object.

Description

Plots the hcdf_bivar object as output by the hcdf function when evaluated on a hermite_estimator_bivar object.

Usage

## S3 method for class 'hcdf_bivar'
plot(x, main = "Hermite CDF", xlab = "X", ylab = "Y", ...)

Arguments

x

A hcdf_bivar object.

main

A string, title for plot.

xlab

A string, x label for plot.

ylab

A string, y label for plot.

...

Unused.


Plots the hcdf_univar object as output by the hcdf function when evaluated on a hermite_estimator_univar object.

Description

Plots the hcdf_univar object as output by the hcdf function when evaluated on a hermite_estimator_univar object.

Usage

## S3 method for class 'hcdf_univar'
plot(x, main = "Hermite CDF", xlab = "x", ylab = "F(x)", ...)

Arguments

x

A hcdf_univar object.

main

A string, title for plot.

xlab

A string, x label for plot.

ylab

A string, y label for plot.

...

Additional parameters for plotting.


Plots the hdensity_bivar object as output by the density function when evaluated on a hermite_estimator_bivar object.

Description

Plots the hdensity_bivar object as output by the density function when evaluated on a hermite_estimator_bivar object.

Usage

## S3 method for class 'hdensity_bivar'
plot(x, main = "Hermite PDF", xlab = "X", ylab = "Y", ...)

Arguments

x

A hdensity_bivar object.

main

A string, title for plot.

xlab

A string, x label for plot.

ylab

A string, y label for plot.

...

Unused.


Plots the hdensity_univar object as output by the density function when evaluated on a hermite_estimator_univar object.

Description

Plots the hdensity_univar object as output by the density function when evaluated on a hermite_estimator_univar object.

Usage

## S3 method for class 'hdensity_univar'
plot(x, main = "Hermite PDF", xlab = "x", ylab = "Density", ...)

Arguments

x

A hdensity_univar object.

main

A string, title for plot.

xlab

A string, x label for plot.

ylab

A string, y label for plot.

...

Additional parameters for plotting.


Prints the hcdf_bivar object as output by the hcdf function when evaluated on a hermite_estimator_bivar object.

Description

Prints the hcdf_bivar object as output by the hcdf function when evaluated on a hermite_estimator_bivar object.

Usage

## S3 method for class 'hcdf_bivar'
print(x, digits = getOption("digits") - 2L, ...)

Arguments

x

A hcdf_bivar object.

digits

A numeric value. Number of digits to round to.

...

Additional parameters for printing.


Prints the hcdf_univar object as output by the hcdf function when evaluated on a hermite_estimator_univar object.

Description

Mirrors the print method of the stats::ecdf function

Usage

## S3 method for class 'hcdf_univar'
print(x, digits = getOption("digits") - 2L, ...)

Arguments

x

A hcdf_univar object.

digits

A numeric value. Number of digits to round to.

...

Unused


Prints the hdensity_bivar object as output by the density function when evaluated on a hermite_estimator_bivar object.

Description

Prints the hdensity_bivar object as output by the density function when evaluated on a hermite_estimator_bivar object.

Usage

## S3 method for class 'hdensity_bivar'
print(x, digits = getOption("digits") - 2L, ...)

Arguments

x

A hdensity_bivar object.

digits

A numeric value. Number of digits to round to.

...

Additional parameters for printing.


Prints the hdensity_univar object as output by the density function when evaluated on a hermite_estimator_univar object.

Description

Prints the hdensity_univar object as output by the density function when evaluated on a hermite_estimator_univar object.

Usage

## S3 method for class 'hdensity_univar'
print(x, digits = getOption("digits") - 2L, ...)

Arguments

x

A hdensity_univar object.

digits

A numeric value. Number of digits to round to.

...

Unused


Prints bivariate hermite_estimator object.

Description

Prints bivariate hermite_estimator object.

Usage

## S3 method for class 'hermite_estimator_bivar'
print(x, ...)

Arguments

x

A hermite_estimator_bivar object.

...

Other arguments passed on to methods used in printing.


Prints univariate hermite_estimator object.

Description

Prints univariate hermite_estimator object.

Usage

## S3 method for class 'hermite_estimator_univar'
print(x, ...)

Arguments

x

A hermite_estimator_univar object.

...

Unused


Estimates the quantiles at a vector of probability values

Description

This method utilizes the estimator (13) in paper Stephanou, Michael, Varughese, Melvin and Iain Macdonald. "Sequential quantiles via Hermite series density estimation." Electronic Journal of Statistics 11.1 (2017): 570-607 <doi:10.1214/17-EJS1245>, with some modifications to improve the stability of numerical root finding when using the bisection algorithm. Note that this method is only applicable to the univariate Hermite estimator i.e. est_type = "univariate".

Usage

quant(h_est_obj, p, algorithm = "interpolate", accelerate_series = TRUE)

Arguments

h_est_obj

A hermite_estimator_univar object.

p

A numeric vector. A vector of probability values.

algorithm

A string. Two possible values 'interpolate' which is faster but may be less accurate or 'bisection' which is slower but potentially more accurate.

accelerate_series

A boolean value. If set to TRUE, the series acceleration methods described in:

Boyd, John P., and Dennis W. Moore. "Summability methods for Hermite functions." Dynamics of atmospheres and oceans 10.1 (1986): 51-62.

are applied. If set to FALSE, then standard summation is applied.

Details

The object must be updated with observations prior to the use of this method.

Value

A numeric vector. The vector of quantile values associated with the probabilities p.

Examples

## Not run: 
hermite_est <- hermite_estimator(N = 10, standardize = TRUE, 
est_type="univariate", observations = rnorm(30))
quant_est <- quant(hermite_est, c(0.25, 0.5, 0.75))

## End(Not run)

Estimates the quantiles at a vector of probability values

Description

This method utilizes the estimator (13) in paper Stephanou, Michael, Varughese, Melvin and Iain Macdonald. "Sequential quantiles via Hermite series density estimation." Electronic Journal of Statistics 11.1 (2017): 570-607 <doi:10.1214/17-EJS1245>, with some modifications to improve the stability of numerical root finding.

Usage

## S3 method for class 'hermite_estimator_univar'
quant(h_est_obj, p, algorithm = "interpolate", accelerate_series = TRUE)

Arguments

h_est_obj

A hermite_estimator_univar object.

p

A numeric vector. A vector of probability values.

algorithm

A string. Two possible values 'interpolate' which is faster but may be less accurate or 'bisection' which is slower but potentially more accurate.

accelerate_series

A boolean value. If set to TRUE, the series acceleration methods described in:

Boyd, John P., and Dennis W. Moore. "Summability methods for Hermite functions." Dynamics of atmospheres and oceans 10.1 (1986): 51-62.

are applied. If set to FALSE, then standard summation is applied.

Value

A numeric vector. The vector of quantile values associated with the probabilities p.


Estimates the quantiles at a vector of probability values

Description

This generic method is a convenience wrapper around the quant method

Usage

## S3 method for class 'hermite_estimator_univar'
quantile(x, probs = seq(0, 1, 0.25), ...)

Arguments

x

A hermite_estimator_univar object.

probs

A numeric vector. A vector of probability values.

...

Optional additional arguments to the quant function namely algorithm and accelerate_series.

Value

A numeric vector. The vector of quantile values associated with the probabilities probs.


Estimates the Spearman's rank correlation coefficient

Description

This method utilizes the estimator (8) in the paper Stephanou, Michael and Varughese, Melvin. "Sequential estimation of Spearman rank correlation using Hermite series estimators." Journal of Multivariate Analysis (2021) <doi:10.1016/j.jmva.2021.104783> to calculate the Spearman rank correlation coefficient. It is only applicable to the bivariate Hermite estimator i.e. est_type = "bivariate".

Usage

spearmans(h_est_obj, clipped = FALSE)

Arguments

h_est_obj

A hermite_estimator_bivar object.

clipped

A boolean value. Indicates whether to clip Spearman's rank correlation estimates to lie between -1 and 1.

Details

The object must be updated with observations prior to the use of this method.

Value

A numeric value.

Examples

## Not run: 
hermite_est <- hermite_estimator(N = 10, standardize = TRUE,
est_type="bivariate", observations = matrix(rnorm(30*2), nrow=30, 
ncol=2, byrow = TRUE))
spearmans_est <- spearmans(hermite_est)

## End(Not run)

Estimates the Spearman's rank correlation coefficient

Description

This method calculates the Spearman's rank correlation coefficient value using the hermite_estimator_bivar object (h_est_obj).

Usage

## S3 method for class 'hermite_estimator_bivar'
spearmans(h_est_obj, clipped = FALSE)

Arguments

h_est_obj

A hermite_estimator_bivar object.

clipped

A boolean value. Indicates whether to clip Spearman's rank correlation estimates to lie between -1 and 1.

Details

The method utilizes the estimator defined in the paper Stephanou, Michael and Varughese, Melvin. "Sequential Estimation of Nonparametric Correlation using Hermite Series Estimators." arXiv Preprint (2020), https://arxiv.org/abs/2012.06287

The object must be updated with observations prior to the use of this method.

Value

A numeric value.


Standardizes the observation x and updates the online moment inputs

Description

Standardizes the observation x and updates the online moment inputs

Usage

standardizeInputs(x, n_obs, current_mean, current_var)

Arguments

x

A numeric value.

n_obs

A numeric value. The number of observations.

current_mean

A numeric value.

current_var

A numeric value.

Value

A numeric vector. The first element is the updated mean. The second element is the updated variance times n_obs. The third element is the updated, standardized value of x.

Author(s)

Michael Stephanou <[email protected]>


Standardizes the observation x and updates the online moment inputs

Description

The online moments are updated via exponential weighting.

Usage

standardizeInputsEW(x, n_obs, lambda, current_mean, current_var)

Arguments

x

A numeric value.

n_obs

A numeric value. The number of observations.

lambda

A numeric value.

current_mean

A numeric value.

current_var

A numeric value.

Value

A numeric vector. The first element is the updated mean. The second element is the updated variance times n_obs. The third element is the updated, standardized value of x.

Author(s)

Michael Stephanou <[email protected]>


Summarizes the hcdf_bivar object as output by the hcdf function when evaluated on a hermite_estimator_bivar object.

Description

Summarizes the hcdf_bivar object as output by the hcdf function when evaluated on a hermite_estimator_bivar object.

Usage

## S3 method for class 'hcdf_bivar'
summary(object, digits = getOption("digits") - 2L, ...)

Arguments

object

A hcdf_bivar object.

digits

A numeric value. Number of digits to round to.

...

Additional parameters for printing.


Summarizes the hcdf_univar object as output by the hcdf function when evaluated on a hermite_estimator_univar object.

Description

Summarizes the hcdf_univar object as output by the hcdf function when evaluated on a hermite_estimator_univar object.

Usage

## S3 method for class 'hcdf_univar'
summary(object, digits = getOption("digits") - 2L, ...)

Arguments

object

A hcdf_univar object.

digits

A numeric value. Number of digits to round to.

...

Unused.


Summarizes bivariate hermite_estimator object.

Description

Outputs key parameters of a bivariate hermite_estimator object along with estimates of the mean and standard deviation of the first and second dimensions of the bivariate data that the object has been updated with. Also outputs the Spearman's Rho and Kendall Tau of the bivariate data that the object has been updated with.

Usage

## S3 method for class 'hermite_estimator_bivar'
summary(object, digits = max(3, getOption("digits") - 3), ...)

Arguments

object

A hermite_estimator_bivar object.

digits

A numeric value. Number of digits to round to.

...

Other arguments passed on to methods used in summary.


Summarizes univariate hermite_estimator object.

Description

Outputs key parameters of a univariate hermite_estimator object along with estimates of the mean, standard deviation and deciles of the data that the object has been updated with.

Usage

## S3 method for class 'hermite_estimator_univar'
summary(object, digits = max(3, getOption("digits") - 3), ...)

Arguments

object

A hermite_estimator_univar object.

digits

A numeric value. Number of digits to round to.

...

Other arguments passed on to methods used in summary.


Updates the Hermite series based estimator sequentially

Description

This method can be applied in sequential estimation settings.

Usage

update_sequential(h_est_obj, x)

Arguments

h_est_obj

A hermite_estimator_univar or hermite_estimator_bivar object.

x

A numeric vector or matrix. Observations to be incorporated into the estimator. Note that for univariate estimators, x is a numeric vector whereas for bivariate estimators, x is a numeric vector of length 2 or a n x 2 matrix with n bivariate observations to be incorporated into the estimator.

Value

An object of class hermite_estimator_univar or hermite_estimator_bivar.

Examples

## Not run: 
hermite_est <- hermite_estimator(N = 10, standardize = TRUE, 
est_type="univariate")
hermite_est <- update_sequential(hermite_est, x = 2)
hermite_est <- hermite_estimator(N = 10, standardize = TRUE, 
est_type="bivariate")
hermite_est <- update_sequential(hermite_est, x = c(1,2))

## End(Not run)

Updates the Hermite series based estimator sequentially

Description

This method can be applied in sequential estimation settings.

Usage

## S3 method for class 'hermite_estimator_bivar'
update_sequential(h_est_obj, x)

Arguments

h_est_obj

A hermite_estimator_bivar object.

x

A numeric vector of length 2 or a n x 2 matrix with n bivariate observations to be incorporated into the estimator.

Value

An object of class hermite_estimator_bivar.


Updates the Hermite series based estimator sequentially

Description

This method can be applied in sequential estimation settings.

Usage

## S3 method for class 'hermite_estimator_univar'
update_sequential(h_est_obj, x)

Arguments

h_est_obj

A hermite_estimator_univar object.

x

A numeric vector. A vector of observations to be incorporated into the estimator.

Value

An object of class hermite_estimator_univar.