Description Usage Arguments Details Value Author(s) References Examples
A collection and description of functions to investigate the long
range dependence or long memory behavior of an univariate time
series process. Included are functions to simulate fractional
Gaussian noise and fractional ARMA processes, and functions to
estimate the Hurst exponent by several different methods.
The Functions and methods are:
Functions to simulate long memory time series processes:
fnmSim | Simulates fractional Brownian motion, |
- mvn | from the numerical approximation of the stochastic integral, |
- chol | from the Choleski's decomposition of the covariance matrix, |
- lev | using the method of Levinson, |
- circ | using the method of Wood and Chan, |
- wave | using the wavelet synthesis, |
fgnSim | Simulates fractional Gaussian noise, |
- beran | using the method of Beran, |
- durbin | using the method Durbin and Levinson, |
- paxson | using the method of Paxson, |
farimaSim | simulates FARIMA time series processes. |
Functions to estimate the Hurst exponent:
aggvarFit | Aggregated variance method, |
diffvarFit | Differenced aggregated variance method, |
absvalFit | aggregated absolute value (moment) method, |
higuchiFit | Higuchi's or fractal dimension method, |
pengFit | Peng's or variance of residuals method, |
rsFit | R/S Rescaled Range Statistic method, |
perFit | periodogram method, |
boxperFit | boxed (modified) periodogram method, |
hurstSlider | Interactive Display of Hurst Estimates. |
Function for the wavelet estimator:
waveletFit | wavelet estimator. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | fbmSim(n = 100, H = 0.7, method = c("mvn", "chol", "lev", "circ", "wave"),
waveJ = 7, doplot = TRUE, fgn = FALSE)
fgnSim(n = 1000, H = 0.7, method = c("beran", "durbin", "paxson"))
farimaSim(n = 1000, model = list(ar = c(0.5, -0.5), d = 0.3, ma = 0.1),
method = c("freq", "time"), ...)
aggvarFit(x, levels = 50, minnpts = 3, cut.off = 10^c(0.7, 2.5),
doplot = FALSE, trace = FALSE, title = NULL, description = NULL)
diffvarFit(x, levels = 50, minnpts = 3, cut.off = 10^c(0.7, 2.5),
doplot = FALSE, trace = FALSE, title = NULL, description = NULL)
absvalFit(x, levels = 50, minnpts = 3, cut.off = 10^c(0.7, 2.5), moment = 1,
doplot = FALSE, trace = FALSE, title = NULL, description = NULL)
higuchiFit(x, levels = 50, minnpts = 2, cut.off = 10^c(0.7, 2.5),
doplot = FALSE, trace = FALSE, title = NULL, description = NULL)
pengFit(x, levels = 50, minnpts = 3, cut.off = 10^c(0.7, 2.5),
method = c("mean", "median"),
doplot = FALSE, trace = FALSE, title = NULL, description = NULL)
rsFit(x, levels = 50, minnpts = 3, cut.off = 10^c(0.7, 2.5),
doplot = FALSE, trace = FALSE, title = NULL, description = NULL)
perFit(x, cut.off = 0.1, method = c("per", "cumper"),
doplot = FALSE, title = NULL, description = NULL)
boxperFit(x, nbox = 100, cut.off = 0.10,
doplot = FALSE, trace = FALSE, title = NULL, description = NULL)
hurstSlider(x = fgnSim())
waveletFit(x, length = NULL, order = 2, octave = c(2, 8),
doplot = FALSE, title = NULL, description = NULL)
## S4 method for signature 'fHURST'
show(object)
|
cut.off |
[*Fit] - |
description |
[*Fit] - |
doplot |
[*Fit] - |
fgn |
[fbmSim] - |
H |
[fgnSim] - |
length |
[waveletFit] - |
levels |
[*Fit] - |
method |
[fbmSim] - |
minnpts |
[*Fit] - |
model |
a list with model parameters |
moment |
[absvalHurst] - |
n |
[fgnSim][farimaSim] - |
nbox |
[boxperFit] - |
object |
an object of class |
octave |
[waveletFit] - |
order |
[waveletFit] - |
title |
a character string which allows for a project title. |
trace |
a logical value, by defaul FALSE. Should the estimation process be traced? |
waveJ |
[fbmSim] - |
x |
[*Fit] - |
... |
arguments to be passed. |
Functions to Simulate Long Memory Processes:
Fractional Gaussian Noise:
The function fgnSim
simulates a series of fractional
Gaussian noise, FGN. FGN provides a parsimonious model for
stationary increments of a self-similar process parameterised
by the Hurst exponent H and variance. Fractional Gaussian noise
with H < 0.5 demonstrates negatively autocorrelated or
anti-persistent behaviour, and FGN with H > 0.5 demonstrates
1/f , long memory or persistent behaviour, and the special
case. The case H = 0.5 corresponds to the classical Gaussian
white noise. One can select from three different
methods. The first generator named "beran"
uses
the fast Fourier transform to generate the series based on
SPLUS code written originally by J. Beran [1994]. The second
generator named "durbin"
produces a FGN series by
using the Durbin-Levinson coefficients. The algorithm was
reimplemented in pure S based on the C source code written by
V. Teverovsky [199x]. The third generator named
"paxson"
was proposed by V. Paxson [199x], this
approaximate method is a very fast and requires low storage.
However, the algorithm reveals some weakness in the method
which was discussed by D.A. Rolls [2001].
Fractional ARIMA Processes:
The function farimaSim
is a generator for fractional
ARIMA time series processes. A Gaussian FARIMA(0,d,0) series
can be created, where d is related to the the Hurst
exponent H through d=H-0.5. This is a particular
case of the more general Gaussian FARIMA(p,d,q) process which
follows the same asymptotic relations for their autocovariance
and the spectral density as do the Gaussian FARIMA(0,d,0)
processes. Two different generators are implement in S. The
first named "freq"
works in the frequence domain and
generates the series from the fast Fourier transform based on
SPLUS code written originally by J. Beran [1994]. The second
method creates the series in the time domain, therefore named
"time"
. The algorithm was reimplemented in pure S based
on the Fortran source code from the R's fracdiff
package
originally written by C. Fraley [1991]. Details for the algorithm
are given in J Haslett and A.E. Raftery [1989].
Functions to Estimate the Hurst Exponent:
These are 9 functions as described by M.S. Taqqu, V. Teverovsky,
and W. Willinger [1995] to estimate the self similarity parameter
and/or the intensity of long-range dependence in a time series.
Aggregated Variance Method:
The function aggvarFit
computes the Hurst exponent from
the variance of an aggregated FGN or FARIMA time series process.
The original time series is divided into blocks of size m
.
Then the sample variance within each block is computed. The slope
beta=2*H-2
from the least square fit of the logarithm of
the sample variances versus the logarithm of the block sizes
provides an estimate for the Hurst exponent H
.
Differenced Aggregated Variance Method:
To distinguish jumps and slowly decaying trends which are two
types of non-stationary, from long-range dependence, the function
diffvarFit
differences the sample variances of successive
blocks. The slope beta=2*H-2
from the least square fit of
the logarithm of the differenced sample variances versus the
logarithm of the block sizes provides an estimate for the Hurst
exponent H
.
Aggregated Absolute Value/Moment Method:
The function absvalFit
computes the Hurst exponent from
the moments moment=M
of absolute values of an aggregated
FGN or FARIMA time series process. The first moment M=1
coincides with the absolute value method, and the second moment
M=2
with the aggregated variance method. Again, the slope
beta=M*(H-1)
of the regression line of the logarithm of
the statistic versus the logarithm of the block sizes provides
an estimate for the Hurst exponent H
.
Higuchi or Fractal Dimension Method:
The function higuchiFit
implements a technique which is
very similar to the absolute value method. Instead of blocks a
sliding window is used to compute the aggregated series. The
function involves the calculation the calculation of the length
of a path and, in principle, finding its fractal Dimension D
.
The slope D=2-H
from the least square fit of the logarithm
of the expected path lengths versus the logarithm of the block
(window) sizes provides an estimate for the Hurst exponent H
.
Peng or Variance of Residuals Method:
The function pengFit
uses the method described by peng.
In Peng's variance of residuals method the series is also divided
into blocks of size m
. Within each block the cumulated
sums are computed up to t
and a least-squares line
a+b*t
is fitted to the cumulated sums. Then the sample
variance of the residuals is computed which is proportional to
m^(2*H)
. The "mean"
or "median"
are
computed over the blocks. The slope beta=2*H
from the
least square provides an estimate for the Hurst exponent H
.
The R/S Method:
The function rsFit
implements the algorithm named
rescaled range analysis which is dicussed for example
in detail by B. Mandelbrot and Wallis [199x], B. Mandelbrot [199x]
and B. Mandelbrot and M.S. Taqqu [199x].
The Periodogram Method:
The function perFit
estimates the Hurst exponent from the
periodogram. In the finite variance case, the periodogram is an
estimator of the spectral density of the time series. A series
with long range dependence will show a spectral density with a
lower law behavior in the frequency. Thus, we expect that a
log-log plot of the periodogram versus frequency will display
a straight line, and the slopw can be computed as 1-2H.
In practice one uses only the lowest 10% of the frequencies,
since the power law behavior holds only for frequencies close to
zero. Varying this cut off may provide additional information.
Plotting H versus the cut off, one should select that
cut off where the curve flattens out to estimate H
.
This approach can be selected by the argument method="per"
.
Alternatively we can select method="cumper"
. In this case,
instead of using the periodgram itself, the cmulative periodgram
will be investigated. The slope of the double logarithmic fit
is given by 2-2H. More details can be found in the work
of J. Geweke and S. Porter-Hudak [1983] and in Taqqu [?].
The Boxed or Modified Periodogram Method:
The function boxperFit
is a modification of the periodogram
method. The algorithm devides the frequency axis into logarithmically
equally spaced boxes and averages the periodogram values corresponding
to the frequencies inside the box.
The original functions were written by V. Teverovsky and W. Willinger
for SPLUS calling internal functions written in C. The software can
be found on M. Taqqu's home page:
http://math.bu.edu/people/murad/
In addition the Whittle estimator uses SPlus functions written
by J. Beran. They can be found in the appendix of his book or on
the StatLib server:
http://lib.stat.cmu.edu/S/
Note, all nine R functions and internal utility functions are
reimplemented entirely in S.
Functions to perform a Wavelet Analysis:
The function waveletFit
computes the Discrete Wavelet
Transform, averages the squares of the coefficients of the transform,
and then performs a linear regression on the logarithm of the
average, versus the log of the scale parameter of the transform.
The result should be directly proportional to H
providing
an estimate for the Hurst exponent.
fgnSim
and farimaSim
return a numeric vector of length
n
, the FGN or FARIMA series.
*Fit
returns an S4 object of class fHURST
with the
following slots:
@call |
the function call. |
@method |
a character string with the selected method string. |
@hurst |
a list with at least one element, the Hurst exponent named
|
@parameters |
a list with a varying number of elements describing the input parameters from the argument list. |
@data |
a list holding the input data. |
@fit |
a list object with all information of the fit. |
@plot |
a list object which holds information to create a plot of the fit. |
@title |
a character string with the name of the test. |
@description |
a character string with a brief description of the test. |
waveletFit
V. Paxson, code as listed in the Appendix of his paper 1995,
J. Beran, ported by Maechler, code as listed in the Appendix of his Book,
M.S. Taqqu et al. for the S-Plus and C code concerned with the Hurst exponent,
C. Fraley for the FARIMA simulation code,
Guy Nason for the functions from the R package 'wavethresh',
Diethelm Wuertz for the Rmetrics R-port.
Beran J. (1992); Statistics for Long-Memory Processes, Chapman and Hall, New York, 1994.
Haslett J., Raftery A.E. (1989); Space-Time Modelling with Long-Memory Dependence: Assessing Ireland's Wind Power Resource, Applied Statistics 38, pp. 1–50.
Paxson V. (1995); Fast Approximation of Self-Similar Network Traffic, Technical report, LBL-36750/UC-405, Berkeley, and Computer Communcation Review27, p.5–18, 1997.
Rolls D.A. (2001); Improved Fast Approximate Synthesis of Fractional Gaussian Noise, Thesis, Department of Mathematics and Statistics, Queen's University at Kingston, Kingston, Ontario, Canada, 5 pages.
Taqqu M., et al. Hurst Exponent, Several Preprints.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## fgnSim -
par(mfrow = c(3, 1), cex = 0.75)
# Beran's Method:
plot(fgnSim(n = 200, H = 0.75), type = "l",
ylim = c(-3, 3), xlab = "time", ylab = "x(t)", main = "Beran")
# Durbin's Method:
plot(fgnSim(n = 200, H = 0.75, method = "durbin"), type = "l",
ylim = c(-3, 3), xlab = "time", ylab = "x(t)", main = "Durbin")
# Paxson's Method:
plot(fgnSim(n = 200, H = 0.75, method = "paxson"), type = "l",
ylim = c(-3, 3), xlab = "time", ylab = "x(t)", main = "Paxson")
|
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Rmetrics Package fBasics
Analysing Markets and calculating Basic Statistics
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.