Structural Change Tests for Long Memory Processes
Functions to estimate structural changes in the long memory parameter of a time series.
LongMemory.StructuralChanges — Module
StructuralChanges
This module contains functions to estimate structural changes in models containing long memory errors.
Author
LongMemory.StructuralChanges.lm_change_stat — Method
lm_change_stat(y::AbstractArray, uplim::Real, lowlim::Real)Computes the location of the structural change, the test statistic, and the estimate of d used in lm_change_test. Internal function.
LongMemory.StructuralChanges.lm_change_test — Method
lm_change_test(y::AbstractArray; uplim::Real = 0.15, lowlim::Real = 0.15, flag::Bool = false, nsim::Int = 199)Estimates the location of a structural change in a long memory model.
Arguments
y::Array: The series to be tested.
Optional arguments
uplim::Real = 0.15: The upper limit of the fraction of the series to be tested.lowlim::Real = 0.15: The lower limit of the fraction of the series to be tested.flag::Bool = false: If true, the test statistic and a Monte Carlo p-value are also returned.nsim::Int = 199: The number of Monte Carlo replications used for the p-value whenflag = true.
Output
τ::Int: The estimated location of the structural change.stat::Real: The test statistic, the maximum of the forward and backward squared t-statistics. Only ifflag = true.pval::Real: The Monte Carlo p-value. Only ifflag = true.
Examples
julia> lm_change_test(randn(100))Notes
The function estimates the location of a structural change in a long memory model. The function uses the Whittle estimator to estimate the long memory parameter. Then, it fractionally differences the demeaned series and computes the t-statistics of the OLS regression of the differenced series on the starred series. The function computes the forward and backward t-statistics and returns the location of the maximum squared t-statistic. Hence, it is robust to the direction of the change.
The p-value is computed by parametric bootstrap: the statistic is recomputed, including the estimation of d, on nsim series simulated with fi_gen under the null of a constant long memory parameter equal to the estimate. Hence, it is random; fix the seed for reproducibility. In simulations with T = 300 and d = 0.3, the test rejected about 7% of the time at the nominal 5% level, so it is slightly liberal in small samples.
References
Martins and Rodrigues (2014), "Testing for persistence change in fractionally integrated models: An application to world inflation rates", Computational Statistics and Data Analysis, 76.
LongMemory.StructuralChanges.qu_test — Method
qu_test(x::AbstractArray; m::Real = 0.7, ε::Real = 0.05)Computes the test of Qu (2011) of the null hypothesis of a stationary long memory process against the alternative of spurious long memory, such as that generated by level shifts or smooth trends.
Arguments
x::Array: The time series.
Optional arguments
m::Real = 0.7: The bandwidth exponent; theround(T^m)lowest Fourier frequencies are used.ε::Real = 0.05: The trimming parameter, either 0.02 or 0.05.
Output
W::Real: The test statistic.crit::Array: The asymptotic critical values at the 10%, 5%, and 1% levels.
Notes
The statistic is W = sup_{r∈[ε,1]} |Σ_{j≤mr} ν_j (I_j λ_j^{2d}/G - 1)| / (Σ_j ν_j²)^{1/2}, with d and G the local Whittle estimates (see whittle_est) and ν_j = log λ_j - mean(log λ). It compares the local Whittle score at different bandwidths: under spurious long memory the periodogram does not follow the power law at the lowest frequencies. The null is rejected for large values of W.
References
Qu, Z. (2011). A test against spurious long memory. Journal of Business & Economic Statistics, 29(3), 423-438.
Examples
julia> qu_test(fi_gen(1000, 0.3))LongMemory.StructuralChanges.simple_ols — Method
simple_ols(y::AbstractArray, x::AbstractArray)Computes the t-statistics of the OLS regression of y on x.
Arguments
y::Array: The dependent variable.x::Array: The independent variable.
Output
tstat::Array: The t-statistic of the regression.
Notes
The function should only be used internally. It is not exported. It is used to compute the t-statistics of the OLS regression in the lm_change_test function. Hence, it does not adds intercepts to the regression nor it returns the coefficient.
LongMemory.StructuralChanges.starred_var — Method
starred_var(x::AbstractArray)Computes the padded series x with detrending coefficients.
Arguments
x::Array: The series to be detrended.
Output
dx::Array: The detrended series.
Documentation for LongMemory.jl.