Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#' @title Compute the Mr statistic.
#' @description Compute the Mr statistic. The Md statistic is the ratio between
#' two estimate values for Sigma computed using the calibrateSigma function for
#' sampling intervals 1 and the estimate value for Sima computed using the
#' CalibrateSigmaOverlapping function for sampling inveral q minus 1.
#' This statistic should converge to zero.
#' @inheritParams calibrateSigma
#' @return Mr double :: The Mr statistic defined by Lo and MacKinlay.
mRatio <- function(X, q, annualize = FALSE, unbiased = TRUE) {
# Estimate the value of sigma at sampling intervals 1 and q.
sigmaA <- calibrateSigma(X, q = 1, annualize, unbiased)
sigmaB <- calibrateSigmaOverlapping(X, q = q, annualize, unbiased)
Mr <- (sigmaB / sigmaA) - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment