Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#' @title Compute the Md statistic.
#' @description Compute the Md statistic. The Md statistic is the difference
#' 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.
#' This statistic should converge to zero.
#' @inheritParams calibrateSigma
#' @return Md double :: The Md statistic defined by Lo and MacKinlay.
mDifferences <- 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)
Md <- sigmaB - sigmaA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment