Title: | Identify Memory Patterns in Time Series Using Variance Scale Exponent |
---|---|
Description: | Methods for calculating the variance scale exponent to identify memory patterns in time series data. Includes tests for white noise, short memory, and long memory. See Fu, H. et al. (2018) <doi:10.1016/j.physa.2018.06.092>. |
Authors: | Mengyang Zheng [aut, cre], Hui Fu [aut] |
Maintainer: | Mengyang Zheng <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-11-21 04:49:38 UTC |
Source: | https://github.com/z-my-cn/vse4ts |
The function SLmemory.test computes the test statistic for long memory in time series based on the variance scale exponent. The null hypothesis is that the time series is white noise or short memory, while the alternative hypothesis is that the time series has long memory.
SLmemory.test(x, m = 0.5, n = NULL)
SLmemory.test(x, m = 0.5, n = NULL)
x |
A time series vector. |
m |
A parameter to control the number of scales. Default is 0.5. |
n |
The number of scales. If |
A list with class "SLmemory.test" containing the following components:
SLmemory |
the test statistic |
df |
the degrees of freedom of the test. |
p.value |
the p-value of the test. |
Fu, H., Chen, W., & He, X.-J. (2018). On a class of estimation and test for long memory. In Physica A: Statistical Mechanics and its Applications (Vol. 509, pp. 906–920). Elsevier BV. https://doi.org/10.1016/j.physa.2018.06.092
## Test long memory in time series library(pracma) set.seed(123) data("brown72") x72 <- brown72 # H = 0.72 xgn <- rnorm(1024) # H = 0.50 xlm <- numeric(1024); xlm[1] <- 0.1 # H = 0.43 for (i in 2:1024) xlm[i] <- 4 * xlm[i-1] * (1 - xlm[i-1]) SLmemory.test(x72) SLmemory.test(xgn) SLmemory.test(xlm)
## Test long memory in time series library(pracma) set.seed(123) data("brown72") x72 <- brown72 # H = 0.72 xgn <- rnorm(1024) # H = 0.50 xlm <- numeric(1024); xlm[1] <- 0.1 # H = 0.43 for (i in 2:1024) xlm[i] <- 4 * xlm[i-1] * (1 - xlm[i-1]) SLmemory.test(x72) SLmemory.test(xgn) SLmemory.test(xlm)
Calculate the variance scale exponent of a time series.
vse(x, m = 0.5, n = NULL, type = c("weak", "strong"))
vse(x, m = 0.5, n = NULL, type = c("weak", "strong"))
x |
A time series vector. |
m |
A parameter to control the number of scales. Default is 0.5. |
n |
The number of scales. If |
type |
The type of variance scale exponent. Default is "weak". |
The variance scale exponent.
Fu, H., Chen, W., & He, X.-J. (2018). On a class of estimation and test for long memory. In Physica A: Statistical Mechanics and its Applications (Vol. 509, pp. 906–920). Elsevier BV. https://doi.org/10.1016/j.physa.2018.06.092
## Compute the variance scale exponent of a time series # Generate a random time series set.seed(123) x <- rnorm(1024) # F = H = 0.5 also d = 0 vse(x) ## Compare the result with the Hurst exponent library(pracma) # A time series with Hurst exponent 0.72 data("brown72") x <- brown72 # F = H = 0.72 also d = 0.22 hurstexp(x) vse(x) # A time series with Hurst exponent 0.43 xlm <- numeric(1024); xlm[1] <- 0.1 for (i in 2:1024) xlm[i] <- 4 * xlm[i-1] * (1 - xlm[i-1]) x <- xlm # F = H = 0.43 also d = -0.07 hurstexp(x) vse(x)
## Compute the variance scale exponent of a time series # Generate a random time series set.seed(123) x <- rnorm(1024) # F = H = 0.5 also d = 0 vse(x) ## Compare the result with the Hurst exponent library(pracma) # A time series with Hurst exponent 0.72 data("brown72") x <- brown72 # F = H = 0.72 also d = 0.22 hurstexp(x) vse(x) # A time series with Hurst exponent 0.43 xlm <- numeric(1024); xlm[1] <- 0.1 for (i in 2:1024) xlm[i] <- 4 * xlm[i-1] * (1 - xlm[i-1]) x <- xlm # F = H = 0.43 also d = -0.07 hurstexp(x) vse(x)
The function Wnoise.test computes the test statistic for white noise in time series based on the variance scale exponent. The null hypothesis is that the time series is independent white noise, while the alternative hypothesis is that the time series is a non-independent stochastic process.
Wnoise.test(x, m = 0.5, n = NULL)
Wnoise.test(x, m = 0.5, n = NULL)
x |
A time series vector. |
m |
A parameter to control the number of scales. Default is 0.5. |
n |
The number of scales. If |
A list with class "Wnoise.test" containing the following components:
Wnoise |
the test statistic |
df |
the degrees of freedom of the test. |
p.value |
the p-value of the test. |
Fu, H., Chen, W., & He, X.-J. (2018). On a class of estimation and test for long memory. In Physica A: Statistical Mechanics and its Applications (Vol. 509, pp. 906–920). Elsevier BV. https://doi.org/10.1016/j.physa.2018.06.092
## Test white noise in time series library(pracma) set.seed(123) data("brown72") x72 <- brown72 # H = 0.72 xgn <- rnorm(1024) # H = 0.50 xlm <- numeric(1024); xlm[1] <- 0.1 # H = 0.43 for (i in 2:1024) xlm[i] <- 4 * xlm[i-1] * (1 - xlm[i-1]) Wnoise.test(x72) Wnoise.test(xgn) Wnoise.test(xlm)
## Test white noise in time series library(pracma) set.seed(123) data("brown72") x72 <- brown72 # H = 0.72 xgn <- rnorm(1024) # H = 0.50 xlm <- numeric(1024); xlm[1] <- 0.1 # H = 0.43 for (i in 2:1024) xlm[i] <- 4 * xlm[i-1] * (1 - xlm[i-1]) Wnoise.test(x72) Wnoise.test(xgn) Wnoise.test(xlm)