Nothing
#' calculate the Hurst Index
#' The Hurst index can be used to measure whether returns are mean reverting,
#' totally random, or persistent.
#'
#' Hurst obtained a dimensionless statistical exponent by dividing the range
#' by the standard deviation of the observations,
#' so this approach is commonly referred to as rescaled range (R/S) analysis.
#'
#' \deqn{H = log(m)/log(n)}
#'
#' where
#' \eqn{m = [max(r_i) - min(r_i)]/sigma_p} and
#' \eqn{n = number of observations}
#
#' A Hurst index between 0.5 and 1 suggests that the returns are persistent.
#' At 0.5, the index suggests returns are totally random. Between 0 and 0.5
#' it suggests that the returns are mean reverting.
#'
#' H.E. Hurst originally developed the Hurst index to help establish optimal
#' water storage along the Nile. Nile floods are extremely persistent,
#' measuring a Hurst index of 0.9. Peters (1991) notes that Equity markets
#' have a Hurst index in excess of 0.5, with typical values of around 0.7.
#' That appears to be anomalous in the context of the mainstream 'rational
#' behaviour' theories of economics, and suggests existence of a powerful
#' 'long-term memory' causal dependence. Clarkson (2001) suggests that an
#' 'over-reaction bias' could be expected to generate a powerful 'long-term
#' memory' effect in share prices.
#'
#' @param R an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns
#' @param \dots any other passthru parameters
#' @references
#' Clarkson, R. (2001) FARM: a financial actuarial risk model. In Chapter
#' 12 of Managing Downside Risk in Financial Markets, ed. Sortino, F.
#' and Satchel, S. Woburn MA. Butterworth-Heinemann Finance.
#'
#' Peters, E.E (1991) Chaos and Order in Capital Markets, New York: Wiley.
#'
#' Bacon, Carl. (2008) Practical Portfolio Performance Measurement and Attribution, 2nd Edition. London: John Wiley & Sons.
#'
#' @export
HurstIndex <-
function (R, ...) {
R = checkData(R)
rs <- function(R) {
R = na.omit(R)
m = (max(R) - min(R))/sd.xts(R)
n = length(R)
result = log(m)/log(n)
return(result)
}
result = apply(R, MARGIN = 2, rs)
dim(result) = c(1,NCOL(R))
colnames(result) = colnames(R)
rownames(result) = "Hurst Index"
return (result)
}
RescaledRange <-
function (R, ...) {
HurstIndex(R, ...)
}
###############################################################################
# R (http://r-project.org/) Econometrics for Performance and Risk Analysis
#
# Copyright (c) 2004-2020 Peter Carl and Brian G. Peterson
#
# This R package is distributed under the terms of the GNU Public License (GPL)
# for full details see the file COPYING
#
# $Id$
#
###############################################################################
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.