Package 'vse4ts'

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-10-02 06:41:22 UTC
Source: CRAN

Help Index


Testing Long Memory in Time Series

Description

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.

Usage

SLmemory.test(x, m = 0.5, n = NULL)

Arguments

x

A time series vector.

m

A parameter to control the number of scales. Default is 0.5.

n

The number of scales. If NULL, it will be calculated as floor(N^m).

Value

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.

References

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

Examples

## 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

Description

Calculate the variance scale exponent of a time series.

Usage

vse(x, m = 0.5, n = NULL, type = c("weak", "strong"))

Arguments

x

A time series vector.

m

A parameter to control the number of scales. Default is 0.5.

n

The number of scales. If NULL, it will be calculated as floor(N^m).

type

The type of variance scale exponent. Default is "weak".

Value

The variance scale exponent.

References

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

Examples

## 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)

Testing White Noise in Time Series

Description

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.

Usage

Wnoise.test(x, m = 0.5, n = NULL)

Arguments

x

A time series vector.

m

A parameter to control the number of scales. Default is 0.5.

n

The number of scales. If NULL, it will be calculated as floor(N^m).

Value

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.

References

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

Examples

## 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)