R/bivariate_statistics.R

Defines functions correlation_coefficient means_and_covariance covariance

Documented in correlation_coefficient covariance means_and_covariance

#' @title Bivariate Statistics Functions
#' @name bivariate_statistics
#' @description Functions to compute various bivariate statistics.
#' @seealso [Boost Documentation](https://www.boost.org/doc/libs/latest/libs/math/doc/html/math_toolkit/bivariate_statistics.html) for more details on the mathematical background.
#' @param x A numeric vector.
#' @param y A numeric vector.
#' @return A numeric value or vector with the computed statistic.
#' @examples
#' # Covariance
#' covariance(c(1, 2, 3), c(4, 5, 6))
#' # Means and Covariance
#' means_and_covariance(c(1, 2, 3), c(4, 5, 6))
#' # Correlation Coefficient
#' correlation_coefficient(c(1, 2, 3), c(4, 5, 6))
NULL

#' @rdname bivariate_statistics
#' @export
covariance <- function(x, y) {
  .Call(`covariance_`, x, y)
}

#' @rdname bivariate_statistics
#' @export
means_and_covariance <- function(x, y) {
  .Call(`means_and_covariance_`, x, y)
}

#' @rdname bivariate_statistics
#' @export
correlation_coefficient <- function(x, y) {
  .Call(`correlation_coefficient_`, x, y)
}

Try the boostmath package in your browser

Any scripts or data that you put into this service are public.

boostmath documentation built on Dec. 15, 2025, 5:07 p.m.