Classic Estimator for the Hurst Effect
Functions to estimate the rescaled range (R/S) statistic and the Hurst coefficient. The estimator is based on the original work by Hurst (1951) and is included for historical reasons. Moreover, the estimator by the variance plot is also provided. The estimators are only recommended for illustration purposes.
LongMemory.ClassicEstimators
— ModuleClassicEstimators
This module contains functions to estimate them Hurst coefficient, closely related to the long memory parameter, of a time series using the rescaled range (R/S) statistic.
Author
LongMemory.ClassicEstimators.autocorrelation
— Functionautocorrelation(x::Array, k::Int; flag::Bool=false)
Computes the autocorrelation function of a time series.
Arguments
x::Array
: The time series.k::Int
: The lag of the autocorrelation.
Output
acf::Array
: The autocorrelation function.
Optional arguments
flag::Bool
: If true, the autocorrelation function is displayed.
Examples
julia> autocorrelation(randn(100), 10)
LongMemory.ClassicEstimators.autocorrelation_plot
— Functionautocorrelation_plot(x::Array, k::Int)
Computes the autocorrelation function of a time series.
Arguments
x::Array
: The time series.k::Int
: The lag of the autocorrelation.
Output
p1::Plots.Plot
: The autocorrelation function.
Examples
julia> autocorrelation_plot(randn(100), 10)
LongMemory.ClassicEstimators.autocovariance
— Methodautocovariance(x::Array, k::Int)
Computes the autocovariance of a time series.
Arguments
x::Array
: The time series.k::Int
: The lag of the autocovariance.
Output
acv::Array
: The autocovariance.
Examples
julia> autocovariance(randn(100), 2)
LongMemory.ClassicEstimators.log_variance_est
— Methodlog_variance_est(x::Array; m::Int=200)
Computes the long memory estimate using the log-variance.
Arguments
x::Array
: The time series.
Output
d_var::Real
: The estimated long memory parameter computed as (beta+1)/2, where beta is the slope of the linear regression of the log-variance plot.
Optional arguments
m::Int
: The number of partitions of the time series. Default is 20. A value of m ≈ length(x)/2 is recommended.
Notes
This function uses the linear regression method on the log-variance to estimate the long memory parameter.
Examples
julia> log_variance_est(randn(100,1); m = 40)
LongMemory.ClassicEstimators.log_variance_plot
— Methodlog_variance_plot(x::Array; m::Int=100, slope::Bool=false, slope2::Bool=false)
Produces the log-variance plot of a time series.
Arguments
x::Array
: The time series.
Output
d_var::Real
: The estimated long memory parameter computed as (beta+1)/2, where beta is the slope of the linear regression of the log of the variance plot.
Optional arguments
m::Int
: The number of partitions of the time series. Default is 20. A value of m ≈ length(x)/2 is recommended.slope::Bool
: If true, the slope of the linear regression is displayed.slope2::Bool
: If true, the theoretical slope for a short memory process is displayed.
Notes
This function uses the linear regression method on the log of the variance plot to estimate the long memory parameter.
Examples
julia> log_variance_plot(randn(100,1); m = 40)
LongMemory.ClassicEstimators.rescaled_range
— Methodrescaled_range(x::Array; k::Int = 20)
Computes the rescaled range (R/S) statistic of a time series.
Arguments
x::Array
: The time series.
Optional arguments
k::Int
: The number of partitions of the time series. Default is 20.
Output
RS::Array
: The rescaled range statistic.
Examples
julia> rescaled_range(randn(100))
LongMemory.ClassicEstimators.rescaled_range_est
— Methodrescaled_range_est(x::Array; k::Int = 20)
Estimates the long memory parameter of a time series using the rescaled range (R/S) statistic.
Arguments
x::Array
: The time series.
Output
d::Real
: The estimated long memory parameter.
Optional arguments
k::Int
: The number of partitions of the time series. Default is 20.
Notes
This function uses the linear regression method on the log of the rescaled range to estimate the long memory parameter. The Hurst coefficient is related to the long memory parameter d by the formula H = d + 1/2.
Examples
julia> rescaled_range_est(randn(100))
LongMemory.ClassicEstimators.rescaled_range_plot
— Methodrescaled_range_plot(x::Array; k::Int = 100, slope::Bool = false, slope2::Bool = false)
Produces the rescaled range plot of a time series.
Arguments
x::Array
: The time series.
Output
p1::Plots.Plot
: The rescaled range plot.
Optional arguments
k::Int
: The number of partitions of the time series. Default is 100.slope::Bool
: If true, the slope of the linear regression is displayed.slope2::Bool
: If true, the theoretical slope for a short memory process is displayed.
Notes
This function uses the linear regression method on the log of the rescaled range to estimate the long memory parameter. The Hurst coefficient is related to the long memory parameter d by the formula H = d + 1/2.
Examples
julia> rescaled_range_plot(randn(300,1))
LongMemory.ClassicEstimators.smean
— Methodsmean(x::Array)
Computes the sample mean of a time series.
Arguments
x::Array
: The time series.
Output
mean::Real
: The sample mean.
Examples
julia> smean(randn(100))
LongMemory.ClassicEstimators.sstd
— Methodsstd(x::Array; k::Int=0)
Computes the sample standard deviation of a time series.
Arguments
x::Array
: The time series.
Output
std::Real
: The sample standard deviation.
Optional arguments
k::Int
: The bias-correction term.
Notes
This function divides by T instead of T-1 if no bias-correction term is provided.
Examples
julia> sstd(randn(100))
LongMemory.ClassicEstimators.sstdk
— Methodsstdk(x::Array, m::Int)
Computes the sample standard deviation of a time series using the m-th order sample mean.
Arguments
x::Array
: The time series.m::Int
: The order of the sample mean.
Output
std::Real
: The sample standard deviation.
Examples
julia> sstdk(randn(100), 20)
Hurst, H.E. (1951). Long-term storage capacity of reservoirs. Transactions of the American Society of Civil Engineers, 116, 770-799.
Documentation for LongMemory.jl.