logo

Analyzing Time Series with Valuation Models in R 📂Statistical Analysis

Analyzing Time Series with Valuation Models in R

Practice

Value model serves as a useful tool for explaining archetypes, and the analytical procedure itself is similar to that of the ARMA model.

1.png

The graph above shows the German DAX index from 1991 to 1999, drawn by extracting only DAX from EuStockMarkets.

2.png

When we look at the square of returns, there seems to be an ARCH effect almost certainly. To check if the squared returns follow the ARMA model, let’s use EACF.

20190904\_133855.png

Since it is speculated that the square of returns follows ARMA model $ARMA(1,3)$, it can be assumed that the returns follow $GARCH(1,3)$. Using the garch() function of the tseries package allows for analysis as a value model.

20190904\_113946.png

Reading the analysis results is the same as regression analysis, but the difference is that it also automatically performs Jarque Bera Test and Box-Ljung Test underneath. Since the p-value of the Box-Ljung Test turned out to be quite large, it seems that the model fitting itself was well done, but a low p-value of the Jarque Bera Test is not a good sign. This means there is a problem with the normality of residuals, so let’s draw a histogram to check.

3.png

Upon closer examination, it can be seen that normality is lacking due to some huge outliers. Skewness is heavily affected by outliers, and it seems that the testing was distorted because of that. Let’s remove the outliers and test again.

20190904\_135117.png

Removing the outliers, the Jarque-Bera Test supports that residuals have normality. However, the Shapiro-Wilk Test still judged that normality was lacking, demonstrating that it’s certainly possible to get different results from the same test for normality. It’s very common in time series analysis to have huge outliers, but Jarque-Bera Test, unlike the Shapiro-Wilk Test, often reveals normality when outliers are removed.

At least in this case, it may be considered permissible to see the residuals having normality since it passed the Jarque-Bera Test but not the Shapiro-Wilk Test. Conclusively, it is fine to say that the returns follow $GARCH(1,3)$.

Code

Here is an example code.

library(TSA)
library(tseries)
returnize <- function(data) {return(diff(log(data)))}

DAX <- ts(EuStockMarkets[,1],start=1)
r.DAX <- returnize(DAX)
eacf(r.DAX^2)

out <- garch(r.DAX,order=c(1,3)); summary(out)
resi<-na.omit(residuals(out))
win.graph(6,3); hist(resi)
resi2<-resi[abs(resi)<2.58]
jarque.bera.test(resi2)
shapiro.test(resi2)

See Also