Learn R Programming

PCA4TS (version 0.1)

segmentVOL: Segment Multivariate Volatility Processes

Description

Calculate linear transformation of the $p$-variate volatility processes y_t such that the transformed volatility process x_t=By_t can be segmented into $q$ lower-dimensional processes, and there exist no conditional cross correlations across those $q$ processes.

Usage

segmentVOL(Y, k0)

Arguments

Y
a data matrix with $n$ rows and $p$ columns, where $n$ is the sample size and $p$ is the dimension of the time series.
k0
a positive integer specified to calculate Wy.

Value

An object of class "segmentVOL" is a list containing the following components:
B
the $p$ by $p$ transformation matrix such that x_t=By_t
X
the transformed series with $n$ rows and $p$ columns

References

Chang, J., Guo, B. and Yao, Q. (2014). Segmenting Multiple Time Series by Contemporaneous Linear Transformation: PCA for Time Series. Available at http://arxiv.org/abs/1410.2323.

See Also

segmentTS

Examples

Run this code
## Example 7 of Chang et al.(2014)
## Segmenting the returns of the 6 stocks

require(tseries)
data(returns)
Y=returns
n=dim(Y)[1]; p=dim(Y)[2]
# Carry out the transformation procedure
Trans=segmentVOL(Y,5)
X_0=data.frame(Trans$X)
X_1=X_0
# The ACF plot of the residuals after prewhitening the transformed data by GARCH(1,1)
nanum=rep(0,p)
for(j in 1:p) {options( warn = -1 )
               t=garch(X_1[,j], order = c(1,1),trace=FALSE)
               X_1[,j]=t$residuals
               a=X_1[,j]
               nanum[j]=length(a[is.na(X_1[,j])]) }
X=X_1[(max(nanum)+1):n,]
colnames(X)=c("X1","X2","X3","X4","X5","X6")
t=acf(X,plot=FALSE)
plot(t, max.mfrow=6, xlab='', ylab='',  mar=c(1.8,1.3,1.6,0.5),
    oma=c(1,1.2,1.2,1), mgp=c(0.8,0.4,0),cex.main=1.0,ylim=c(0,1))
# Identify the permutation mechanism
permutation=permutationMax(X_0,Vol=TRUE)
permutation$Groups
options( warn = 0)

Run the code above in your browser using DataLab