Reference Manual: multifractal.pdf
Keywords: MFDFA, MMAR, IAAFT, IAAWT, Surrogate Analysis
This is an improved package for multifractal detrended fluctuation analysis (MF-DFA), simulation of multifractal series (Multifractal Model of Asset Returns, MMAR), and surroagte analysis using Iterated Amplitude Adjusted Fourier Transform (IAAFT) and Iterated Amplitude Adjusted Wavelet Transform (IAAWT). It allows to enhance the robustness and reliability of classic MF-DFA via overlapping windows. It further enables to test the significance of multifractality via IAAFT surrogates. Simulations are based on Mandelbrot's multifractal model of asset returns (MMAR).
devtools::install_github("wol-fi/multifractal")
The below example illustrates a multifractal analysis of the S&P 500 stock market index (daily, 1992-2022). The example dataset is provided by the package.
library(multifractal)
## preparation:
# load the example dataset 'sp500' and calculate daily log-returns
p <- sp500
r <- diff(log(p$Adj.Close))
# estimate the statistics
mdl <- mfdfa(r, overlap=T)
## plot the output
plot(mdl)
Interpretation: upper-left: Fluctuation plot. The slopes of the lines represent the Hurst exponents (one line per moment q). If the lines are parallel then the series is monofractal (e.g., classic Brownian motion), otherwise multifractal. upper-right: Multifractal spectrum. The wider, the stronger the degree of multifractality and non-linear auto-correlation. Hölder exponents are abbreviated by \alpha. lower-left: generalized Hurst exponents. Would be approximately flat if monofractal. lower-right: Scaling function. Is linear if monofractal, otherwise convex.
stats <- print(mdl)
#>
#> Persistence:
#> 0.4634505 ... = anti-persistent, neg. auto-corr.
#>
#> Multifractal Strength:
#> diff. Hurst = 0.1146917
#> diff. Hölder = 0.2261127
diff(mdl)
#> diff Hurst diff Hölder
#> 0.1146917 0.2261127
sig <- significance(mdl, size=10, pval=0.1)
#> diff_Holder
#> original 0.2261127
#> 90% C.I. 0.2061173
#>
#> multifractality is significant
Ht <- localH(mdl)
plot(Ht, dates=p$Date[-1])
Interpretation:
Above 0.5 means that the S&P 500 currently has a positive auto-correlation, below 0.5 means that returns are anti-persistent.
An example of simulating multifractal returns and prices series.
B <- mfsim() # simulate the multifractal Brownian Motion
r <- diff(B) # take the increments as log-returns
r <- (r - mean(r))/sd(r) * 0.01 + 0 # transform returns into desired mean and standard deviation
p <- exp(cumsum(r)) # transform return into price
plot(p, type="l)
Chris Keylock's IAAWT was translated from Matlab
Finance: Schadner, W. (2021). On the persistence of market sentiment: A multifractal fluctuation analysis. Physica A, 581, 126242. link
Social Science: Schadner, W. (2022). U.S. Politics from a multifractal perspective. Chaos, Solitons & Fractals, 155, 111677. link
MF-DFA: Kantelhardt, J.W., et al. (2002). Multifractal detrended fluctuation analysis of nonstationary time series. Physica A, 316(1-4), p.87-114. link
IAAWT: Keylock, C.J. (2017). Multifractal surrogate-data generation algorithm that preserves pointwise Hölder regularity structure, with initial applications to turbulence. Physical Review E, 95, 032123. link
IAAFT: Schreiber, T. and Schmitz, A. (2000). Surrogate time series. Physica D, 142(3–4), p.346–382. link
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.