Title: | Long Memory Time Series |
---|---|
Description: | Long Memory Time Series is a collection of functions for estimation, simulation and testing of long memory processes, spurious long memory processes and fractionally cointegrated systems. |
Authors: | Christian Leschinski [aut, cre], Michelle Voges [ctb], Kai Wenger [ctb] |
Maintainer: | Christian Leschinski <[email protected]> |
License: | GPL-2 |
Version: | 0.1.0 |
Built: | 2024-11-03 06:34:30 UTC |
Source: | CRAN |
Simulation of a AR-RLS process as discussed in and Xu and Perron (2014).
ARRLS.sim(T, phi, sig.shifts, prob, sig.noise = 0, const = 0, trend = 0, burnin = 100)
ARRLS.sim(T, phi, sig.shifts, prob, sig.noise = 0, const = 0, trend = 0, burnin = 100)
T |
length of the desired series. |
phi |
autoregressive parameter that determines the persistence of the shifts.
For |
sig.shifts |
standard deviation of the shifts. |
prob |
shift probability. For rare shifts p*/T, where p* is the expected number of shifts in the sample. |
sig.noise |
standard deviation of the noise component. Default is |
const |
mean of the process. Default is |
trend |
trend of the process. Default is |
burnin |
length of the burnin period used. Default is |
add details here
Christian Leschinski
Xu, J. and Perron, P. (2014): Forecasting return volatility: Level shifts with varying jump probability and mean reversion. International Journal of Forecasting, 30, pp. 449-463.
ts.plot(ARRLS.sim(T=500,phi=0.5, sig.shift=1, prob=0.05), ylab=expression(X[t]))
ts.plot(ARRLS.sim(T=500,phi=0.5, sig.shift=1, prob=0.05), ylab=expression(X[t]))
Calculates the cross periodogram of the vector valued time series X and Y.
cross.Peri(X, Y)
cross.Peri(X, Y)
X |
data matrix. |
Y |
data matrix. |
T<-500 d<-c(0.4, 0.2, 0.3) data<-FI.sim(T, q=3, rho=0, d=d) X<-data[,1:2] Y<-data[,3] cper<-cross.Peri(X, Y) pmax<-max(Re(cper),Im(cper)) pmin<-min(Re(cper),Im(cper)) plot(Re(cper[1,,]), type="h", ylim=c(pmin,pmax)) lines(Im(cper[1,,]), col=2) plot(Re(cper[2,,]), type="h", ylim=c(pmin,pmax)) lines(Im(cper[2,,]), col=2)
T<-500 d<-c(0.4, 0.2, 0.3) data<-FI.sim(T, q=3, rho=0, d=d) X<-data[,1:2] Y<-data[,3] cper<-cross.Peri(X, Y) pmax<-max(Re(cper),Im(cper)) pmin<-min(Re(cper),Im(cper)) plot(Re(cper[1,,]), type="h", ylim=c(pmin,pmax)) lines(Im(cper[1,,]), col=2) plot(Re(cper[2,,]), type="h", ylim=c(pmin,pmax)) lines(Im(cper[2,,]), col=2)
returns the first n
coefficients in the AR-infinity representation
of an FI(d) process
ddiffw(n, d)
ddiffw(n, d)
n |
number of coefficients to be returned |
d |
memory parameter |
ELW
implements the exact local Whittle estimator of
Shimotsu and Phillips (2005) that is consistent and asymptotically normal as long as
the optimization range is less than 9/2, so that it is possible to estimate the memory
of stationary as well as non-stationary processes.
ELW(data, m, mean.est = c("mean", "init", "weighted", "none"))
ELW(data, m, mean.est = c("mean", "init", "weighted", "none"))
data |
data vector of length T. |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation usually |
mean.est |
specifies the form of mean correction. One of |
Christian Leschinski
Shimotsu, K. and Phillips, P. C. B. (2005): Exact Local Whittle Estimation Of Fractional Integration. The Annals of Statistics, Vol. 33, No. 4, pp. 1890 - 1933
library(fracdiff) T<-1000 d<-0.8 series<-cumsum(fracdiff.sim(T,d=(d-1))$series) ts.plot(series) ELW(series, m=floor(1+T^0.7))$d
library(fracdiff) T<-1000 d<-0.8 series<-cumsum(fracdiff.sim(T,d=(d-1))$series) ts.plot(series) ELW(series, m=floor(1+T^0.7))$d
ELW2S
implements the two-step ELW estimator of
Shimotsu (2010) that is consistent and asymptotically normal in the range from -1/2 to 2.
ELW2S(data, m, trend_order = 0, taper = c("Velasco", "HC"))
ELW2S(data, m, trend_order = 0, taper = c("Velasco", "HC"))
data |
data vector of length T. |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation usually |
trend_order |
specifies the form of detrending: 0 for a constant, only, 1 for a linear trend, and so on. |
taper |
string from |
Christian Leschinski
Shimotsu, K. (2010): Exact Local Whittle Estimation Of Fractional Integration with Unknown Mean and Time Trend. Econometric Theory, Vol. 26, pp. 501 - 540.
library(fracdiff) T<-1000 d<-0.8 trend<-(1:T)/T series<-cumsum(fracdiff.sim(T,d=(d-1))$series) ts.plot(series) ELW2S(series, m=floor(1+T^0.7), trend_order=0)$d series2<-series+2*trend ELW2S(series2, m=floor(1+T^0.7), trend_order=1)$d series3<-series+2*trend+2*trend^2 ELW2S(series3, m=floor(1+T^0.7), trend_order=2)$d
library(fracdiff) T<-1000 d<-0.8 trend<-(1:T)/T series<-cumsum(fracdiff.sim(T,d=(d-1))$series) ts.plot(series) ELW2S(series, m=floor(1+T^0.7), trend_order=0)$d series2<-series+2*trend ELW2S(series2, m=floor(1+T^0.7), trend_order=1)$d series3<-series+2*trend+2*trend^2 ELW2S(series3, m=floor(1+T^0.7), trend_order=2)$d
Calculates the empirical cummulative spectral distribution function from the cross periodogram of the vector valued time series X and Y.
F.hat(X, Y, k, l)
F.hat(X, Y, k, l)
X |
data matrix. |
Y |
data matrix. |
k |
integer that determines the order number of the first Fourier frequency used. |
l |
integer that determines the order number of the last Fourier frequency used. |
T<-500 d<-c(0.4, 0.2, 0.3) data<-FI.sim(T, q=3, rho=0, d=d) X<-data[,1:2] Y<-data[,3] F.hat(X, Y, 1, floor(T/2))
T<-500 d<-c(0.4, 0.2, 0.3) data<-FI.sim(T, q=3, rho=0, d=d) X<-data[,1:2] Y<-data[,3] F.hat(X, Y, 1, floor(T/2))
fBM
simulates a fractional Brownian motion / bridge of type I or II.
fBM(n, d, type = c("I", "II"), bridge = FALSE)
fBM(n, d, type = c("I", "II"), bridge = FALSE)
n |
number of increments in the fractional Brownian motion. |
d |
memory parameter -0.5<d<0.5. Note that |
type |
either |
bridge |
either |
Kai Wenger
Marinucci, D., Robinson, P. M. (1999). Alternative forms of fractional Brownian motion. Journal of statistical planning and inference, 80(1-2), 111 - 122.
Davidson, J., Hashimzade, N. (2009). Type I and type II fractional Brownian motions: A reconsideration. Computational statistics & data analysis, 53(6), 2089-2106.
Bardet, J.-M. et al. (2003): Generators of long-range dependent processes: a survey. Theory and applications of long-range dependence, pp. 579 - 623, Birkhauser Boston.
n<-1000 d<-0.4 set.seed(1234) motionI<-fBM(n,d, type="I") set.seed(1234) motionII<-fBM(n,d, type="II") ts.plot(motionI, ylim=c(min(c(motionI,motionII)), max(motionI,motionII))) lines(motionII, col=2)
n<-1000 d<-0.4 set.seed(1234) motionI<-fBM(n,d, type="I") set.seed(1234) motionII<-fBM(n,d, type="II") ts.plot(motionI, ylim=c(min(c(motionI,motionII)), max(motionI,motionII))) lines(motionII, col=2)
FCI_CH03
Rank estimation in fractionally cointegrated systems by Chen, Hurvich (2003).
Returns estimated cointegrating rank.
FCI_CH03(X, diff_param = 1, m_peri, m)
FCI_CH03(X, diff_param = 1, m_peri, m)
X |
vector of length T. |
diff_param |
integer specifying the order of differentiation in order to ensure stationarity of data, where diff_param-1 are the number of differences.
Default is |
m_peri |
fixed positive integer for averaging the periodogram, where |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the estimation, usually |
Christian Leschinski
Chen, W. W. and Hurvich, C. M. (2003): Semiparametric estimation of multivariate fractional cointegration. Journal of the American Statistical Association, Vol. 98, No. 463, pp. 629 - 642.
T<-1000 series<-FI.sim(T=T, q=3, rho=0.4, d=c(0.1,0.2,0.4), B=rbind(c(1,0,-1),c(0,1,-1),c(0,0,1))) FCI_CH03(series,diff_param=1, m_peri=25, m=floor(1+T^0.65))
T<-1000 series<-FI.sim(T=T, q=3, rho=0.4, d=c(0.1,0.2,0.4), B=rbind(c(1,0,-1),c(0,1,-1),c(0,0,1))) FCI_CH03(series,diff_param=1, m_peri=25, m=floor(1+T^0.65))
FCI_CH06
Semiparametric residual-based test for fractional cointegration by Chen, Hurvich (2003).
Returns test statistic, critical value and testing decision. Null hypothesis: no fractional cointegration.
FCI_CH06(X, m_peri, m, alpha = 0.05, diff_param = 1)
FCI_CH06(X, m_peri, m, alpha = 0.05, diff_param = 1)
X |
data matrix. |
m_peri |
fixed positive integer for averaging the periodogram, where |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the estimation, usually |
alpha |
desired significance level. Default is |
diff_param |
integer specifying the order of differentiation in order to ensure stationarity of data, where diff_param-1 are the number of differences.
Default is |
Christian Leschinski
Chen, W. W. and Hurvich, C. M. (2006): Semiparametric estimation of fractional cointegrating subspaces. The Annals of Statistics, Vol. 34, No. 6, pp. 2939 - 2979.
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) FCI_CH06(series, diff_param=1, m_peri=25, m=floor(T^0.65)) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.4,0.4)) FCI_CH06(series, diff_param=1, m_peri=25, m=floor(T^0.65))
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) FCI_CH06(series, diff_param=1, m_peri=25, m=floor(T^0.65)) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.4,0.4)) FCI_CH06(series, diff_param=1, m_peri=25, m=floor(T^0.65))
FCI_MV04
Semiparametric test for fractional cointegration by Marmol, Velasco (2004).
Returns test statistic, critical value and testing decision. Null hypothesis: no fractional cointegration.
FCI_MV04(X, type = c("none", "const", "trend"), N, m, alpha = 0.05)
FCI_MV04(X, type = c("none", "const", "trend"), N, m, alpha = 0.05)
X |
data matrix. |
type |
string that is either |
N |
bandwidth parameter specifying the number of Fourier frequencies
used for the beta estimation, usually |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the memory parameter estimation, usually |
alpha |
desired significance level. Default is |
Christian Leschinski, Michelle Voges
Marmol, F. and Velasco, C. (2004): Consistent testing of cointegrating relationships. Econometrica, Vol. 72, No. 6, pp. 1809 - 1844.
T<-500 series<-FI.sim(T=T, q=2, rho=0.1, d=c(0.6,1), B=rbind(c(1,-1),c(0,1))) FCI_MV04(series, type="const", N=floor(T^(0.75)), m=floor(T^(2/3))) series<-FI.sim(T=T, q=2, rho=0.1, d=c(0.8,0.8)) FCI_MV04(series, type="const", N=floor(T^(0.75)), m=floor(T^(2/3)))
T<-500 series<-FI.sim(T=T, q=2, rho=0.1, d=c(0.6,1), B=rbind(c(1,-1),c(0,1))) FCI_MV04(series, type="const", N=floor(T^(0.75)), m=floor(T^(2/3))) series<-FI.sim(T=T, q=2, rho=0.1, d=c(0.8,0.8)) FCI_MV04(series, type="const", N=floor(T^(0.75)), m=floor(T^(2/3)))
FCI_CH06
Nonparametric test and rank estimation for fractional cointegration by Nielson (2010).
Returns either test statistic, critical value and testing decision (null hypothesis: no fractional cointegration) or the estimated cointegrating rank.
FCI_N10(X, d1 = 0.1, m, mean_correct = c("mean", "init", "weighted", "none"), type = c("test", "rank"), alpha = 0.05)
FCI_N10(X, d1 = 0.1, m, mean_correct = c("mean", "init", "weighted", "none"), type = c("test", "rank"), alpha = 0.05)
X |
data matrix. |
d1 |
fixed order of integration, default is |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the memory estimation required for the asymptotic distribution, usually |
mean_correct |
specifies the form of mean correction in the memory estimation. |
type |
string that determines whether the test or the rank estimation procedure is applied. |
alpha |
desired significance level. Default is |
Christian Leschinski, Michelle Voges
Nielsen, M. O. (2010): Nonparametric cointegration analysis of fractional systems with unknown integration orders. Journal of Econometrics, Vol. 155, No. 2, pp. 170 - 187.
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.9), B=rbind(c(1,-1),c(0,1))) FCI_N10(series, m=floor(T^0.75), type="test") series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.9,0.9)) FCI_N10(series, m=floor(T^0.75), type="test") series<-FI.sim(T=T, q=3, rho=0.4, d=c(0.2,0.2,1), B=rbind(c(1,-0.5,-0.3),c(0,1,-0.4),c(0,0,1))) FCI_N10(series,m=floor(T^0.75),type="rank")
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.9), B=rbind(c(1,-1),c(0,1))) FCI_N10(series, m=floor(T^0.75), type="test") series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.9,0.9)) FCI_N10(series, m=floor(T^0.75), type="test") series<-FI.sim(T=T, q=3, rho=0.4, d=c(0.2,0.2,1), B=rbind(c(1,-0.5,-0.3),c(0,1,-0.4),c(0,0,1))) FCI_N10(series,m=floor(T^0.75),type="rank")
FCI_NS07
Rank estimation in fractionally cointegrated systems by Nielsen, Shimotsu (2007).
Returns estimated cointegrating rank, r=0,...,dim-1.
FCI_NS07(X, m, m1, mean_correct = c("mean", "init", "weighted", "none"), v_n = m^(-0.3))
FCI_NS07(X, m, m1, mean_correct = c("mean", "init", "weighted", "none"), v_n = m^(-0.3))
X |
data matrix. |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the estimation of G, usually |
m1 |
bandwith parameter specifying the number of Fourier frequencies
used for the memory estimation , usually |
mean_correct |
specifies the form of mean correction in the memory estimation. |
v_n |
bandwidth parameter. Nielsen and Shimotsu (2007) use m^(-0.3) in their simulation studies, which is the default value. m^(-b) mit 0<b<0.5 can be used. |
Christian Leschinski, Michelle Voges
Nielsen, M. 0. and Shimotsu, K. (2007): Determining the cointegrating rank in nonstationary fractional systems by the exact local Whittle approach. Journal of Econometrics, Vol. 141, No. 2, pp. 574 - 596.
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) FCI_NS07(series, m1=floor(1+T^0.75), m=floor(1+T^0.65)) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.9,0.9)) FCI_NS07(series, m1=floor(1+T^0.75), m=floor(1+T^0.65))
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) FCI_NS07(series, m1=floor(1+T^0.75), m=floor(1+T^0.65)) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.9,0.9)) FCI_NS07(series, m1=floor(1+T^0.75), m=floor(1+T^0.65))
FCI_R08
Semiparametric Hausmann-type test for fractional cointegration by Robinson (2008).
Returns test statistic, critical value, testing decision and type. Null hypothesis: no fractional cointegration.
FCI_R08(X, m, type = c("", "*", "**"), alpha = 0.05, a.vec = NULL)
FCI_R08(X, m, type = c("", "*", "**"), alpha = 0.05, a.vec = NULL)
X |
data matrix. |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the estimation, usually |
type |
determines the implementation of the test statistic: |
alpha |
desired significance level. Default is |
a.vec |
weighting scheme for averaging univariate memory estimates, default is simple arithmetic mean. |
Christian Leschinski, Michelle Voges
Robinson, P. (2008): Diagnostic testing for cointegration. Journal of Econometrics, Vol. 143, No. 1, pp. 206 - 225.
T<-1000 series<-FI.sim(T=T, q=2, rho=0.9, d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) FCI_R08(series, m=floor(T^0.75), type="*") series<-FI.sim(T=T, q=2, rho=0.9, d=c(0.4,0.4)) FCI_R08(series, m=floor(T^0.75), type="*")
T<-1000 series<-FI.sim(T=T, q=2, rho=0.9, d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) FCI_R08(series, m=floor(T^0.75), type="*") series<-FI.sim(T=T, q=2, rho=0.9, d=c(0.4,0.4)) FCI_R08(series, m=floor(T^0.75), type="*")
FCI_CH06
Semiparametric frequency-domain test for fractional cointegration by Souza, Reise, Franco, Bondon (2018).
Returns test statistic, critical value, testing decision and estimate of the cointegrating strength. Null hypothesis: no fractional cointegration.
FCI_SRFB18(X, d, m, r, alpha = 0.05)
FCI_SRFB18(X, d, m, r, alpha = 0.05)
X |
bivariate data matrix. |
d |
known common memory parameter. However, simulations indicate that consistent memory estimation does not invalidate the test. |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the estimation, usually |
r |
integer trimming parameter, |
alpha |
desired significance level. Default is |
Michelle Voges
Souza, I. V. M., Reisen, V. A., Franco, G. d. C. and Bondon, P. (2018): The estimation and testing of the cointegration order based on the frequency domain. Journal of Business & Economic Statistics, Vol. 36, No. 4, pp. 695 - 704.
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.7), B=rbind(c(1,-1),c(0,1))) FCI_SRFB18(series, d=0.7, m=floor(T^0.75), r=1) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.4,0.4)) FCI_SRFB18(series, d=0.4, m=floor(T^0.75), r=1)
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.7), B=rbind(c(1,-1),c(0,1))) FCI_SRFB18(series, d=0.7, m=floor(T^0.75), r=1) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.4,0.4)) FCI_SRFB18(series, d=0.4, m=floor(T^0.75), r=1)
FCI_WWC15
Semiparametric implementation of the testing strategy for fractional cointegration by Wang, Wang, Chan (2015).
Returns test statistic, critical value and testing decision. Null hypothesis: no fractional cointegration.
FCI_WWC15(X, m, mean_correct = c("init", "mean", "weighted", "none"), alpha = 0.05)
FCI_WWC15(X, m, mean_correct = c("init", "mean", "weighted", "none"), alpha = 0.05)
X |
bivariate data matrix. |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the estimation, usually |
mean_correct |
specifies the form of mean correction in the memory estimation. |
alpha |
desired significance level. Default is |
Christian Leschinski, Michelle Voges
Wang, B., Wang, M. and Chan, N. H. (2015): Residual-based test for fractional cointegration. Economics Letters, Vol. 126, pp. 43 - 46.
Hualde, J. (2013): A simple test for the equality of integration orders. Economics Letters, Vol. 119, No. 3, pp. 233 - 237.
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.8), B=rbind(c(1,1),c(0,1))) FCI_WWC15(series, m=floor(1+T^0.65)) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.8,0.8)) FCI_WWC15(series, m=floor(1+T^0.65))
T<-1000 series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.1,0.8), B=rbind(c(1,1),c(0,1))) FCI_WWC15(series, m=floor(1+T^0.65)) series<-FI.sim(T=T, q=2, rho=0.4, d=c(0.8,0.8)) FCI_WWC15(series, m=floor(1+T^0.65))
FCI_CH06
SRank estimation in fractionally cointegrated systems (Zhang, Robinson, Yao (2018)).
Returns estimated cointegrating rank, r=0,...,dim-1.
FCI_ZRY18(X, lag_max, lag_max2 = 20, c0 = 0.3)
FCI_ZRY18(X, lag_max, lag_max2 = 20, c0 = 0.3)
X |
data matrix. |
lag_max |
number of lags in autocovariance matrix of data for eigenvector estimation. |
lag_max2 |
number of residual autocorrelations that are averaged, default is |
c0 |
threshold to compare averaged residual autocorrelation to, default is |
Michelle Voges
Zhang, R., Robinson, P. and Yao, Q. (2018): Identifying cointegration by eigenanalysis. Journal of the American Statistical Association (forthcoming).
T<-1000 series<-FI.sim(T=T, q=3, rho=0.4, d=c(0.2,0.2,1), B=rbind(c(1,0,-1),c(0,1,-1),c(0,0,1))) FCI_ZRY18(series, lag_max=5, lag_max2=20, c0=0.3) series<-FI.sim(T=T, q=3, rho=0.4, d=c(1,1,1)) FCI_ZRY18(series, lag_max=5, lag_max2=20, c0=0.3)
T<-1000 series<-FI.sim(T=T, q=3, rho=0.4, d=c(0.2,0.2,1), B=rbind(c(1,0,-1),c(0,1,-1),c(0,0,1))) FCI_ZRY18(series, lag_max=5, lag_max2=20, c0=0.3) series<-FI.sim(T=T, q=3, rho=0.4, d=c(1,1,1)) FCI_ZRY18(series, lag_max=5, lag_max2=20, c0=0.3)
Takes the d-th difference of the series.
fdiff(x, d)
fdiff(x, d)
x |
series to be differenced |
d |
memory parameter indicating order of the fractional difference. |
This code was first published on the university webpage of Morten Nielsen and is redistributed here with the author's permission.
Jensen, A. N. and Nielsen, M. O.
Jensen, A. N. and Nielsen, M. O. (2014): A fast fractional difference algorithm, Journal of Time Series Analysis 35(5), pp. 428-436.
acf(fdiff(x=rnorm(500), d=0.4))
acf(fdiff(x=rnorm(500), d=0.4))
Semiparametric estimator for the cointegrating vector as suggested by Robinson (1994) and discussed by Robinson and Marinucci (2003) and Christensen and Nielsen (2006), among others.
FDLS(X, Y, m)
FDLS(X, Y, m)
X |
data matrix. |
Y |
data matrix. |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation of d, usually |
add details here. Assumes that there is no long-run coherence between the errors and the regressors. Consistency and Normality, Stationarity, assumptions,...
Christensen, B. J. and Nielsen, M. O. (2006): Asymptotic normality of narrow-band least squares in the stationary fractional cointegration model and volatility forecasting. Journal of Econometrics, 133, pp. 343-371.
Robinson, P. M., (1994): Semiparametric analysis of long-memory time series. Annals of Statistics, 22, pp. 515-539.
Robinson, P. M. and Marinucci, D. (2003): Semiparametric frequency domain analysis of fractional cointegration. In: Robinson, P. M. (Ed.), Time Series with Long Memory, Oxford University Press, Oxford, pp. 334-373.
T<-500 d<-0.4 beta<-1 data<-FI.sim(T, q=2, rho=0, d=c(d,0)) xt<-data[,1] et<-data[,2] yt<-beta*xt+et FDLS(xt,yt,m=floor(1+T^0.4)) data<-FI.sim(T, q=2, rho=0.8, d=c(d,0)) xt<-data[,1] et<-data[,2] yt<-beta*xt+et FDLS(xt,yt,m=floor(1+T^0.4))
T<-500 d<-0.4 beta<-1 data<-FI.sim(T, q=2, rho=0, d=c(d,0)) xt<-data[,1] et<-data[,2] yt<-beta*xt+et FDLS(xt,yt,m=floor(1+T^0.4)) data<-FI.sim(T, q=2, rho=0.8, d=c(d,0)) xt<-data[,1] et<-data[,2] yt<-beta*xt+et FDLS(xt,yt,m=floor(1+T^0.4))
FI.sim
Simulates a
FI.sim(T, q, rho, d, B = diag(q), var = 1, burnin = 250)
FI.sim(T, q, rho, d, B = diag(q), var = 1, burnin = 250)
T |
positive integer determining the length of the simulated series. |
q |
positive integer determining the dimension of the simulated series. |
rho |
real value between 0 and 1 that determines correlation between the innovations. |
d |
vector of memory parameters with length q. |
B |
qxq matrix specifying cointegrating relations. By default |
var |
positive real value that determines the variance of the innovations.
Default value is |
burnin |
positive integer determining the length of the burnin period.
Default is |
T=1000 series<-FI.sim(T=T,q=2,rho=0.7,d=c(0.4,0.4)) ts.plot(series, col=1:2) cor(series) series<-FI.sim(T=T,q=2,rho=0,d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) ts.plot(series, col=1:2)
T=1000 series<-FI.sim(T=T,q=2,rho=0.7,d=c(0.4,0.4)) ts.plot(series, col=1:2) cor(series) series<-FI.sim(T=T,q=2,rho=0,d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) ts.plot(series, col=1:2)
Semiparametric estimator for the cointegrating vector as suggested
by Nielsen and Frederiksen (2011). Refines the FDLS
estimator by allowing for long run coherence between the regressors
and the errors.
FMNBLS(X, Y, m0, m1, m2, m3, method = c("local.W", "Hou.Perron", "ELW"))
FMNBLS(X, Y, m0, m1, m2, m3, method = c("local.W", "Hou.Perron", "ELW"))
X |
data matrix. |
Y |
data matrix. |
m0 |
bandwidth parameter. |
m1 |
bandwidth parameter. |
m2 |
bandwidth parameter. |
m3 |
bandwidth parameter. |
method |
one from |
add details here. Especially on the selection of all these bandwidth parameters. carefull: it is not clear, whether HP an be used here.
Nielsen and Frederiksen (2011): Fully modified narrow-band least squares estimation of weak fractional cointegration. The Econometrics Journal, 14, pp. 77-120.
FDLS
, local.W
, Hou.Perron
, ELW
T<-500 d<-0.4 beta<-1 m0<-m3<-floor(T^0.4) m1<-floor(T^0.6) m2<-floor(T^0.8) data<-FI.sim(T, q=2, rho=0.8, d=c(d,0)) xt<-data[,1] et<-data[,2] yt<-beta*xt+et FDLS(xt,yt,m=m0) FMNBLS(xt,yt,m0=m0, m1=m1, m2=m2, m3=m3)
T<-500 d<-0.4 beta<-1 m0<-m3<-floor(T^0.4) m1<-floor(T^0.6) m2<-floor(T^0.8) data<-FI.sim(T, q=2, rho=0.8, d=c(d,0)) xt<-data[,1] et<-data[,2] yt<-beta*xt+et FDLS(xt,yt,m=m0) FMNBLS(xt,yt,m0=m0, m1=m1, m2=m2, m3=m3)
G.hat
Estimates the matrix G of a multivariate long memory process
based on an estimate of the vector of memory parameters. The assumed spectral
density is that of Shimotsu (2007).
G.hat(X, d, m)
G.hat(X, d, m)
X |
data matrix with T observations of q-dimensional process. |
d |
q-dimensional data vector. |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation usually |
Shimotsu, K. (2007): Gaussian semiparametric estimation of multivariate fractionally integrated processes. Journal of Econometrics, Vol. 137, No. 2, pp. 277 - 310.
T<-500 d1<-0.4 d2<-0.2 data<-FI.sim(T, q=2, rho=0, d=c(d1,d2)) G.hat(X=data, d=c(d1,d2), m=floor(1+T^0.6)) #diagonal elements should equal 1/(2*pi)
T<-500 d1<-0.4 d2<-0.2 data<-FI.sim(T, q=2, rho=0, d=c(d1,d2)) G.hat(X=data, d=c(d1,d2), m=floor(1+T^0.6)) #diagonal elements should equal 1/(2*pi)
gph
log-periodogram estimator of Geweke and Porter-Hudak (1983) (GPH) and Robinson (1995a) for memory parameter d.
gph(X, m, l = 1)
gph(X, m, l = 1)
X |
vector of length T. |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation usually |
l |
trimming parameter that determines with which Fourier frequency to start.
Default value is |
add details here.
Robinson, P. M. (1995): Log-periodogram regression of time series with long range dependence. The Annals of Statistics, Vol. 23, No. 5, pp. 1048 - 1072.
Geweke, J. and Porter-Hudak, S. (1983): The estimation and application of long memory time series models. Journal of Time Series Analysis, 4, 221-238.
library(fracdiff) T<-500 m<-floor(1+T^0.8) d=0.4 series<-fracdiff.sim(n=T, d=d)$series gph(X=series,m=m)
library(fracdiff) T<-500 m<-floor(1+T^0.8) d=0.4 series<-fracdiff.sim(n=T, d=d)$series gph(X=series,m=m)
GSE
Estimates the memory parameter of a vector valued long memory process.
GSE(X, m = m, l = 1)
GSE(X, m = m, l = 1)
X |
data matrix with T observations of q-dimensional process. |
m |
bandwith parameter specifying the number of Fourier frequencies used for the estimation. Usually |
l |
integer that specifies the number of Fourier frequencies (l-1) that are trimmed. |
Shimotsu, K. (2007): Gaussian semiparametric estimation of multivariate fractionally integrated processes. Journal of Econometrics, Vol. 137, No. 2, pp. 277 - 310.
T<-500 d1<-0.4 d2<-0.2 data<-FI.sim(T, q=2, rho=0.5, d=c(d1,d2)) ts.plot(data, col=1:2) GSE(data, m=floor(1+T^0.7))
T<-500 d1<-0.4 d2<-0.2 data<-FI.sim(T, q=2, rho=0.5, d=c(d1,d2)) ts.plot(data, col=1:2) GSE(data, m=floor(1+T^0.7))
GSE_coint
is an extended version of GSE
that allows the joint
estimation of the memory parameters and the cointegration vector for a vector valued process.
GSE_coint(X, m = m, elements, l = 1)
GSE_coint(X, m = m, elements, l = 1)
X |
data matrix with T observations of q-dimensional process. |
m |
bandwith parameter specifying the number of Fourier frequencies used for the estimation. Usually |
elements |
vector specifying which elements of the observation vector are cointegrated. |
l |
integer that specifies the number of Fourier frequencies (l-1) that are trimmed. |
# # Cointegration: # T<-500 m<-floor(T^0.75) series<-FI.sim(T=T,q=2,rho=0,d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) ts.plot(series, col=1:2) GSE_coint(X=series,m=m, elements=c(1,2))
# # Cointegration: # T<-500 m<-floor(T^0.75) series<-FI.sim(T=T,q=2,rho=0,d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) ts.plot(series, col=1:2) GSE_coint(X=series,m=m, elements=c(1,2))
Hou.Perron
Modified semiparametric local Whittle estimator of Hou and Perron (2014).
Estimates memory parameter robust to low frequency contaminations.
Hou.Perron(data, m)
Hou.Perron(data, m)
data |
data vector of length T. |
m |
bandwith parameter specifying the number of Fourier frequencies
used for the estimation usually |
add details here
Christian Hendrik Leschinski
Hou, J., Perron, P. (2014): Modified local Whittle estimator for long memory processes in the presence of low frequency (and other) contaminations. Journal of Econometrics, Vol. 182, No. 2, pp. 309 - 328.
library(fracdiff) T<-1000 d<-0 mean<-c(rep(0,T/2),rep(2,T/2)) FI<-fracdiff.sim(n=T, d=d)$series series<-mean+FI ts.plot(series) lines(mean, col=2) local.W(series, m=floor(1+T^0.65)) Hou.Perron(series, m=floor(1+T^0.65))
library(fracdiff) T<-1000 d<-0 mean<-c(rep(0,T/2),rep(2,T/2)) FI<-fracdiff.sim(n=T, d=d)$series series<-mean+FI ts.plot(series) lines(mean, col=2) local.W(series, m=floor(1+T^0.65)) Hou.Perron(series, m=floor(1+T^0.65))
ll.VARFIMA
returns the value of the log-likelihood function for a given sample and parameter vector.
ll.VARFIMA(theta, data, q, approx = 100, pre.sample = matrix(0, approx, q), rep = FALSE)
ll.VARFIMA(theta, data, q, approx = 100, pre.sample = matrix(0, approx, q), rep = FALSE)
theta |
parameter vector. |
data |
data matrix with T observations of q-dimensional process. |
q |
dimension of the process. |
approx |
order of the AR-approximation that is supposed to be used. Default is |
pre.sample |
if likelihood is conditioned on previous observations pre.sample is an additional sample matrix. |
rep |
determines whether the parameter vector is printed. |
Lutkepohl, H. (2007): New introduction to multiple time series analysis. Springer.
local.W
Semiparametric local Whittle estimator for memory parameter d following Robinson (1995).
Returns estimate and asymptotic standard error.
local.W(data, m, int = c(-0.5, 2.5), taper = c("none", "Velasco", "HC"), diff_param = 1, l = 1)
local.W(data, m, int = c(-0.5, 2.5), taper = c("none", "Velasco", "HC"), diff_param = 1, l = 1)
data |
vector of length T. |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation usually |
int |
admissible range for d. Restricts the interval of the numerical optimization. |
taper |
string that is either |
diff_param |
integer specifying the order of differentiation for the estimator of Hurvich and Chen (2000). Default is |
l |
integer that determines how many frequencies (l-1) are trimmed out if taper="none" is selected. Default is l=1. |
Robinson, P. M. (1995): Gaussian Semiparametric Estimation of Long Range Dependence. The Annals of Statistics, Vol. 23, No. 5, pp. 1630 - 1661.
Velasco, C. (1999): Gaussian Semiparametric Estimation for Non-Stationary Time Series. Journal of Time Series Analysis, Vol. 20, No. 1, pp. 87-126.
Hurvich, C. M., and Chen, W. W. (2000): An Efficient Taper for Potentially Overdifferenced Long-Memory Time Series. Journal of Time Series Analysis, Vol. 21, No. 2, pp. 155-180.
library(fracdiff) T<-1000 d<-0.4 series<-fracdiff.sim(n=T, d=d)$series local.W(series,m=floor(1+T^0.65))
library(fracdiff) T<-1000 d<-0.4 series<-fracdiff.sim(n=T, d=d)$series local.W(series,m=floor(1+T^0.65))
The LongMemoryTS package is a collection of functions for estimation, simulation and testing of long memory processes, spurious long memory processes, and fractionally cointegrated systems.
Christian Hendrik Leschinski <[email protected]>, Michelle Voges, Kai Wenger
Bai, J. and Perron, P. (1998): Estimating and Testing Linear Models With Multiple Structural Changes. Econometrica, Vol. 66, No. 1, pp. 47 - 78.
Bai, J. and Perron, P. (2003): Computation and Analysis of Multiple Structural Change Models. Journal of Applied Econometrics, Vol. 18, pp. 1-22.
Bardet, J.-M. et al. (2003): Generators of long-range dependent processes: a survey. Theory and applications of long-range dependence, pp. 579 - 623, Birkhauser Boston.
Chen, W. W. and Hurvich, C. M. (2003): Semiparametric estimation of multivariate fractional cointegration. Journal of the American Statistical Association, Vol. 98, No. 463, pp. 629 - 642.
Chen, W. W. and Hurvich, C. M. (2006): Semiparametric estimation of fractional cointegrating subspaces. The Annals of Statistics, Vol. 34, No. 6, pp. 2939 - 2979.
Christensen, B. J. and Nielsen, M. O. (2006): Asymptotic normality of narrow-band least squares in the stationary fractional cointegration model and volatility forecasting. Journal of Econometrics, 133, pp. 343-371.
Davidson, J., Hashimzade, N. (2009). Type I and type II fractional Brownian motions: A reconsideration. Computational Statistics & Data Analysis, No. 53, Vol. 6, pp. 2089 - 2106.
Frederiksen, P., Nielsen, F. S., and Nielsen, M. O. (2012): Local polynomial Whittle estimation of perturbed fractional processes. Journal of Econometrics, Vol. 167, No.2, pp. 426-447.
Geweke, J. and Porter-Hudak, S. (1983): The estimation and application of long memory time series models. Journal of Time Series Analysis, 4, 221-238.
Hou, J., Perron, P. (2014): Modified local Whittle estimator for long memory processes in the presence of low frequency (and other) contaminations. Journal of Econometrics, Vol. 182, No. 2, pp. 309 - 328.
Hualde, J. (2013): A simple test for the equality of integration orders. Economics Letters, Vol. 119, No. 3, pp. 233 - 237.
Hurvich, C. M., and Chen, W. W. (2000): An Efficient Taper for Potentially Overdifferenced Long-Memory Time Series. Journal of Time Series Analysis, Vol. 21, No. 2, pp. 155-180.
Jensen, A. N. and Nielsen, M. O. (2014): A fast fractional difference algorithm. Journal of Time Series Analysis 35(5), pp. 428-436.
Lavielle, M. and Moulines, E. (2000): Least Squares Estimation of an Unknown Number of Shifts in a Time Series. Journal of Time Series Analysis, Vol. 21, No. 1, pp. 33 - 59.
Lutkepohl, H. (2007): New introduction to multiple time series analysis. Springer.
Marinucci, D., Robinson, P. M. (1999). Alternative forms of fractional Brownian motion. Journal of Statistical Planning and Inference, Vol. 80 No. 1-2, pp. 111 - 122.
Marmol, F. and Velasco, C. (2004): Consistent testing of cointegrating relationships. Econometrica, Vol. 72, No. 6, pp. 1809 - 1844.
McCloskey, A. and Perron, P. (2013): Memory parameter estimation in the presence of level shifts and deterministic trends. Econometric Theory, 29, pp. 1196-1237.
Nielsen, M. O. (2010): Nonparametric cointegration analysis of fractional systems with unknown integration orders. Journal of Econometrics, Vol. 155, No. 2, pp. 170 - 187.
Nielsen, M. O. and Frederiksen (2011): Fully modified narrow-band least squares estimation of weak fractional cointegration. The Econometrics Journal, 14, pp. 77-120.
Nielsen, M. O. and Shimotsu, K. (2007): Determining the coinegrating rank in nonstationary fractional systems by the exact local Whittle approach. Journal of Econometrics, 141, pp. 574-59.
Qu, Z. (2011): A Test Against Spurious Long Memory. Journal of Business and Economic Statistics, Vol. 29, No. 3, pp. 423 - 438.
Robinson, P. M., (1994): Semiparametric analysis of long-memory time series. Annals of Statistics, 22, pp. 515-539.
Robinson, P. M. (1995): Log-periodogram regression of time series with long range dependence. The Annals of Statistics, Vol. 23, No. 5, pp. 1048 - 1072.
Robinson, P. M. (1995): Gaussian Semiparametric Estimation of Long Range Dependence. The Annals of Statistics, Vol. 23, No. 5, pp. 1630 - 1661.
Robinson, P. (2008): Diagnostic testing for cointegration. Journal of Econometrics, Vol. 143, No. 1, pp. 206 - 225.
Robinson, P. M. and Marinucci, D. (2003): Semiparametric frequency domain analysis of fractional cointegration. In: Robinson, P. M. (Ed.), Time Series with Long Memory, Oxford University Press, Oxford, pp. 334-373.
Robinson, P. M. and Yajima, Y. (2002): Determination of cointegrating rank in fractional systems. Journal of Econometrics, Vol. 106, No.2, pp. 217-241.
Shimotsu, K. (2007): Gaussian semiparametric estimation of multivariate fractionally integrated processes. Journal of Econometrics, Vol. 137, No. 2, pp. 277 - 310.
Shimotsu, K. (2010): Exact Local Whittle Estimation Of Fractional Integration with Unknown Mean and Time Trend. Econometric Theory, Vol. 26, pp. 501 - 540.
Shimotsu, K. and Phillips, P. C. B. (2005): Exact Local Whittle Estimation Of Fractional Integration. The Annals of Statistics, Vol. 33, No. 4, pp. 1890-1933.
Sibbertsen, P., Leschinski, C. H., Holzhausen, M., (2018): A Multivariate Test Against Spurious Long Memory. Journal of Econometrics, Vol. 203, No. 1, pp. 33 - 49.
Souza, I. V. M., Reisen, V. A., Franco, G. d. C. and Bondon, P. (2018): The estimation and testing of the cointegration order based on the frequency domain. Journal of Business & Economic Statistics, Vol. 36, No. 4, pp. 695 - 704.
Velasco, C. (1999): Gaussian Semiparametric Estimation for Non-Stationary Time Series. Journal of Time Series Analysis, Vol. 20, No. 1, pp. 87-126.
Wang, B., Wang, M. and Chan, N. H. (2015): Residual-based test for fractional cointegration. Economics Letters, Vol. 126, pp. 43 - 46.
Xu, J. and Perron, P. (2014): Forecasting return volatility: Level shifts with varying jump probability and mean reversion. International Journal of Forecasting, 30, pp. 449-463.
Zhang, R., Robinson, P. and Yao, Q. (2018): Identifying cointegration by eigenanalysis. Journal of the American Statistical Association (forthcoming).
ARRLS.sim
, ELW
, ELW2S
,
F.hat
, FCI_CH03
, FCI_CH06
,
FCI_MV04
, FCI_N10
, FCI_NS07
,
FCI_R08
, FCI_SRFB18
, FCI_WWC15
,
FCI_ZRY18
, FDLS
, FI.sim
,
FMNBLS
, G.hat
, GSE
,
GSE_coint
, Hou.Perron
, LPWN
,
MLWS
, McC.Perron
, Peri
,
Qu.test
, T.rho
, T0stat
,
VARFIMA.est
, VARFIMA.sim
, W_multi
,
cross.Peri
, ddiffw
, fBM
, fdiff
,
gph
, ll.VARFIMA
, local.W
,
partition.X
, pre.White
, rank.est
LPWN
calculates the local polynomial Whittle plus noise estimator of Frederiksen et al. (2012).
LPWN(data, m, R_short = 0, R_noise = 0)
LPWN(data, m, R_short = 0, R_noise = 0)
data |
data vector |
m |
bandwith parameter specifying the number of Fourier frequencies. |
R_short |
number of (even) polynomial terms used for approximation of spectral density at the origin. |
R_noise |
number of (even) polynomial terms used for approximation of dependence in perturbation term. |
add details here.
Frederiksen, P., Nielsen, F. S., and Nielsen, M. O. (2012): Local polynomial Whittle estimation of perturbed fractional processes. Journal of Econometrics, Vol. 167, No.2, pp. 426-447.
library(fracdiff) T<-2000 d<-0.2 series<-fracdiff.sim(n=T, d=d, ar=0.6)$series+rnorm(T) LPWN(series, m=floor(1+T^0.8), R_short=1, R_noise=0)
library(fracdiff) T<-2000 d<-0.2 series<-fracdiff.sim(n=T, d=d, ar=0.6)$series+rnorm(T) LPWN(series, m=floor(1+T^0.8), R_short=1, R_noise=0)
McC.Perron
trimmed and adaptive log-periodogram estimators of
McCloskey and Perron (2013, ET) for robust estimation of the memory parameter d.
McC.Perron(X, m, epsilon = 0.05, method = c("adaptive", "trimmed"), Kl = 1)
McC.Perron(X, m, epsilon = 0.05, method = c("adaptive", "trimmed"), Kl = 1)
X |
vector of length T. |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation usually |
epsilon |
small constant that determines the choice of the trimming parameter l
used by the |
method |
either "adaptive" or "trimmed" for the corresponding estimator.
Confer McCloskey and Perron (2013, ET) for details. Default is |
Kl |
proportionality factor for bandwidth selection. Default is |
add details here. Recommendation of McCloskey, A. and Perron, P. (2013): Use trimmed
version of estimator if there is reason to assume that shifts are present and use adaptive with
epsilon=0.05
and m=T^0.8
if you are agnostic about the presence of shifts.
Robinson, P. M. (1995): Log-periodogram regression of time series with long range dependence. The Annals of Statistics, Vol. 23, No. 5, pp. 1048 - 1072.
McCloskey, A. and Perron, P. (2013): Memory parameter estimation in the presence of level shifts and deterministic trends. Econometric Theory, 29, pp. 1196-1237.
library(fracdiff) T<-1000 m<-floor(1+T^0.8) d=0.4 series<-fracdiff.sim(n=T, d=d)$series McC.Perron(series,m)
library(fracdiff) T<-1000 m<-floor(1+T^0.8) d=0.4 series<-fracdiff.sim(n=T, d=d)$series McC.Perron(series,m)
Multivariate local Whittle Score type test for the null hypothesis of true long memory against the alternative of spurious long memory suggested by Sibbertsen, Leschinski and Holzhausen (2018).
MLWS(X, m, epsilon = c(0.02, 0.05), coint.elements = NULL, B = NULL, prewhite = c("none", "uni", "multi"), eta = rep(1/sqrt(min(dim(X))), min(dim(X))), rep = FALSE, approx = 100, split = 1, T_limdist = 1000, M_limdist = 5000)
MLWS(X, m, epsilon = c(0.02, 0.05), coint.elements = NULL, B = NULL, prewhite = c("none", "uni", "multi"), eta = rep(1/sqrt(min(dim(X))), min(dim(X))), rep = FALSE, approx = 100, split = 1, T_limdist = 1000, M_limdist = 5000)
X |
data matrix |
m |
bandwith parameter specifying the number of Fourier frequencies used
for the estimation usually |
epsilon |
trimming parameter |
coint.elements |
Vector specifying which elements in the vector series are in a cointegrating relationship. By default |
B |
cointegrating matrix, if known. Default is |
prewhite |
specifies the form of pre-whitening applied. One of |
eta |
vector of weights. Default is |
rep |
if |
approx |
if |
split |
if |
T_limdist |
number of increments used in simulation if limit distribution.
Only relevant for component-wise version of the test. Default is |
M_limdist |
number of replications for simulation of the limit distribution.
Default is |
Sibbertsen, P., Leschinski, C. H., Holzhausen, M., (2018): A Multivariate Test Against Spurious Long Memory. Journal of Econometrics, Vol. 203, No. 1, pp. 33 - 49.
T<-500 m<-floor(1+T^0.75) series<-FI.sim(T=T,q=2,rho=0.7,d=c(0.4,0.2)) ts.plot(series, col=1:2) MLWS(X=series, m=m, epsilon=0.05) shift.series<-series+ARRLS.sim(T=T, phi=0, sig.shift=2, prob=5/T) ts.plot(shift.series, col=1:2) MLWS(X=shift.series, m=m, epsilon=0.05) T<-500 m<-floor(T^0.75) series<-FI.sim(T=T,q=2,rho=0,d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) ts.plot(series, col=1:2) MLWS(series, m=m) MLWS(series, m=m, coint.elements=c(1,2))
T<-500 m<-floor(1+T^0.75) series<-FI.sim(T=T,q=2,rho=0.7,d=c(0.4,0.2)) ts.plot(series, col=1:2) MLWS(X=series, m=m, epsilon=0.05) shift.series<-series+ARRLS.sim(T=T, phi=0, sig.shift=2, prob=5/T) ts.plot(shift.series, col=1:2) MLWS(X=shift.series, m=m, epsilon=0.05) T<-500 m<-floor(T^0.75) series<-FI.sim(T=T,q=2,rho=0,d=c(0.1,0.4), B=rbind(c(1,-1),c(0,1))) ts.plot(series, col=1:2) MLWS(series, m=m) MLWS(series, m=m, coint.elements=c(1,2))
partition.X
conducts a sequence of tests for the equality of
two or more estimated memory parameters to find possible partitions
of a vector into subvectors with equal memory parameters.
The procedure follows Robinson and Yajima (2002).
partition.X(data, d.hat, m, m1, alpha = 0.05, report = FALSE)
partition.X(data, d.hat, m, m1, alpha = 0.05, report = FALSE)
data |
(Txq) data matrix |
d.hat |
(qx1) vector of d-estimates obtained using a local Whittle method such as that described in Robinson (1995). |
m |
the bandwidth parameter to be used for estimation of G |
m1 |
the bandwidth parameter used for estimation of d.vec with m1>>m |
alpha |
the desired significance level for the tests |
report |
either |
add a lot of details.
Robinson, P. M. (1995): Gaussian semiparametric estimation of long rang dependence. The Annals of Statistics, Vol. 23, No. 5, pp. 1630-1661.
Robinson, P. M. and Yajima, Y. (2002): Determination of cointegrating rank in fractional systems. Journal of Econometrics, Vol. 106, No.2, pp. 217-241.
library(fracdiff) T<-1000 d1<-0.2 d2<-0.4 X<-cbind(fracdiff.sim(n=T,d=d1)$series,fracdiff.sim(n=T,d=d1)$series, fracdiff.sim(n=T,d=d2)$series,fracdiff.sim(n=T,d=d2)$series) alpha<-0.05 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) d.hat<-c(local.W(X[,1],m=m1)$d,local.W(X[,2],m=m1)$d,local.W(X[,3],m=m1)$d,local.W(X[,4],m=m1)$d) partition.X(data=X, d.hat=d.hat, m=m, m1=m1, alpha=0.05, report=TRUE)
library(fracdiff) T<-1000 d1<-0.2 d2<-0.4 X<-cbind(fracdiff.sim(n=T,d=d1)$series,fracdiff.sim(n=T,d=d1)$series, fracdiff.sim(n=T,d=d2)$series,fracdiff.sim(n=T,d=d2)$series) alpha<-0.05 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) d.hat<-c(local.W(X[,1],m=m1)$d,local.W(X[,2],m=m1)$d,local.W(X[,3],m=m1)$d,local.W(X[,4],m=m1)$d) partition.X(data=X, d.hat=d.hat, m=m, m1=m1, alpha=0.05, report=TRUE)
Peri
calculates the periodogram of a multivariate time series.
Peri(X)
Peri(X)
X |
(Txq) data matrix. |
Returns an array of dimension c(q,q,floor(T/2))
.
series<-FI.sim(T=1000,q=2,rho=0.7,d=c(0.4,0.4)) peri<-Peri(series) par(mfrow=c(2,2)) for(i in 1:2){ for(j in 1:2){ plot(Re(peri[i,j,]), type="h") lines(Im(peri[i,j,]), col=2) }}
series<-FI.sim(T=1000,q=2,rho=0.7,d=c(0.4,0.4)) peri<-Peri(series) par(mfrow=c(2,2)) for(i in 1:2){ for(j in 1:2){ plot(Re(peri[i,j,]), type="h") lines(Im(peri[i,j,]), col=2) }}
Given a parameter vector theta
obtained using VARFIMA_est
,
pre.White
returns the pre-whitened sample.
pre.White(theta, data, q, approx = 100)
pre.White(theta, data, q, approx = 100)
theta |
estimated parameter vector. |
data |
data matrix with T observations of q-dimensional process. |
q |
dimension of the process. |
approx |
order of the AR-approximation that is supposed to be used. Default is |
add details here.
Sibbertsen, P., Leschinski, C. H., Holzhausen, M., (2015): A Multivariate Test Against Spurious Long Memory. Hannover Economic Paper.
Qu.test
Test statistic of Qu (2011) for the null hypotesis of true long memory
against the alternative of spurious long memory.
Qu.test(data, m, epsilon = 0.05)
Qu.test(data, m, epsilon = 0.05)
data |
data vector of length T. |
m |
bandwith parameter specifying the number of Fourier frequencies used
for the estimation usually |
epsilon |
trimming parameter |
Qu, Z. (2011): A Test Against Spurious Long Memory. Journal of Business and Economic Statistics, Vol. 29, No. 3, pp. 423 - 438.
library(fracdiff) T<-500 m<-floor(1+T^0.75) series<-fracdiff.sim(n=T,d=0.4)$series shift.series<-ARRLS.sim(T=500,phi=0.5, sig.shift=0.75, prob=5/T, sig.noise=1) ts.plot(series, ylim=c(min(min(series),min(shift.series)),max(max(series),max(shift.series)))) lines(shift.series, col=2) Qu.test(series,m=m, epsilon=0.05) Qu.test(shift.series,m=m, epsilon=0.05)
library(fracdiff) T<-500 m<-floor(1+T^0.75) series<-fracdiff.sim(n=T,d=0.4)$series shift.series<-ARRLS.sim(T=500,phi=0.5, sig.shift=0.75, prob=5/T, sig.noise=1) ts.plot(series, ylim=c(min(min(series),min(shift.series)),max(max(series),max(shift.series)))) lines(shift.series, col=2) Qu.test(series,m=m, epsilon=0.05) Qu.test(shift.series,m=m, epsilon=0.05)
Model selection procedure to estimate the cointegrating rank based on eigenvalues of correlation matrix P suggested by Robinson and Yajima (2002).
rank.est(data, d.hat, m, m1, v_n = m^(-0.3))
rank.est(data, d.hat, m, m1, v_n = m^(-0.3))
data |
data matrix of dimension (qxT). |
d.hat |
the estimated d.vector |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation of d, usually |
m1 |
the bandwidth parameter used for estimation of d.vec with m1>>m |
v_n |
bandwidth parameter. Nielsen and Shimotsu (2007) use m^(-0.3) in their simulation studies, which s the default value. m^(-b) mit 0<b<0.5 can be used. |
add details here.
Robinson, P. M. and Yajima, Y. (2002): Determination of cointegrating rank in fractional systems. Journal of Econometrics, Vol. 106, No.2, pp. 217-241.
Nielsen, M. O. and Shimotsu, K. (2007): Determining the coinegrating rank in nonstationary fractional systems by the exact local Whittle approach. Journal of Econometrics, 141, pp. 574-596.
library(fracdiff) T<-2000 d<-0.4 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) xt<-fracdiff.sim(n=T, d=d)$series yt<-xt+rnorm(T) zt<-xt+rnorm(T) X<-cbind(xt,yt,zt) lW.wrap<-function(data,m){local.W(data,m)$d} d.hat<-apply(X,2,lW.wrap, m=m1) rank.est(data=X, d.hat, m=m, m1=m1)
library(fracdiff) T<-2000 d<-0.4 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) xt<-fracdiff.sim(n=T, d=d)$series yt<-xt+rnorm(T) zt<-xt+rnorm(T) X<-cbind(xt,yt,zt) lW.wrap<-function(data,m){local.W(data,m)$d} d.hat<-apply(X,2,lW.wrap, m=m1) rank.est(data=X, d.hat, m=m, m1=m1)
T.rho
Uses pairwise test as suggested by Robinson and Yajima (2002) to test
for the equality of the memory parameters in a vector series.
T.rho(data, d.hat, m, m1, alpha = 0.05, s_bar = 1, h_n = 1/sqrt(log(max(dim(data)))))
T.rho(data, d.hat, m, m1, alpha = 0.05, s_bar = 1, h_n = 1/sqrt(log(max(dim(data)))))
data |
data matrix of dimension (qxT). |
d.hat |
the estimated d.vector |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation of G, usually |
m1 |
the bandwidth parameter used for estimation of d.vec with m1>>m |
alpha |
the desired significance level for the tests |
s_bar |
number of subvectors to be tested in partitioning procedure.
Default is |
h_n |
bandwidth parameter. Default is |
Christian Leschinski
Robinson, P. M. and Yajima, Y. (2002): Determination of cointegrating rank in fractional systems. Journal of Econometrics, Vol. 106, No.2, pp. 217-241.
Nielsen, M. O. and Shimotsu, K. (2007): Determining the coinegrating rank in nonstationary fractional systems by the exact local Whittle approach. Journal of Econometrics, 141, pp. 574-596.
library(fracdiff) T<-1000 d1<-0.2 d2<-0.4 X<-cbind(fracdiff.sim(n=T,d=d1)$series,fracdiff.sim(n=T,d=d1)$series, fracdiff.sim(n=T,d=d2)$series,fracdiff.sim(n=T,d=d2)$series) alpha<-0.05 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) lW.wrap<-function(data,m){local.W(data,m)$d} d.hat<-apply(X,2,lW.wrap, m=m1) T.rho(data=X, d.hat=d.hat, m=m, m1=m1)
library(fracdiff) T<-1000 d1<-0.2 d2<-0.4 X<-cbind(fracdiff.sim(n=T,d=d1)$series,fracdiff.sim(n=T,d=d1)$series, fracdiff.sim(n=T,d=d2)$series,fracdiff.sim(n=T,d=d2)$series) alpha<-0.05 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) lW.wrap<-function(data,m){local.W(data,m)$d} d.hat<-apply(X,2,lW.wrap, m=m1) T.rho(data=X, d.hat=d.hat, m=m, m1=m1)
T0stat
tests equality of all memory parameters simultaneously.
Statistic was suggested by Robinson and Yajima (2002). Test statistic
was denoted by T_0 in Nielsen and Shimotsu (2007).
T0stat(data, d.hat, m, m1, alpha = 0.05, s_bar = 1, h_n = 1/sqrt(log(max(dim(data)))))
T0stat(data, d.hat, m, m1, alpha = 0.05, s_bar = 1, h_n = 1/sqrt(log(max(dim(data)))))
data |
data matrix of dimension (qxT). |
d.hat |
the estimated d.vector |
m |
bandwith parameter specifying the number of Fourier frequencies.
used for the estimation of d, usually |
m1 |
the bandwidth parameter used for estimation of d.vec with m1>>m |
alpha |
the desired significance level for the tests |
s_bar |
number of subvectors to be tested in partitioning procedure.
Default is |
h_n |
bandwidth parameter. Default is |
add details here.
Robinson, P. M. and Yajima, Y. (2002): Determination of cointegrating rank in fractional systems. Journal of Econometrics, Vol. 106, No.2, pp. 217-241.
Nielsen, M. O. and Shimotsu, K. (2007): Determining the coinegrating rank in nonstationary fractional systems by the exact local Whittle approach. Journal of Econometrics, 141, pp. 574-596.
library(fracdiff) T<-1000 d1<-0.2 d2<-0.4 X<-cbind(fracdiff.sim(n=T,d=d1)$series,fracdiff.sim(n=T,d=d1)$series, fracdiff.sim(n=T,d=d2)$series,fracdiff.sim(n=T,d=d2)$series) alpha<-0.05 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) lW.wrap<-function(data,m){local.W(data,m)$d} d.hat<-apply(X,2,lW.wrap, m=m1) T0stat(data=X, d.hat=d.hat, m=m, m1=m1)
library(fracdiff) T<-1000 d1<-0.2 d2<-0.4 X<-cbind(fracdiff.sim(n=T,d=d1)$series,fracdiff.sim(n=T,d=d1)$series, fracdiff.sim(n=T,d=d2)$series,fracdiff.sim(n=T,d=d2)$series) alpha<-0.05 m1<-floor(1+T^0.75) m<-floor(1+T^0.65) lW.wrap<-function(data,m){local.W(data,m)$d} d.hat<-apply(X,2,lW.wrap, m=m1) T0stat(data=X, d.hat=d.hat, m=m, m1=m1)
VARFIMA.est
returns the maximum likelihood estimate of the parameter vector of a VARFIMA(1,1) in final equations form.
VARFIMA.est(data, approx = 100, split = 1, rep = FALSE)
VARFIMA.est(data, approx = 100, split = 1, rep = FALSE)
data |
data matrix with T observations of q-dimensional process. |
approx |
order of the AR-approximation that is supposed to be used. Default is |
split |
to increase the speed the sample can be divided in |
rep |
is passed to |
add details here.
Lutkepohl, H. (2007): New introduction to multiple time series analysis. Springer.
series<-VARFIMA.sim(phi=0.4, THETA=matrix(c(0,0,0,0),2,2), d.vec=c(0.4,0.3), T=1000, Sigma=matrix(c(1,0.4,0.4,1),2,2)) ts.plot(series, col=1:2) acf(series, lag=100) VARFIMA.est(series, approx=100, rep=FALSE)
series<-VARFIMA.sim(phi=0.4, THETA=matrix(c(0,0,0,0),2,2), d.vec=c(0.4,0.3), T=1000, Sigma=matrix(c(1,0.4,0.4,1),2,2)) ts.plot(series, col=1:2) acf(series, lag=100) VARFIMA.est(series, approx=100, rep=FALSE)
VARFIMA.sim
returns a sample from a VARFIMA(1,1)-process.
VARFIMA.sim(phi, THETA, d.vec, T, Sigma, approx = 100, burnin = 100)
VARFIMA.sim(phi, THETA, d.vec, T, Sigma, approx = 100, burnin = 100)
phi |
AR(1)-parameter. |
THETA |
MA(1)-matrix. |
d.vec |
vector of memory parameters. |
T |
desired sample size. |
Sigma |
Variance-Covariance-Matrix of the innovations. |
approx |
order of the AR-approximation that is supposed to be used. Default is |
burnin |
length of the burnin period that is discarded. Default is |
add details here.
Lutkepohl, H. (2007): New introduction to multiple time series analysis. Springer.
series<-VARFIMA.sim(phi=0.4, THETA=matrix(c(0,0,0,0),2,2), d.vec=c(0.4,0.3), T=1000, Sigma=matrix(c(1,0.4,0.4,1),2,2)) ts.plot(series, col=1:2) acf(series, lag=100)
series<-VARFIMA.sim(phi=0.4, THETA=matrix(c(0,0,0,0),2,2), d.vec=c(0.4,0.3), T=1000, Sigma=matrix(c(1,0.4,0.4,1),2,2)) ts.plot(series, col=1:2) acf(series, lag=100)
Multivariate local Whittle Score type test for the null hypothesis of true long memory against the alternative of spurious long memory suggested by Sibbertsen, Leschinski and Holzhausen (2015).
W_multi(X, d_vec, m, epsilon, eta)
W_multi(X, d_vec, m, epsilon, eta)
X |
data matrix |
d_vec |
estimated vector of memory parameters. |
m |
bandwith parameter specifying the number of Fourier frequencies used
for the estimation usually |
epsilon |
trimming parameter |
eta |
weight vector. |
add details here
Sibbertsen, P., Leschinski, C. H., Holzhausen, M., (2015): A Multivariate Test Against Spurious Long Memory. Hannover Economic Paper.