Sunday, November 13, 2016

Financial products with capital protection barrier - part 6

Homoscedasticity Tests

Abstract

In this post I am going to test whether our observations time series has heteroscedasticity. That represent another important verification as being relevant in deciding the flavours of simulation procedure to adopt.

Analysis

I am taking advantage of the McLeod.Li.test function made available by the TSA package and the Breusch-Pagan test made available by the lmtest package.

The McLeod.Li test null hypothesis sets forth that our observations variance values are not correlated, so that this test checks for the presence of conditional heteroscedasticity by computing the Ljung-Box test with the squared observations values. The null hypothesis is the absence of conditional heteroscedasticity.

The Breusch-Pagan test null hypothesis sets forth that observations variance values do not depend on time, as linear function of, in the sense that:

\[ \begin{equation} \begin{cases} ln(\sigma^2)\ =\ a\ +\ bt \\ \\ H_{0}\ :\ b\ =\ 0 \\ \end{cases} \end{equation} \]

load(file="structured-product-3.RData")
invisible(lapply(ts.package, function(x) {
  suppressPackageStartupMessages(library(x, character.only=TRUE)) }))

McLeod.Li.test(y=GSPC_log_returns, plot=TRUE, main="McLeod-Li Test")

bptest(coredata(GSPC_log_returns)~ index(GSPC_log_returns))
## 
## Results of Hypothesis Test
## --------------------------
## 
## Alternative Hypothesis:          
## 
## Test Name:                       studentized Breusch-Pagan test
## 
## Data:                            coredata(GSPC_log_returns) ~ index(GSPC_log_returns)
## 
## Test Statistic:                  BP = 0.4151955
## 
## Test Statistic Parameter:        df = 1
## 
## P-value:                         0.5193442

Based on McLeod-Li test p-values as shown in the plot above, we cannot reject the null hypothesis of no conditional heteroscedasticity.

Based on Breusch-Pagan test p-value, we cannot reject the null hypothesis of observations variance constant with time.

I am going to verify the same on log returns without outliers observations.

GSPC_log_returns_no_outliers <- GSPC_log_returns[-c(outliers_l, outliers_r)]
McLeod.Li.test(y=GSPC_log_returns_no_outliers, plot=TRUE, main="McLeod-Li Test")

bptest(coredata(GSPC_log_returns_no_outliers)~ index(GSPC_log_returns_no_outliers))
## 
## Results of Hypothesis Test
## --------------------------
## 
## Alternative Hypothesis:          
## 
## Test Name:                       studentized Breusch-Pagan test
## 
## Data:                            coredata(GSPC_log_returns_no_outliers) ~ index(GSPC_log_returns_no_outliers)
## 
## Test Statistic:                  BP = 0.2222338
## 
## Test Statistic Parameter:        df = 1
## 
## P-value:                         0.6373431

With a little bit of surprise, removing the outliers has completely changed the result of the McLeod-Li test. Based on its p-values, we have to reject the null hypothesis of no conditional heteroscedasticity.

On the other hand, the Breusch-Pagan test confirms that we cannot reject the null hypothesis constant variance with time also when outliers have been taken off from the log returns time series.

Conclusions

The constant variance hypothesis has been verified both for no conditional heteroscedasticity and linear time dependency. However, when we take out the outliers, conditional heteroscedasticity shows up while linear dependency does not.

All that is something to keep in mind in case we decide to simulate separately the outliers and the observations (without outliers) and afterwards join both results into a unique total one.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.