| 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: | 2026-05-18 07:30:11 UTC |
| Source: | https://github.com/mikejareds/hermiter |
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>.
Index of help topics:
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
IQR Estimates the Interquartile range (IQR)
IQR.default Estimates the Interquartile range (IQR)
IQR.hermite_estimator_univar
Estimates the Interquartile range (IQR)
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
Michael Stephanou <[email protected]>
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.
cor(x, y = NULL, use = "everything", method = "pearson", ...)cor(x, y = NULL, use = "everything", method = "pearson", ...)
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". |
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.
cum_prob(h_est_obj, x, clipped, accelerate_series = TRUE)cum_prob(h_est_obj, x, clipped, accelerate_series = TRUE)
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. |
The object must be updated with observations prior to the use of the method.
A numeric vector of cumulative probability values.
## 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)## 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)
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).
## S3 method for class 'hermite_estimator_bivar' cum_prob(h_est_obj, x, clipped = FALSE, accelerate_series = FALSE)## S3 method for class 'hermite_estimator_bivar' cum_prob(h_est_obj, x, clipped = FALSE, accelerate_series = FALSE)
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. |
The object must be updated with observations prior to the use of this method.
A numeric vector of cumulative probability values.
This method calculates the cumulative probability values at a vector of x values using the hermite_estimator_univar object (h_est_obj).
## S3 method for class 'hermite_estimator_univar' cum_prob(h_est_obj, x, clipped = FALSE, accelerate_series = TRUE)## S3 method for class 'hermite_estimator_univar' cum_prob(h_est_obj, x, clipped = FALSE, accelerate_series = TRUE)
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. |
The object must be updated with observations prior to the use of this method.
A numeric vector of cumulative probability values.
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.
dens(h_est_obj, x, clipped, accelerate_series = TRUE)dens(h_est_obj, x, clipped, accelerate_series = TRUE)
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. |
The object must be updated with observations prior to the use of the method.
A numeric vector of probability density values.
## 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)## 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)
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).
## S3 method for class 'hermite_estimator_bivar' dens(h_est_obj, x, clipped = FALSE, accelerate_series = FALSE)## S3 method for class 'hermite_estimator_bivar' dens(h_est_obj, x, clipped = FALSE, accelerate_series = FALSE)
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. |
The object must be updated with observations prior to the use of the method.
A numeric vector of probability density values.
This method calculates the probability density values at a vector of x values using the hermite_estimator_univar object (h_est_obj).
## S3 method for class 'hermite_estimator_univar' dens(h_est_obj, x, clipped = FALSE, accelerate_series = TRUE)## S3 method for class 'hermite_estimator_univar' dens(h_est_obj, x, clipped = FALSE, accelerate_series = TRUE)
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. |
The object must be updated with observations prior to the use of the method.
A numeric vector of probability density values.
The hermite_estimator_bivar object, x must be updated with observations prior to the use of the method.
## S3 method for class 'hermite_estimator_bivar' density(x, x_lower = NA, x_upper = NA, ...)## S3 method for class 'hermite_estimator_bivar' density(x, x_lower = NA, x_upper = NA, ...)
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. |
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.
The hermite_estimator_univar, x must be updated with observations prior to the use of the method.
## S3 method for class 'hermite_estimator_univar' density(x, x_lower = NA, x_upper = NA, ...)## S3 method for class 'hermite_estimator_univar' density(x, x_lower = NA, x_upper = NA, ...)
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. |
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.
using
Gauss-Hermite quadrature with 100 terms.Calculates using
Gauss-Hermite quadrature with 100 terms.
gauss_hermite_quad_100(f)gauss_hermite_quad_100(f)
f |
A function. |
A numeric value.
The h_est_obj object must be updated with observations prior to the use of the method.
hcdf( h_est_obj, clipped = FALSE, accelerate_series = TRUE, x_lower = NA, x_upper = NA )hcdf( h_est_obj, clipped = FALSE, accelerate_series = TRUE, x_lower = NA, x_upper = NA )
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. |
A hcdf_univar or hcdf_bivar object.
The hermite_estimator_bivar object h_est_obj must be updated with observations prior to the use of this method.
## S3 method for class 'hermite_estimator_bivar' hcdf( h_est_obj, clipped = FALSE, accelerate_series = TRUE, x_lower = NA, x_upper = NA )## S3 method for class 'hermite_estimator_bivar' hcdf( h_est_obj, clipped = FALSE, accelerate_series = TRUE, x_lower = NA, x_upper = NA )
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. |
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.
The hermite_estimator_univar object, h_est_obj must be updated with observations prior to the use of this method.
## S3 method for class 'hermite_estimator_univar' hcdf( h_est_obj, clipped = FALSE, accelerate_series = TRUE, x_lower = NA, x_upper = NA )## S3 method for class 'hermite_estimator_univar' hcdf( h_est_obj, clipped = FALSE, accelerate_series = TRUE, x_lower = NA, x_upper = NA )
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. |
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.
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).
hermite_estimator( N = NA, standardize = TRUE, exp_weight_lambda = NA, est_type = "univariate", observations = c() )hermite_estimator( N = NA, standardize = TRUE, exp_weight_lambda = NA, est_type = "univariate", observations = c() )
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. |
An S3 object of class hermite_estimator_univar or hermite_estimator_bivar.
Michael Stephanou <[email protected]>
## 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)## 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)
This method constructs an S3 object with methods for nonparametric estimation of bivariate pdfs and cdfs along with nonparametric correlations.
hermite_estimator_bivar( N = 30, standardize = TRUE, exp_weight_lambda = NA, observations = c() )hermite_estimator_bivar( N = 30, standardize = TRUE, exp_weight_lambda = NA, observations = c() )
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. |
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.
An S3 object of class hermite_estimator_bivar, with methods for density function and distribution function estimation along with Spearman's rank correlation estimation.
Michael Stephanou <[email protected]>
This method constructs an S3 object with associated methods for univariate nonparametric estimation of pdfs, cdfs and quantiles.
hermite_estimator_univar( N = 50, standardize = TRUE, exp_weight_lambda = NA, observations = c() )hermite_estimator_univar( N = 50, standardize = TRUE, exp_weight_lambda = NA, observations = c() )
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. |
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.
An S3 object of class hermite_estimator_univar, with methods for density function, distribution function and quantile function estimation.
Michael Stephanou <[email protected]>
The method calculates the orthonormal Hermite functions,
from for the vector of values, x.
hermite_function(N, x)hermite_function(N, x)
N |
An integer number. |
x |
A numeric vector. |
A numeric matrix with N+1 rows and length(x) columns.
Michael Stephanou <[email protected]>
from for the vector of values, x.Convenience function to output orthonormal Hermite functions
The method calculates the orthonormal Hermite functions,
from for the vector of values, x.
hermite_function_N(N, x)hermite_function_N(N, x)
N |
An integer number. |
x |
A numeric vector. |
A numeric matrix with N+1 rows and length(x) columns.
from for the vector of values,
x.Convenience function to output the sum of orthonormal Hermite functions
The method calculates the sum of orthonormal Hermite functions,
from for the vector of values,
x.
hermite_function_sum_N(N, x)hermite_function_sum_N(N, x)
N |
An integer number. |
x |
A numeric vector. |
A numeric vector of length N+1.
The method calculates the sum of orthonormal Hermite functions,
from for the vector of values,
x.
hermite_function_sum_serial(N, x)hermite_function_sum_serial(N, x)
N |
An integer number. |
x |
A numeric vector. |
A numeric vector of length N+1.
Michael Stephanou <[email protected]>
The method calculates
for .
hermite_int_full(N)hermite_int_full(N)
N |
An integer number. |
A numeric matrix with N+1 rows and 1 columns.
The method calculates
for .
hermite_int_full_domain(N)hermite_int_full_domain(N)
N |
An integer number. |
A numeric matrix with N+1 rows and 1 columns.
Michael Stephanou <[email protected]>
The method calculates
for and the vector of values x.
hermite_int_lower(N, x, hermite_function_matrix = NULL)hermite_int_lower(N, x, hermite_function_matrix = NULL)
N |
An integer number. |
x |
A numeric vector. |
hermite_function_matrix |
A numeric matrix. A matrix of Hermite function values. |
A numeric matrix with N+1 rows and length(x) columns.
The method calculates
for and the vector of values x.
hermite_int_upper(N, x, hermite_function_matrix = NULL)hermite_int_upper(N, x, hermite_function_matrix = NULL)
N |
An integer number. |
x |
A numeric vector. |
hermite_function_matrix |
A numeric matrix. A matrix of Hermite function values. |
A numeric matrix with N+1 rows and length(x) columns.
The method calculates
for and the vector of values x.
hermite_integral_val(N, x, hermite_function_mat)hermite_integral_val(N, x, hermite_function_mat)
N |
An integer number. |
x |
A numeric vector. |
hermite_function_mat |
A numeric matrix of Hermite function values generated by the function hermite_function. |
A numeric matrix with N+1 rows and length(x) columns.
Michael Stephanou <[email protected]>
The method calculates
for and the vector of values x.
hermite_integral_val_upper(N, x, hermite_function_mat)hermite_integral_val_upper(N, x, hermite_function_mat)
N |
An integer number. |
x |
A numeric vector. |
hermite_function_mat |
A numeric matrix of Hermite function values generated by the function hermite_function. |
A numeric matrix with N+1 rows and length(x) columns.
Michael Stephanou <[email protected]>
The method returns numeric normalization factors that, when multiplied by
the physicist Hermite polynomials times a Gaussian factor i.e.
, yields orthonormal
Hermite functions for .
hermite_normalization(N)hermite_normalization(N)
N |
An integer number. |
A numeric vector of length N+1
Michael Stephanou <[email protected]>
The method returns numeric normalization factors that, when multiplied by
the physicist Hermite polynomials times a Gaussian factor i.e.
, yields orthonormal Hermite functions
for .
hermite_normalization_N(N)hermite_normalization_N(N)
N |
An integer number. |
A numeric vector of length N+1
Michael Stephanou <[email protected]>
The method calculates the physicist version of Hermite polynomials,
from for the vector of values, x.
hermite_polynomial(N, x)hermite_polynomial(N, x)
N |
An integer number. |
x |
A numeric vector. |
A numeric matrix with N+1 rows and length(x) columns.
Michael Stephanou <[email protected]>
from for the vector of values, x.Convenience function to output physicist Hermite polynomials
The method calculates the physicist version of Hermite polynomials,
from for the vector of values, x.
hermite_polynomial_N(N, x)hermite_polynomial_N(N, x)
N |
An integer number. |
x |
A numeric vector. |
A numeric matrix with N+1 rows and length(x) columns.
Initializes the Hermite series based estimator with a batch of data
initialize_batch_bivar(h_est_obj, x)initialize_batch_bivar(h_est_obj, x)
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. |
An object of class hermite_estimator_bivar.
Initializes the Hermite series based estimator with a batch of data
initialize_batch_univar(h_est_obj, x)initialize_batch_univar(h_est_obj, x)
h_est_obj |
A hermite_estimator_univar object. |
x |
A numeric vector. A vector of observations to be incorporated into the estimator. |
An object of class hermite_estimator_univar.
This generic method dispatches to the stats::IQR function or the IQR.hermite_estimator_univar function depending on the class of x.
IQR(x, ...)IQR(x, ...)
x |
A numeric vector or hermite_estimator_univar object. |
... |
Optional additional arguments. |
A numeric value.
This creates a default generic method for the stats::IQR function.
## Default S3 method: IQR(x, ...)## Default S3 method: IQR(x, ...)
x |
A numeric vector. |
... |
Optional additional arguments to the stats::IQR function. |
A numeric value.
This generic method is a convenience wrapper around the quant method to calculate the interquartile range.
## S3 method for class 'hermite_estimator_univar' IQR(x, ...)## S3 method for class 'hermite_estimator_univar' IQR(x, ...)
x |
A hermite_estimator_univar object. |
... |
Optional additional arguments to the quant function namely algorithm and accelerate_series. |
A numeric value.
This method calculates the Kendall rank correlation coefficient value. It is only applicable to the bivariate Hermite estimator i.e. est_type = "bivariate".
kendall(h_est_obj, clipped = FALSE)kendall(h_est_obj, clipped = FALSE)
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. |
The object must be updated with observations prior to the use of this method.
A numeric value.
## 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)## 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)
This method calculates the Kendall rank correlation coefficient value using the hermite_estimator_bivar object (h_est_obj).
## S3 method for class 'hermite_estimator_bivar' kendall(h_est_obj, clipped = FALSE)## S3 method for class 'hermite_estimator_bivar' kendall(h_est_obj, clipped = FALSE)
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. |
The object must be updated with observations prior to the use of this method.
A numeric value.
This generic method is a convenience wrapper around the quant method to calculate the median.
## S3 method for class 'hermite_estimator_univar' median(x, ...)## S3 method for class 'hermite_estimator_univar' median(x, ...)
x |
A hermite_estimator_univar object. |
... |
Optional additional arguments to the quant function namely algorithm and accelerate_series. |
A numeric value.
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.
merge_hermite(hermite_estimators)merge_hermite(hermite_estimators)
hermite_estimators |
A list of hermite_estimator_univar or hermite_estimator_bivar objects. |
An object of class hermite_estimator_univar or hermite_estimator_bivar.
## 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)## 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)
This method allows a list of Hermite based estimators of class hermite_estimator_bivar to be consistently merged.
merge_hermite_bivar(hermite_estimators)merge_hermite_bivar(hermite_estimators)
hermite_estimators |
A list of hermite_estimator_bivar objects. |
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.
An object of class hermite_estimator_bivar.
This method allows a list of Hermite based estimators of class hermite_estimator_univar to be consistently merged.
merge_hermite_univar(hermite_estimators)merge_hermite_univar(hermite_estimators)
hermite_estimators |
A list of hermite_estimator_univar objects. |
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.
An object of class hermite_estimator_univar.
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.
merge_moments_and_count_bivar(hermite_estimator1, hermite_estimator2)merge_moments_and_count_bivar(hermite_estimator1, hermite_estimator2)
hermite_estimator1 |
A hermite_estimator_bivar object. |
hermite_estimator2 |
A hermite_estimator_bivar object. |
An object of class hermite_estimator_bivar
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.
merge_moments_and_count_univar(hermite_estimator1, hermite_estimator2)merge_moments_and_count_univar(hermite_estimator1, hermite_estimator2)
hermite_estimator1 |
A hermite_estimator_univar object. |
hermite_estimator2 |
A hermite_estimator_univar object. |
An object of class hermite_estimator_univar.
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.
merge_pair(h_est_obj, hermite_estimator_other)merge_pair(h_est_obj, hermite_estimator_other)
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. |
An object of class hermite_estimator_univar or hermite_estimator_bivar.
## 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)## 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)
This method allows a pair of Hermite based estimators of class hermite_estimator_bivar to be consistently merged.
## S3 method for class 'hermite_estimator_bivar' merge_pair(h_est_obj, hermite_estimator_other)## S3 method for class 'hermite_estimator_bivar' merge_pair(h_est_obj, hermite_estimator_other)
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. |
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.
An object of class hermite_estimator_bivar.
This method allows a pair of Hermite based estimators of class hermite_estimator_univar to be consistently merged.
## S3 method for class 'hermite_estimator_univar' merge_pair(h_est_obj, hermite_estimator_other)## S3 method for class 'hermite_estimator_univar' merge_pair(h_est_obj, hermite_estimator_other)
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. |
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.
An object of class hermite_estimator_univar.
Internal method to merge a list of standardized bivariate Hermite estimators
merge_standardized_helper_bivar(hermite_estimators)merge_standardized_helper_bivar(hermite_estimators)
hermite_estimators |
A list of hermite_estimator_bivar objects. |
An object of class hermite_estimator_bivar.
Internal method to merge a list of standardized Hermite estimators
merge_standardized_helper_univar(hermite_estimators)merge_standardized_helper_univar(hermite_estimators)
hermite_estimators |
A list of hermite_estimator_univar objects. |
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.
## S3 method for class 'hcdf_bivar' plot(x, main = "Hermite CDF", xlab = "X", ylab = "Y", ...)## S3 method for class 'hcdf_bivar' plot(x, main = "Hermite CDF", xlab = "X", ylab = "Y", ...)
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.
## S3 method for class 'hcdf_univar' plot(x, main = "Hermite CDF", xlab = "x", ylab = "F(x)", ...)## S3 method for class 'hcdf_univar' plot(x, main = "Hermite CDF", xlab = "x", ylab = "F(x)", ...)
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.
## S3 method for class 'hdensity_bivar' plot(x, main = "Hermite PDF", xlab = "X", ylab = "Y", ...)## S3 method for class 'hdensity_bivar' plot(x, main = "Hermite PDF", xlab = "X", ylab = "Y", ...)
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.
## S3 method for class 'hdensity_univar' plot(x, main = "Hermite PDF", xlab = "x", ylab = "Density", ...)## S3 method for class 'hdensity_univar' plot(x, main = "Hermite PDF", xlab = "x", ylab = "Density", ...)
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.
## S3 method for class 'hcdf_bivar' print(x, digits = getOption("digits") - 2L, ...)## S3 method for class 'hcdf_bivar' print(x, digits = getOption("digits") - 2L, ...)
x |
A hcdf_bivar object. |
digits |
A numeric value. Number of digits to round to. |
... |
Additional parameters for printing. |
Mirrors the print method of the stats::ecdf function
## S3 method for class 'hcdf_univar' print(x, digits = getOption("digits") - 2L, ...)## S3 method for class 'hcdf_univar' print(x, digits = getOption("digits") - 2L, ...)
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.
## S3 method for class 'hdensity_bivar' print(x, digits = getOption("digits") - 2L, ...)## S3 method for class 'hdensity_bivar' print(x, digits = getOption("digits") - 2L, ...)
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.
## S3 method for class 'hdensity_univar' print(x, digits = getOption("digits") - 2L, ...)## S3 method for class 'hdensity_univar' print(x, digits = getOption("digits") - 2L, ...)
x |
A hdensity_univar object. |
digits |
A numeric value. Number of digits to round to. |
... |
Unused |
Prints bivariate hermite_estimator object.
## S3 method for class 'hermite_estimator_bivar' print(x, ...)## S3 method for class 'hermite_estimator_bivar' print(x, ...)
x |
A hermite_estimator_bivar object. |
... |
Other arguments passed on to methods used in printing. |
Prints univariate hermite_estimator object.
## S3 method for class 'hermite_estimator_univar' print(x, ...)## S3 method for class 'hermite_estimator_univar' print(x, ...)
x |
A hermite_estimator_univar object. |
... |
Unused |
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".
quant(h_est_obj, p, algorithm = "interpolate", accelerate_series = TRUE)quant(h_est_obj, p, algorithm = "interpolate", accelerate_series = TRUE)
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. |
The object must be updated with observations prior to the use of this method.
A numeric vector. The vector of quantile values associated with the probabilities p.
## 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)## 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)
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.
## S3 method for class 'hermite_estimator_univar' quant(h_est_obj, p, algorithm = "interpolate", accelerate_series = TRUE)## S3 method for class 'hermite_estimator_univar' quant(h_est_obj, p, algorithm = "interpolate", accelerate_series = TRUE)
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. |
A numeric vector. The vector of quantile values associated with the probabilities p.
This generic method is a convenience wrapper around the quant method
## S3 method for class 'hermite_estimator_univar' quantile(x, probs = seq(0, 1, 0.25), ...)## S3 method for class 'hermite_estimator_univar' quantile(x, probs = seq(0, 1, 0.25), ...)
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. |
A numeric vector. The vector of quantile values associated with the probabilities probs.
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".
spearmans(h_est_obj, clipped = FALSE)spearmans(h_est_obj, clipped = FALSE)
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. |
The object must be updated with observations prior to the use of this method.
A numeric value.
## 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)## 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)
This method calculates the Spearman's rank correlation coefficient value using the hermite_estimator_bivar object (h_est_obj).
## S3 method for class 'hermite_estimator_bivar' spearmans(h_est_obj, clipped = FALSE)## S3 method for class 'hermite_estimator_bivar' spearmans(h_est_obj, clipped = FALSE)
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. |
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.
A numeric value.
Standardizes the observation x and updates the online moment inputs
standardizeInputs(x, n_obs, current_mean, current_var)standardizeInputs(x, n_obs, current_mean, current_var)
x |
A numeric value. |
n_obs |
A numeric value. The number of observations. |
current_mean |
A numeric value. |
current_var |
A numeric 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.
Michael Stephanou <[email protected]>
The online moments are updated via exponential weighting.
standardizeInputsEW(x, n_obs, lambda, current_mean, current_var)standardizeInputsEW(x, n_obs, lambda, current_mean, current_var)
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. |
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.
Michael Stephanou <[email protected]>
Summarizes the hcdf_bivar object as output by the hcdf function when evaluated on a hermite_estimator_bivar object.
## S3 method for class 'hcdf_bivar' summary(object, digits = getOption("digits") - 2L, ...)## S3 method for class 'hcdf_bivar' summary(object, digits = getOption("digits") - 2L, ...)
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.
## S3 method for class 'hcdf_univar' summary(object, digits = getOption("digits") - 2L, ...)## S3 method for class 'hcdf_univar' summary(object, digits = getOption("digits") - 2L, ...)
object |
A hcdf_univar object. |
digits |
A numeric value. Number of digits to round to. |
... |
Unused. |
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.
## S3 method for class 'hermite_estimator_bivar' summary(object, digits = max(3, getOption("digits") - 3), ...)## S3 method for class 'hermite_estimator_bivar' summary(object, digits = max(3, getOption("digits") - 3), ...)
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. |
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.
## S3 method for class 'hermite_estimator_univar' summary(object, digits = max(3, getOption("digits") - 3), ...)## S3 method for class 'hermite_estimator_univar' summary(object, digits = max(3, getOption("digits") - 3), ...)
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. |
This method can be applied in sequential estimation settings.
update_sequential(h_est_obj, x)update_sequential(h_est_obj, x)
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. |
An object of class hermite_estimator_univar or hermite_estimator_bivar.
## 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)## 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)
This method can be applied in sequential estimation settings.
## S3 method for class 'hermite_estimator_bivar' update_sequential(h_est_obj, x)## S3 method for class 'hermite_estimator_bivar' update_sequential(h_est_obj, x)
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. |
An object of class hermite_estimator_bivar.
This method can be applied in sequential estimation settings.
## S3 method for class 'hermite_estimator_univar' update_sequential(h_est_obj, x)## S3 method for class 'hermite_estimator_univar' update_sequential(h_est_obj, x)
h_est_obj |
A hermite_estimator_univar object. |
x |
A numeric vector. A vector of observations to be incorporated into the estimator. |
An object of class hermite_estimator_univar.