SlideShare a Scribd company logo
The average weekly earnings of google shares are $1.005 per
share with a standard deviation of $0.045. The distribution of
returns is more or less symmetric but have high peak. Normality
test (Jarque Bera Test) rejects hypothesis of normality for
earnings data at 5% level.
Jarque Bera Test
data: returns
X-squared = 54.1642, df = 2, p-value = 1.731e-12
The distribution of log(returns) is also not closer to normal
distribution, with symmetry close to 0 but kurtosis statistics is
1.5 which is far from normal distribution statistic. The Jarque-
Bera test is significant (p-value < 0.05) indicating that
hypothesis of normal distribution for log(returns) can be
rejected.
Jarque Bera Test
data: rets
X-squared = 49.4632, df = 2, p-value = 1.816e-11
The following plot is time series plot of weekly price of google
shares which shows increasing trend.
Time series Plot of Google Prices
Time plot of returns show that google stock returns shows
periods of high volatility at various times. Most returns are
between +/- 10%. Sample moments show that distribution of log
returns is somewhat symmetric with very thin tails (kurtosis =
1.56).
To check null hypothesis of non stationarity:
Dickey Fuller Test is expressed as H0: φ1=1 vs Ha: φ1<>1
where the null hypothesis indicates unit-root non-stationarity.
The Dickey-Fuller test shows that the earnings time series is
unit-root stationary. The test p-values for lags 7 is less than
0.05, therefore the null hypothesis of non stationarity can be
rejected (small p-values< 0.05).
Augmented Dickey-Fuller Test
data: rets
Dickey-Fuller = -7.1264, Lag order = 7, p-value = 0.01
alternative hypothesis: stationary
To check serial correlations in the log returns:
Log returns are not serially correlated as shown by the Ljung-
Box test with p-values > 0.05 and the autocorrelation plot.
Box-Pierce test
data: coredata(rets)
X-squared = 0.686, df = 1, p-value = 0.4075
To look for evidence of ARCH effects in the log returns:
The analysis below shows a strong ARCH effect. The squared
returns are strongly correlated. The Ljung-Box tests on squared
residuals are highly significant with p-values < 0.005, and
autocorrelation plots shows large autocorrelations for the first
15 lags.
Box-Pierce test
data: coredata(rets^2)
X-squared = 8.1483, df = 1, p-value = 0.00431
Plot of PACF: There is no correlation till lag 10 which shows
there is no AR lag.
To fit an ARMA(0,0)-GARCH(2,1) model for the log returns
using a normal- distribution for the error terms:
Fitted Model:
Residual Analysis:
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 28.78 0.06948
2 30 38.57 0.11019
3 40 46.39 0.19380
4 50 51.15 0.38929
Above output shows that error terms are normally distributed as
all the P values are greater than 0.05.
To fit ARMA(0,0)-eGARCH(1,1) model with Gaussian
distribution:
Fitted Model is:
Residual Analysis:
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 28.95 0.06673
2 30 27.82 0.52739
3 40 46.91 0.18000
4 50 50.72 0.40546
Above output shows that error terms are normally distributed as
all the P values are greater than 0.05.
To fit ARMA(0,0)-TGARCH(2,1) model with norm-distribution:
Fitted Model:
Residual Analysis:
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 18.29 0.5030
2 30 31.28 0.3525
3 40 29.17 0.8742
4 50 51.36 0.3813
Above output shows that error terms are normally distributed as
all the P values are greater than 0.05.
BEST FIT FOR THE MODEL:
garch21 egarch11 gjrgarch21
Akaike -3.436225 -3.451379 -3.463469
Bayes -3.391975 -3.407129 -3.401519
Shibata -3.436449 -3.451603 -3.463905
Hannan-Quinn -3.418814 -3.433968 -3.439094
From above output it can be said that AR(0)-EGARCH(1,1) and
AR(0) – GJR(1,1) both have almost equal (smallest) values for
all best fit criterion and hence can be considered as best model.
Forecast Analysis:
RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE
OBSERVATIONS FOR FORECAST and EVALUATE
STATISTICS for 5 Step Ahead Forecast.
Model
garch21
egarch11
tgarch21
MSE
0.0009497851
0.0009497741
0.0009499554
MAE
0.0224897000
0.0225260500
0.0225533000
DAC
0.6000000000
0.6000000000
0.6000000000
Since MSE is smallest for GJRGARCH model. We should
consider this model for forecasting.
CODE:
library(e1071)
library(tseries)
library(xts)
library(rugarch)
price = scan("clipboard")
pricets=ts(price,frequency=52,start=c(2004,45))
returns=pricets/lag(pricets, -1)
summary(price)
skewness(price)
kurtosis(price)
sd(price)
summary(returns)
skewness(returns)
kurtosis(returns)
sd(returns)
#Normality check
hist(returns, prob=TRUE)
lines(density(returns, adjust=2), type="l")
jarque.bera.test(returns)
#log return time series
rets = log(pricets/lag(pricets, -1))
#Normality check
hist(rets, prob=TRUE)
lines(density(rets, adjust=2), type="l")
jarque.bera.test(rets)
plot.ts(price.ts)
# strip off the dates and just create a simple numeric object
(require:xts)
ret = coredata(rets);
# creates time plot of log returns
plot(rets)
summary(rets)
skewness(rets)
kurtosis(rets)
sd(returns)
#ADF test for checking null hypothesis of non stationarity
adf.test(rets)
# Computes Ljung-Box test on returns
Box.test( coredata(rets))
# Computes Ljung-Box test on squared returns to test non-linear
independence
Box.test(coredata(rets^2))
# Computes Ljung-Box test on absolute returns to test non-
linear independence
Box.test(abs(coredata(rets)))
par(mfrow=c(3,1))
# Plots ACF function of vector data
acf(ret)
# Plot ACF of squared returns to check for ARCH effect
acf(ret^2)
# Plot ACF of absolute returns to check for ARCH effect
acf(abs(ret))
#plot returns, square returns and abs(returns)
par(mfrow=c(3,1))
# Plots ACF function of vector data
plot(rets, type='l')
# Plot ACF of squared returns to check for ARCH effect
plot(rets^2,type='l')
# Plot ACF of absolute returns to check for ARCH effect
plot(abs(rets),type='l')
par(mfrow=c(1,1))
# plots PACF of squared returns to identify order of AR model
pacf(coredata(rets),lag=10)
#specify model using functions in rugarch package
#Fit ARMA(0,0)-GARCH(2,1) model
garch21.spec=ugarchspec(variance.model=list(garchOrder=c(2,1
)), mean.model=list(armaOrder=c(0,0)))
#estimate model
garch21.fit=ugarchfit(spec=garch21.spec, data=rets)
garch21.fit
#Fit ARMA(0,0)-eGARCH(1,1) model with Gaussian
distribution
egarch11.spec=ugarchspec(variance.model=list(model =
"eGARCH",
garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)))
#estimate model
egarch11.fit=ugarchfit(spec=egarch11.spec, data=ret)
egarch11.fit
#Fit ARMA(0,0)-TGARCH(2,1) model with norm-distribution
gjrgarch21.spec=ugarchspec(variance.model=list(model =
"gjrGARCH",
garchOrder=c(2,1)), mean.model=list(armaOrder=c(0,0)),
distribution.model = "norm")
#estimate model
gjrgarch21.fit=ugarchfit(spec=gjrgarch21.spec, data=ret)
gjrgarch21.fit
# compare information criteria
model.list = list(garch21 = garch21.fit,
egarch11 = egarch11.fit,
gjrgarch21 = gjrgarch21.fit)
info.mat = sapply(model.list, infocriteria)
rownames(info.mat) = rownames(infocriteria(garch21.fit))
info.mat
# RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE
OBSERVATIONS FOR FORECAST
# EVALUATION STATISTICS
garch21.fit = ugarchfit(spec=garch21.spec, data=ret,
out.sample=100)
egarch11.fit = ugarchfit(egarch11.spec, data=ret,
out.sample=100)
tgarch21.fit = ugarchfit(spec=gjrgarch21.spec, data=ret,
out.sample=100)
garch21.fcst = ugarchforecast(garch21.fit, n.roll=100,
n.ahead=5)
egarch11.fcst = ugarchforecast(egarch11.fit, n.roll=100,
n.ahead=5)
tgarch21.fcst = ugarchforecast(tgarch21.fit, n.roll=100,
n.ahead=5)
fcst.list = list(garch21=garch21.fcst,
egarch11=egarch11.fcst,
tgarch21=tgarch21.fcst)
fpm.mat = sapply(fcst.list, fpm)
fpm.mat
EXPLORATORY ANALYSIS
nobs 469.000000
NAs 0.000000
Minimum -0.166652
Maximum 0.164808
1. Quartile -0.022391
3. Quartile 0.029000
Mean 0.003843
Median 0.005614
Sum 1.802469
SE Mean 0.002079
LCL Mean -0.000242
UCL Mean 0.007929
Variance 0.002027
Stdev 0.045027
Skewness -0.040829
Kurtosis 1.569306
Title: Jarque - Bera Normalality TestTest Results: STATISTIC:
X-squared: 49.4632 P VALUE: Asymptotic p Value: 1.816e-
11
The distribution of log(returns) is not normal distribution, with
symmetry close to 0 but kurtosis statistics is 1.5 which is far
from normal distribution statistic. The Jarque-Bera test is
significant (p-value < 0.05) indicating that hypothesis of
normal distribution for log(returns) can be rejected.
The following plot is time series plot of weekly price of Google
shares which shows increasing trend.
(
Time series Plot of Google Prices
)
Time plot of returns show that google stock returns shows
periods of high volatility at various times. Most returns are
between +/- 10%. Sample moments show that distribution of log
returns is somewhat symmetric with very thin tails (kurtosis =
1.56). There is various times where the returns produce +/-15%
with higher volatility also. Volatility doesn’t seem to die down
quickly and it continues for a while after a volatile period.
To check null hypothesis of non stationarity:
Dickey Fuller Test is expressed as H0: φ1=1 vs Ha: φ1<>1
where the null hypothesis indicates unit-root non-stationarity.
The Dickey-Fuller test shows that the earnings time series is
unit-root stationary. The test p-values for lags 7 is less than
0.05, therefore the null hypothesis of non stationarity can be
rejected (small p-values< 0.05).
Augmented Dickey-Fuller TestTest Results: PARAMETER:
Lag Order: 7 STATISTIC: Dickey-Fuller: -7.1331 P
VALUE: 0.01
alternative hypothesis: stationary
ACF TESTS
The ACF plots below show the Google stock returns are not
correlated indicating a constant mean model for rt. Both the
squared returns time series and the absolute time series show
large autocorrelations. We can conclude that the log returns
process has a strong non-linear dependence.
Ljung Box testing for ARCH effects for Lags of 6-12-18 for
squared returns and absolute returns
Box-Ljung testdata: coredata(rets^2)X-squared = 48.3339, df =
6, p-value = 1.013e-08Box-Ljung testdata: coredata(rets^2)X-
squared = 71.9976, df = 12, p-value = 1.352e-10Box-Ljung
testdata: coredata(rets^2)X-squared = 98.7945, df = 18, p-value
= 3.68e-13
The Ljung Box tests confirm that the Ljung Box tests on the
squared returns are autocorrelated. The analysis shows a strong
ARCH effect. The squared returns are strongly correlated. The
Ljung-Box tests on squared residuals are highly significant with
p-values < 0.005, and autocorrelation plots shows large
autocorrelations for the first 18 lags.
Plot of PACF: There is no correlation till lag 13 which shows
there is no AR lag.
MODEL FITTING
*---------------------------------** GARCH Model Fit
**---------------------------------*Conditional Variance Dynamics
-----------------------------------GARCH Model:
sGARCH(1,1)Mean Model: ARFIMA(0,0,0)Distribution: std
Optimal Parameters------------------------------------
Estimate Std. Error t value Pr(>|t|)mu 0.004432 0.001778
2.4924 0.012689omega 0.000103 0.000053 1.9574
0.050295alpha1 0.094169 0.032716 2.8784 0.003997beta1
0.856326 0.044635 19.1850 0.000000shape 6.797338
2.000925 3.3971 0.000681
To fit an ARMA(0,0)-GARCH(2,1) model for the log returns
using a normal distribution for the error terms:
Fitted Model:
with 7 degrees of freedom
Residual AnalysisQ-Statistics on Standardized Residuals---------
--------------------------- statistic p-valueLag[1]
0.0339 0.8539Lag[p+q+1][1] 0.0339 0.8539Lag[p+q+5][5]
2.4766 0.7800d.o.f=0H0 : No serial correlationQ-Statistics on
Standardized Squared Residuals------------------------------------
statistic p-valueLag[1] 0.1274 0.7212Lag[p+q+1][3]
1.4245 0.2327Lag[p+q+5][7] 3.4346 0.6333d.o.f=2
Above output shows there is no evidence of autocorrelation in
residuals. They behave like white noise. Also, there is no
evidence of serial correlation in squared residuals. They also
behave like white noise. Adjusted Pearson Goodness-of-Fit
Test:------------------------------------ group statistic p-value(g-
1)1 20 8465 02 30 13148 03 40
17834 04 50 22521 0
Test for Goodness of fit. Normal Distribution rejected.
To fit ARMA(0,0)-eGARCH(1,1) model with Gaussian
distribution:
Conditional Variance Dynamics -----------------------------------
GARCH Model: eGARCH(1,1)Mean Model:
ARFIMA(0,0,0)Distribution: norm Optimal Parameters-----------
------------------------- Estimate Std. Error t value
Pr(>|t|)mu 0.004814 0.001837 2.6205 0.008780omega -
0.427600 0.165861 -2.5781 0.009936alpha1 -0.086690
0.033886 -2.5583 0.010518beta1 0.931657 0.026273
35.4604 0.000000gamma1 0.177187 0.048248 3.6724
0.000240
Fitted Model is:
Residual Analysis:Q-Statistics on Standardized Residuals--------
---------------------------- statistic p-valueLag[1]
0.03655 0.8484Lag[p+q+1][1] 0.03655 0.8484Lag[p+q+5][5]
2.73813 0.7403d.o.f=0H0 : No serial correlationQ-Statistics on
Standardized Squared Residuals------------------------------------
statistic p-valueLag[1] 0.2255 0.6348Lag[p+q+1][3]
2.6812 0.1015Lag[p+q+5][7] 4.1362 0.5300d.o.f=2ARCH
LM Tests------------------------------------ Statistic DoF
P-ValueARCH Lag[2] 2.224 2 0.3290ARCH Lag[5]
4.682 5 0.4559ARCH Lag[10] 7.053 10 0.7204
Above output shows there is no evidence of autocorrelation in
residuals. They behave like white noise. Also, there is no
evidence of serial correlation in squared residuals. They also
behave like white noise. Adjusted Pearson Goodness-of-Fit
Test:------------------------------------ group statistic p-value(g-
1)1 20 26.65 0.11312 30 32.04 0.31793 40
43.67 0.27984 50 47.74 0.5243
Above output shows that error terms are normally distributed as
all the P values are greater than 0.05.
To fit ARMA(0,0)-tGARCH(1,1) model with Gaussian
distribution:Conditional Variance Dynamics -----------------------
------------GARCH Model: gjrGARCH(2,1)Mean Model:
ARFIMA(0,0,0)Distribution: norm Optimal Parameters-----------
------------------------- Estimate Std. Error t value
Pr(>|t|)mu 0.004928 0.001860 2.649926 0.008051omega
0.000120 0.000053 2.257334 0.023987alpha1 0.000000
0.000877 0.000011 0.999991alpha2 0.072854 0.037335
1.951388 0.051011beta1 0.828559 0.053752 15.414339
0.000000gamma1 0.397469 0.144242 2.755564
0.005859gamma2 -0.315459 0.131445 -2.399922 0.016399
Fitted Model is:
Residual Analysis:Q-Statistics on Standardized Residuals--------
---------------------------- statistic p-valueLag[1]
0.2311 0.6307Lag[p+q+1][1] 0.2311 0.6307Lag[p+q+5][5]
2.9412 0.7090d.o.f=0H0 : No serial correlationQ-Statistics on
Standardized Squared Residuals------------------------------------
statistic p-valueLag[1] 2.137 0.14380Lag[p+q+1][4]
4.191 0.04063Lag[p+q+5][8] 4.680 0.45620d.o.f=3ARCH LM
Tests------------------------------------ Statistic DoF P-
ValueARCH Lag[2] 2.461 2 0.2921ARCH Lag[5] 4.904
5 0.4277ARCH Lag[10] 7.140 10 0.7122
Above output shows there is no evidence of autocorrelation in
residuals. They behave like white noise. Also, there is no
evidence of serial correlation in squared residuals. They also
behave like white noise. Adjusted Pearson Goodness-of-Fit
Test:------------------------------------ group statistic p-value(g-
1)1 20 20.00 0.39472 30 32.43 0.30143 40
30.87 0.82034 50 54.56 0.2714
Above output shows that error terms are normally distributed as
all the P values are greater than 0.05.
BEST FIT FOR THE MODEL: garch11 egarch11
gjrgarch11Akaike -3.479720 -3.455538 -3.474405Bayes
-3.435471 -3.411288 -3.412455Shibata -3.479944 -3.455762
-3.474841Hannan-Quinn -3.462310 -3.438127 -3.450030
From above output it can be said that AR(0)-EGARCH(1,1)
have the (smallest) values for all best fit criterion and hence can
be considered as best model.
Forecast Analysis:
RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE
OBSERVATIONS FOR FORECAST and EVALUATE
STATISTICS for 5 Step Ahead Forecast.
garch11 egarch11 tgarch21 MSE 0.000950199
0.0009498531 0.0009499473MAE 0.02257449 0.0225407
0.02255243 DAC 0.6 0.6 0.6
Since MSE is smallest for eGARCH model. We should consider
this model for forecasting.
CODE:
#Tomas Georgakopoulos CSC 425 Final Project
setwd("C:/Course/CSC425")
# Analysis of Google weekly returns from
library(forecast)
library(TSA)
# import data in R and compute log returns
# import libraries for TS analysis
library(zoo)
library(tseries)
myd= read.table('Weekly-GOOG-TSDATA.csv', header=T,
sep=',')
pricets = zoo(myd$price, as.Date(as.character(myd$date),
format=c("%m/%d/%Y")))
#log return time series
rets = log(pricets/lag(pricets, -1))
# strip off the dates and just create a simple numeric object
ret = coredata(rets);
#compute statistics
library(fBasics)
basicStats(rets)
#HISTOGRAM
par(mfcol=c(1,2))
hist(rets, xlab="Weekly Returns", prob=TRUE,
main="Histogram")
#Add approximating normal density curve
xfit<-
seq(min(rets,na.rm=TRUE),max(rets,na.rm=TRUE),length=40)
yfit<-
dnorm(xfit,mean=mean(rets,na.rm=TRUE),sd=sd(rets,na.rm=TR
UE))
lines(xfit, yfit, col="blue", lwd=2)
#CREATE NORMAL PROBABILITY PLOT
qqnorm(rets)
qqline(rets, col = 'red', lwd=2)
# creates time plot of log returns
par(mfrow=c(1,1))
plot(rets)
#Perform Jarque-Bera normality test.
normalTest(rets,method=c('jb'))
#SKEWNESS TEST
skew_test=skewness(rets)/sqrt(6/length(rets))
skew_test
print("P-value = ")
2*(1-pnorm(abs(skew_test)))
#FAT-TAIL TEST
k_stat = kurtosis(rets)/sqrt(24/length(rets))
print("Kurtosis test statistic")
k_stat
print("P-value = ")
2*(1-pnorm(abs(k_stat)))
#COMPUTE DICKEY-FULLER TEST
library(fUnitRoots)
adfTest(rets, lags=7, type=c("c"))
# Computes Ljung-Box test on squared returns to test non-linear
independence at lag 6 and 12
Box.test(coredata(rets^2),lag=6,type='Ljung')
Box.test(coredata(rets^2),lag=12,type='Ljung')
Box.test(coredata(rets^2),lag=18,type='Ljung')
# Computes Ljung-Box test on absolute returns to test non-
linear independence at lag 6 and 12
Box.test(abs(coredata(rets)),lag=6,type='Ljung')
Box.test(abs(coredata(rets)),lag=12,type='Ljung')
Box.test(abs(coredata(rets)),lag=18,type='Ljung')
# Plots ACF function of vector data
par(mfrow=c(3,1))
acf(ret)
# Plot ACF of squared returns to check for ARCH effect
acf(ret^2)
# Plot ACF of absolute returns to check for ARCH effect
acf(abs(ret))
#plot returns, square returns and abs(returns)
# Plots ACF function of vector data
par(mfrow=c(3,1))
plot(rets, type='l')
# Plot ACF of squared returns to check for ARCH effect
plot(rets^2,type='l')
# Plot ACF of absolute returns to check for ARCH effect
plot(abs(rets),type='l')
par(mfrow=c(1,1))
# plots PACF of squared returns to identify order of AR model
pacf(coredata(rets),lag=30)
#GARCH Models
library(rugarch)
#Fit AR(0,0)-GARCH(1,1) model
garch11.spec=ugarchspec(variance.model=list(garchOrder=c(1,1
)), mean.model=list(armaOrder=c(0,0)),distribution.model =
"std")
#estimate model
garch11.fit=ugarchfit(spec=garch11.spec, data=rets)
garch11.fit
#Fit AR(0,0)-eGARCH(1,1) model with Gaussian distribution
egarch11.spec=ugarchspec(variance.model=list(model =
"eGARCH",garchOrder=c(1,1)),
mean.model=list(armaOrder=c(0,0)))
#estimate model
egarch11.fit=ugarchfit(spec=egarch11.spec, data=rets)
egarch11.fit
#Fit AR(0,0)-TGARCH(1,1) model with norm-distribution
gjrgarch11.spec=ugarchspec(variance.model=list(model =
"gjrGARCH",garchOrder=c(2,1)),
mean.model=list(armaOrder=c(0,0)), distribution.model =
"norm")
#estimate model
gjrgarch11.fit=ugarchfit(spec=gjrgarch11.spec, data=rets)
gjrgarch11.fit
# compare information criteria
model.list = list(garch11 = garch11.fit,
egarch11 = egarch11.fit,
gjrgarch11 = gjrgarch11.fit)
info.mat = sapply(model.list, infocriteria)
rownames(info.mat) = rownames(infocriteria(garch11.fit))
info.mat
# RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE
OBSERVATIONS FOR FORECAST
# EVALUATION STATISTICS
garch11.fit = ugarchfit(spec=garch11.spec, data=rets,
out.sample=100)
egarch11.fit = ugarchfit(egarch11.spec, data=rets,
out.sample=100)
tgarch11.fit = ugarchfit(spec=gjrgarch11.spec, data=rets,
out.sample=100)
garch11.fcst = ugarchforecast(garch11.fit, n.roll=100,
n.ahead=1)
egarch11.fcst = ugarchforecast(egarch11.fit, n.roll=100,
n.ahead=1)
tgarch11.fcst = ugarchforecast(tgarch11.fit, n.roll=100,
n.ahead=1)
fcst.list = list(garch11=garch11.fcst,
egarch11=egarch11.fcst,
tgarch21=tgarch11.fcst)
fpm.mat = sapply(fcst.list, fpm)
fpm.mat
CSC425 – Time series analysis and forecasting
Homework 5 – not be submitted
The goal of this assignment is to provide students with some
practical training on
GARCH/EGARCH/TGARCH models for the analysis of the
volatility of a stock return.
Solution
s will be posted on Thursday November 7th 2013
Reading assignment:
1. Read Chapter 4 in short book and Chapter 3 in long book on
volatility models
2. Review course documents posted under week 7 and 8.
Problem
Use the datafile nordstrom_w_00_13.csv that contains the
Nordstrom (JWN ) stock weekly prices
from January 2000 to October 2013. The data file contains
dates (date), daily prices (price). You
can also use the code and the analysis of the S&P500 returns
used in week 7 and 8 lectures as
your reference for the analysis of this data. Analyze the
Nordstrom stock log returns following
the steps below.
1. Compute log returns, and analyze their time plot.
Moments
N 693 Sum Weights
693
Mean 0.00268299 Sum Observations
1.85931229
Std Deviation 0.06068019 Variance
0.00368209
Skewness -0.2804891 Kurtosis
7.55351876
Uncorrected SS 2.55299156 Corrected SS
2.54800304
Coeff Variation 2261.66262 Std Error Mean
0.00230505
Time plot of returns show that Nordstrom stock returns shows
periods of high volatility at
various times, and consistently high volatility from 2007 to
2010. Most returns are
between +/- 10%. Sample moments show that distribution of log
returns is somewhat
symmetric with very fat tails (kurtosis = 7.55).
return
-0.5
-0.4
-0.3
-0.2
-0.1
0.0
0.1
0.2
0.3
0.4
date
01/01/2000 01/01/2002 01/01/2004 01/01/2006 01/01/2008
01/01/2010 01/01/2012 01/01/2014 01/01/2016
2. Is there evidence of serial correlations in the log returns? Use
autocorrelations and 5%
significance level to answer the question.
Log returns are not serially correlated as shown by the Ljung-
Box test with p-values >
0.05 and the autocorrelation plot. .
Name of Variable = return
Mean of Working Series 0.002683
Standard Deviation 0.060636
Number of Observations 693
Autocorrelation Check for White Noise
To Chi- Pr >
Lag Square DF ChiSq --------------------
Autocorrelations--------------------
6 6.16 6 0.4050 -0.009 0.011 -0.048 -0.009
0.078 -0.006
12 9.08 12 0.6957 -0.042 -0.038 -0.019 0.011
-0.015 0.016
18 26.17 18 0.0960 0.033 -0.026 0.088 -0.032
0.101 -0.056
24 31.58 24 0.1377 0.029 -0.037 0.025 -0.042
-0.026 -0.048
30 33.84 30 0.2871 -0.029 -0.003 -0.037 0.023
0.011 -0.016
3. Is there evidence of ARCH effects in the log returns? Use
appropriate tests at 5%
significance level to answer this question.
The analysis below shows a strong ARCH effect. The squared
returns are strongly
correlated. The Ljung-Box tests on squared residuals are highly
significant with p-values
< 0.001, and autocorrelation plots shows large autocorrelations
for the first 10 lags.
Name of Variable = returnsq
Mean of Working Series 0.003684
Standard Deviation 0.011302
Number of Observations 693
Autocorrelation Check for White Noise
To Chi- Pr >
Lag Square DF ChiSq --------------------
Autocorrelations--------------------
6 331.56 6 <.0001 0.534 0.281 0.123 0.101
0.167 0.240
12 407.05 12 <.0001 0.246 0.187 0.053 0.036
0.032 0.082
18 469.70 18 <.0001 0.069 0.072 0.128 0.127
0.156 0.145
24 494.90 24 <.0001 0.149 0.090 0.050 0.035
0.014 0.031
30 501.01 30 <.0001 0.033 0.064 0.051 0.023
0.010 -0.004
4. Fit an GARCH(1,1) model for the log returns using a t-
distribution for the error terms.
Perform model checking (analyze if residuals are white noise, if
squared residuals are
white noise, and check if t-distribution is a good fit for the
data) and write down the fitted
model.
The GARCH model with t-distribution is an adequate model for
the volatility of the
returns. All parameters are significant and the squared residuals
are white noise (LB
tests on squared residuals are non significant).
Fitted GARCH model can be expressed as follows:
rt=0.005 +at
at=σtet with σt
2
=0.1483 a
2
t-1+0.836 σ
2
t-1
(Intercept ARCH0 can be considered equal to zero)
Where error term et has t-distribution with 1/0.185=5 degrees
of freedom.
The AUTOREG Procedure
GARCH Estimates
SSE 2.55069233 Observations
693
MSE 0.00368 Uncond Var
0.00531549
Log Likelihood 1102.73026 Total R-Square
.
SBC -2172.7554 AIC -
2195.4605
MAE 0.04086373 AICC -
2195.3732
MAPE 113.334007 HQC -
2186.6796
Normality Test 126.0152
Pr > ChiSq <.0001
Parameter Estimates
Standard Approx
Variable DF Estimate Error t Value Pr >
|t|
Intercept 1 0.004653 0.001570 2.96
0.0030
ARCH0 1 0.0000848 0.0000429 1.98
0.0482
ARCH1 1 0.1483 0.0369 4.01
<.0001
GARCH1 1 0.8358 0.0359 23.30
<.0001
TDFI 1 0.1851 0.0448 4.14 <.0001
Inverse of t DF
R output
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.004729 0.001465 3.2281 0.001246
omega 0.000086 0.000050 1.7302 0.083590
alpha1 0.145749 0.052318 2.7858 0.005340
beta1 0.836471 0.051967 16.0962 0.000000
shape 5.345569 1.009241 5.2966 0.000000
5. Fit and EGARCH(1,1) model for the NDX log returns using a
normal distribution for the
error terms. Perform model checking and write down the fitted
model.
The EGARCH model is adequate although the Gaussian
distribution on the error terms is
not sufficient to describe most extreme events. No ARCH
effects are shown in residuals.
The leverage parameter “theta” is significant showing that
volatility of Nordstrom stock
returns is affected more heavily by negative shocks.
The fitted model can be written as follows:
rt=0.0012 +at
at=σtet with ln σt
2
=-0.194+0.213 g(et-1) +0.996 ln σ
2
t-1
g(et-1)= -0.47et-1+[|et-1|-E(et-1)]
The AUTOREG Procedure
Exponential GARCH Estimates
SSE 2.54945444 Observations
693
MSE 0.00368 Uncond Var
.
Log Likelihood 1093.55049 Total R-Square
.
stres
-7
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
quantiles
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
t-distribution QQplot for residuals of GARCH model
SBC -2154.3958 AIC -
2177.101
MAE 0.04095052 AICC -
2177.0136
MAPE 101.222881 HQC -
2168.32
Normality Test 71.9939
Pr > ChiSq <.0001
Parameter Estimates
Standard Approx
Variable DF Estimate Error t Value
Pr > |t|
Intercept 1 0.001236 0.001752 0.71
0.4806
EARCH0 1 -0.1940 0.0636 -3.05
0.0023
EARCH1 1 0.2133 0.0316 6.75
<.0001
EGARCH1 1 0.9662 0.0106 91.41
<.0001
THETA 1 -0.4748 0.1121 -4.23
<.0001
R output
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.001271 0.001774 0.71655 0.473654
omega -0.169047 0.110169 -1.53443 0.124924
alpha1 -0.095670 0.035615 -2.68620 0.007227
beta1 0.970507 0.018820 51.56682 0.000000
gamma1 0.194542 0.059579 3.26526 0.001094
In R model is written as
rt=0.0012 +at
at=σtet with ln σt
2
=-0.169-0.095( et-1 +0.194(|et-1|-E(et-1))+0.970 ln σ
2
t-1
where error term has t-distribution with 6 degrees of freedom.
Note that the leverage coefficients of et-1 in SAS and R are
equivalent.
6. Fit and EGARCH(1,1) model for the Nordstrom log returns
using a t- distribution for the
error terms. Perform model checking and write down the fitted
model.
The EGARCH model t-distributed errors is a good model for the
data. No ARCH effects
are shown in residuals. The leverage parameter “theta” is
significant and negative
showing that volatility of Nordstrom stock returns is affected
more heavily by negative
shocks.
The fitted model can be written as follows:
rt=0.0032 +at
at=σtet with ln σt
2
=-0.191+0.158 g(et-1) +0.974 ln σ
2
t-1
g(et-1)= -0.55et-1+[|et-1|-E(et-1)]
et has t-distribution with 6 degrees of freedom.
The MODEL Procedure
Nonlinear Liklhood Summary of Residual
Errors
DF DF Adj
Equation Model Error SSE MSE Root MSE
R-Square R-Sq
7 686 2.5482 0.00371 0.0609 -0.0001
-0.0088
nresid.y 686 1028.4 1.4991 1.2244
Nonlinear Liklhood Parameter Estimates
Approx Approx
Parameter Estimate Std Err t Value Pr
> |t|
intercept 0.003273 0.00160 2.05
0.0410
earch0 -0.19123 0.0932 -2.05
0.0405
earch1 0.158378 0.0490 3.23
0.0013
egarch1 0.974881 0.0139 70.01
<.0001
theta -0.55013 0.1969 -2.79
0.0053
df 5.993367 1.3083 4.58 <.0001
R output
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.003374 0.001552 2.1743 0.029681
omega -0.137932 0.098212 -1.4044 0.160191
alpha1 -0.104435 0.034086 -3.0638 0.002185
beta1 0.977603 0.016446 59.4433 0.000000
gamma1 0.180592 0.075474 2.3928 0.016722
shape 5.783774 1.169335 4.9462 0.000001
In R model is written as
rt=0.0033 +at
at=σtet with ln σt
2
=-0.138-0.104( et-1 +0.180(|et-1|-E(et-1))+0.978 ln σ
2
t-1
where error term has t-distribution with 6 degrees of freedom.
Note that the leverage coefficients of et-1 in SAS and R are
equivalent.
Name of Variable = resid2
Mean of Working Series 1.483942
Standard Deviation 2.819517
Number of Observations 693
Autocorrelation Check for White Noise
To Chi- Pr >
Lag Square DF ChiSq --------------------
Autocorrelations--------------------
6 5.11 6 0.5299 0.026 0.020 -0.044 -0.061
0.024 -0.004
12 13.61 12 0.3261 0.025 0.088 0.014 -0.041
0.017 -0.039
18 19.28 18 0.3748 0.043 -0.032 -0.038 -0.028
-0.049 0.020
24 23.55 24 0.4873 0.004 0.028 -0.025 -0.051
-0.039 -0.021
7. Find a GJK-TGARCH(1,1) model for the Nordstrom log
returns using a t-distribution for
the innovations. Perform model checking and write down the
fitted model.
Similar to the AR(0)- EGARCH(1,1) model, the AR(0)-
GJR(1,1) model is also a good
model for the data. No ARCH effects are shown in residuals.
The leverage parameter is
significant and positive showing that volatility of Nordstrom
stock returns is affected
more heavily by negative shocks.
The fitted model can be written as follows:
rt=0.0036 +at
at=σtet with σt
2
=(0.034 +0.13Nt-1)a
2
t-1 +0.800 σ
2
t-1
with Nt-1 = 1 if at-1<0, and Nt-1 = 0 if at-1>0
et has t-distribution with 5 degrees of freedom.
The MODEL Procedure
Nonlinear Liklhood Parameter Estimates
Approx Approx
Parameter Estimate Std Err t Value Pr
> |t|
intercept 0.003589 0.00157 2.28
0.0226
df 5.028263 0.9762 5.15
<.0001
arch0 0.000095 0.000044 2.18
0.0297
arch1 0.034154 0.0259 1.32
0.1869
garch1 0.800444 0.0584 13.71
<.0001
gamma 0.129939 0.0496 2.62
0.0090
R output
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.003880 0.001519 2.5535 0.010665
omega 0.000083 0.000053 1.5798 0.114152
alpha1 0.039211 0.032406 1.2100 0.226283
beta1 0.858372 0.058370 14.7058 0.000000
gamma1 0.153341 0.074560 2.0566 0.039723
shape 5.767186 1.177356 4.8984 0.000001
The fitted model can be written as follows:
rt=0.0039 +at
at=σtet with σt
2
=(0.039 +0.15Nt-1)a
2
t-1 +0.858 σ
2
t-1
with Nt-1 = 1 if at-1<0, and Nt-1 = 0 if at-1>0
et has t-distribution with 6 degrees of freedom.
8. Is the leverage effect significant at the 5% level?
The leverage parameters in both the EGARCH and the GJR
models are significant, and
have values that indicate that volatility react more heavily to
negative shocks.
9. What model provides the best fit for the data? Explain.
Since the leverage parameters in the AR(0)-EGARCH(1,1) and
AR(0) – GJR(1,1) models
are significant, and residuals are white noise with no ARCH
effect, we can conclude that
both models provide a good explanation of the volatility
behavior for Nordstrom stock
returns. Either models can be chosen, there is no clear winner.
(Note that in SAS, PROC
MODEL does not compute BIC criterion – backtesting can be
used to compare models.)
In R the egarch(1,1) and the GJR-GARCH(1,1) models have
very similar BIC values-
garch11.t egarch11 gjrgarch11
Akaike -3.172122 -3.186143 -3.183976
Bayes -3.139358 -3.146827 -3.144660
10. Use the selected model to compute up to 5 step-ahead
forecasts of the simple returns and
its volatility.
The following predictions are based on the AR(0)-
EGARCH(1,1) model. sigma is the
predicted conditional standard deviation or volatility, and series
is the predicted return
(note that predicted returns are the sample mean returns since
returns are white noise)
R output for forecasts
sigma series
2013-10-29 0.02732 0.003374
2013-10-30 0.02764 0.003374
2013-10-31 0.02796 0.003374
2013-11-01 0.02827 0.003374
2013-11-04 0.02858 0.003374
SAS code
*import data from file;
proc import datafile='nordstrom_w_00_13.csv' out=myd
replace;
resid
-7
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
quantiles
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
t-distribution QQplot of residuals for GJRGARCH model
S&P500 analysis
Fitting an AR(1)-GARCH(1,1) model with Gaussian errors
> # Fitting a ARMA(0,0)-GARCH(1,1) model using the rugarch
package
> # log returns show weak serial autocorrelations in the mean
and an ARCH
effect
> # Fitting an GARCH(1,1) model
> # Use ugarchspec() function to specify model
>
garch11.spec=ugarchspec(variance.model=list(garchOrder=c(1,1
)),
mean.model=list(armaOrder=c(0,0)))
> #estimate model
> garch11.fit=ugarchfit(spec=garch11.spec, data=ret)
> garch11.fit
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : norm
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
mu 0.006814 0.001798 3.7889 0.000151
omega 0.000090 0.000049 1.8302 0.067224
alpha1 0.118390 0.031384 3.7723 0.000162
beta1 0.844396 0.034387 24.5556 0.000000
The fitted ARMA(0,0)-GARCH(1,1) model with Gaussian errors
can be written as
222
8444.01184.000009.0
0068.0
tttttt
tt
aea
ar
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.006814 0.001914 3.5592 0.000372
omega 0.000090 0.000070 1.2858 0.198502
alpha1 0.118390 0.041165 2.8760 0.004028
beta1 0.844396 0.040113 21.0503 0.000000
LogLikelihood : 828.5681
Information Criteria
------------------------------------
Akaike -3.4286
Bayes -3.3938
Shibata -3.4287
Hannan-Quinn -3.4149
Q-Statistics on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 0.5261 0.4682
Lag[p+q+1][1] 0.5261 0.4682
Lag[p+q+5][5] 5.9001 0.3161
d.o.f=0
H0 : No serial correlation
Q-Statistics on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.2657 0.6062
Lag[p+q+1][3] 0.8252 0.3637
Lag[p+q+5][7] 3.0889 0.6863
d.o.f=2
ARCH LM Tests
------------------------------------
Statistic DoF P-Value
ARCH Lag[2] 0.5084 2 0.7755
ARCH Lag[5] 0.9231 5 0.9685
ARCH Lag[10] 6.3220 10 0.7875
Nyblom stability test
------------------------------------
Joint Statistic: 1.3254
Individual Statistics:
mu 0.07929
omega 0.20176
alpha1 0.02459
beta1 0.09300
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.07 1.24 1.6
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 2.1382 0.0330120 **
Negative Sign Bias 0.5723 0.5673614
Positive Sign Bias 1.3403 0.1807809
Joint Effect 17.4223 0.0005786 ***
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 43.12 0.0012496
2 30 53.82 0.0033902
3 40 75.76 0.0003804
4 50 79.60 0.0037117
Ljung-Box test for serial correlation
computed on residuals, and Ljung-
Box test for ARCH/GARCH effect
computed on squared residuals.
Goodness of fit test for distribution of error
term. The null hypothesis states that the
distribution for the error terms in the model
is adequate. Thus a small p-value < α,
indicates that null hypothesis can be
rejected and the distribution assumption is
not adequate.
> #create selection list of plots for garch(1,1) fit
> plot(garch11.fit)
> #to display all subplots on one page
> plot(garch11.fit, which="all")
Residual analysis of GARCH model shows that the model fits
the data adequately. Ljung Box test (Q-statistic) on
residuals is not significant, showing that hypothesis of no
correlation for residuals cannot be rejected. Similarly the
Ljung Box test (Q-statistic) on the squared standardized
residuals is not significant suggesting that residuals show
no ARCH/GARCH effect. The Adjusted Pearson goodness of fit
test is significant indicating that the normal
distribution assumed for the error term is not appropriate, as
also shown by the QQ plot of the residuals.
Fitting an AR(1)-GARCH(1,1) model with t-distributed errors
Elapsed time : 0.260026
> plot(garch11.fit, which="all")
Error in plot.new() : figure margins too large
> # use Student-t innovations
> #specify model using functions in rugarch package
> #Fit ARMA(0,0)-GARCH(1,1) model with t-distribution
>
garch11.t.spec=ugarchspec(variance.model=list(garchOrder=c(1
,1)),
mean.model=list(armaOrder=c(0,0)), distribution.model = "std")
> #estimate model
> garch11.t.fit=ugarchfit(spec=garch11.t.spec, data=ret)
> garch11.t.fit
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : sGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
mu 0.008012 0.001746 4.5892 0.000004
omega 0.000122 0.000068 1.7901 0.073444
alpha1 0.123683 0.038919 3.1780 0.001483
beta1 0.821471 0.050706 16.2008 0.000000
shape 6.891814 1.978494 3.4834 0.000495
The fitted ARMA(0,0)-GARCH(1,1) model with Gaussian errors
can be written as
222
8215.01237.000012.0
0080.0
tttttt
tt
aea
ar
Error term {et} has t-distribution with 7 degrees of freedom
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.008012 0.001817 4.4090 0.000010
omega 0.000122 0.000071 1.7216 0.085136
alpha1 0.123683 0.038112 3.2453 0.001173
beta1 0.821471 0.041476 19.8061 0.000000
shape 6.891814 1.976630 3.4866 0.000489
LogLikelihood : 839.2684
Information Criteria
------------------------------------
Akaike -3.4689
Bayes -3.4255
Shibata -3.4691
Hannan-Quinn -3.4518
Q-Statistics on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 0.4662 0.4947
Lag[p+q+1][1] 0.4662 0.4947
Lag[p+q+5][5] 5.6618 0.3405
d.o.f=0
H0 : No serial correlation
Q-Statistics on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.2474 0.6189
Lag[p+q+1][3] 0.8569 0.3546
Lag[p+q+5][7] 2.9570 0.7066
d.o.f=2
ARCH LM Tests
------------------------------------
Statistic DoF P-Value
ARCH Lag[2] 0.5959 2 0.7423
ARCH Lag[5] 0.9740 5 0.9646
ARCH Lag[10] 6.0871 10 0.8079
Nyblom stability test
------------------------------------
Joint Statistic: 1.396
Individual Statistics:
mu 0.17184
omega 0.23451
alpha1 0.04303
beta1 0.10209
shape 0.07244
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.28 1.47 1.88
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 2.121 0.0343991 **
Negative Sign Bias 0.549 0.5832924
Positive Sign Bias 1.206 0.2284569
Joint Effect 16.352 0.0009603 ***
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 22.66 0.25269
2 30 44.47 0.03312
3 40 39.50 0.44759
4 50 43.64 0.68967
Residual analysis of GARCH model with t-distributed error
terms shows that the model fits the data adequately.
Ljung Box test (Q-statistic) on residuals is not significant,
showing that hypothesis of no correlation for residuals
cannot be rejected. Similarly the Ljung Box test (Q-statistic) on
the squared standardized residuals is not significant
suggesting that residuals show no ARCH/GARCH effect. The
Adjusted Pearson goodness of fit test is not significant
indicating that the distribution of the error terms can be
described by a t-distribution with 7 degrees of freedom,
as also shown by the QQ plot of the residuals (created using
plot(garch11.t.fit, which=9).
Fitting an ARMA(0,0)-EGARCH(1,1) model
The EGARCH model fitted by the rugarch package has a
slightly different form than the model in the textbook.
Here is the general expression of the EGARCH(1,1) model:
)ln(|))(||(|()ln(
,
2
1111111
2
ttttt
tttttt
eEee
eaar
where µt can follow an ARMA process, but most typically it
will be constant. Gamma1 (γ1) is the leverage
parameter. So if gamma1 in output is significant, then we can
conclude that the volatility process has an
asymmetric behavior.
Fitting an ARMA(0,0)-EGARCH(1,1) model with Gaussian
distribution (similar to SAS example)
> #Fit ARMA(0,0)-eGARCH(1,1) model with Gaussian
distribution
> egarch11.spec=ugarchspec(variance.model=list(model =
"eGARCH",
garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)))
> #estimate model
> egarch11.fit=ugarchfit(spec=egarch11.spec, data=ret)
> egarch11.fit
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : eGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : norm
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
mu 0.005937 0.001860 3.1915 0.001415
omega -0.610497 0.263901 -2.3134 0.020703
alpha1 -0.111069 0.042614 -2.6064 0.009150
beta1 0.902462 0.041695 21.6442 0.000000
gamma1 0.209405 0.050542 4.1432 0.000034
Using the R output above, the ARMA(0,0)-EGARCH(1,1) model
can be written as follows.
Fitted model:
rt = 0.0059 + at, at=σtet
ln(σ2t) = -0.610 + (-0.111 et-1 + 0.209(|et-1| - E(|et-1|)) +
0.9024 ln(σ
2
t-1)
Note that since et has Gaussian distribution, the
E(|et|)=sqrt(2/pi) = 0.7979 or approx 0.80 (see page 143 in
textbook). Thus we can rewrite the expression above as
07979.0209.0209.0111.0
07979.0209.0209.0111.0
)ln(9024.0610.0)ln(
111
1112
1
2
ttt
ttt
tt
eifee
eifee
And after some algebra, we can write:
0320.0
0098.0
)ln(9024.07767.0)ln(
11
112
1
2
tt
tt
tt
eife
eife
Taking the antilog transformation we have
0)320.0exp(
0)098.0exp(
)7767.0exp(
11
119024.02
1
2
tt
ttx
tt
eife
eife
For a standardized shock with magnitude 2, (i.e. two standard
deviations), we have
56.1
)2098.0exp(
))2(320.0exp(
)2(
)2(
1
2
1
2
tt
tt
e
e
Therefore, the impact of negative shock of size two-standard
deviations is about 56% higher than the impact of a
positive shock of the same size.
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.005937 0.001958 3.0328 0.002423
omega -0.610497 0.364615 -1.6744 0.094060
alpha1 -0.111069 0.066343 -1.6742 0.094096
beta1 0.902462 0.057336 15.7400 0.000000
gamma1 0.209405 0.048127 4.3511 0.000014
LogLikelihood : 835.9936
Information Criteria
------------------------------------
Akaike -3.4553
Bayes -3.4119
Shibata -3.4555
Hannan-Quinn -3.4382
Q-Statistics on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 0.3351 0.5627
Lag[p+q+1][1] 0.3351 0.5627
Lag[p+q+5][5] 5.1570 0.3970
d.o.f=0
H0 : No serial correlation
Q-Statistics on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.7262 0.3941
Lag[p+q+1][3] 1.0203 0.3124
Lag[p+q+5][7] 2.8738 0.7194
d.o.f=2
ARCH LM Tests
------------------------------------
Statistic DoF P-Value
ARCH Lag[2] 1.018 2 0.6010
ARCH Lag[5] 1.165 5 0.9482
ARCH Lag[10] 6.026 10 0.8131
Nyblom stability test
------------------------------------
Joint Statistic: 1.5861
Individual Statistics:
mu 0.1829
omega 0.1224
alpha1 0.1527
beta1 0.1301
gamma1 1.0125
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.28 1.47 1.88
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 1.973 0.04902 **
Negative Sign Bias 1.165 0.24478
Positive Sign Bias 1.041 0.29840
Joint Effect 11.259 0.01041 **
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 22.49 0.2604
2 30 35.86 0.1777
3 40 50.31 0.1060
4 50 55.07 0.2558
Residual analysis of EGARCH model shows that the model fits
the data adequately – residuals are white noise and
show no ARCH effect. The goodness of fit test supports the
choice of a Gaussian distribution for the error term.
Although the qqplot shows that the error distribution has thicker
left tail than the normal distribution. We will fit
the t-distribution to check if that’s a better fit for the behavior
of extreme values.
Fitting an ARMA(0,0)-EGARCH(1,1) model with t-distribution
> #Fit ARMA(0,0)-eGARCH(1,1) model with t-distribution
> egarch11.t.spec=ugarchspec(variance.model=list(model =
"eGARCH",
garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)),
distribution.model = "std")
> #estimate model
> egarch11.t.fit=ugarchfit(spec=egarch11.t.spec, data=ret)
> egarch11.t.fit
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : eGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
mu 0.007093 0.001757 4.0369 0.000054
omega -0.677075 0.246000 -2.7523 0.005917
alpha1 -0.145367 0.045752 -3.1773 0.001487
beta1 0.893975 0.038715 23.0912 0.000000
gamma1 0.202717 0.055934 3.6242 0.000290
shape 7.926664 2.405188 3.2957 0.000982
Using the R output above, the ARMA(0,0)-EGARCH(1,1) model
can be written as follows.
Fitted model:
rt = 0.007 + at, at=σtet
ln(σ2t) = -0.677 + (-0.145 et-1 + 0.203(|et-1| - E(|et-1|)) + 0.894
ln(σ
2
t-1)
with t-distribution with 8 degrees of freedom (nearest integer to
shape value)
Note that since et has t-distribution, the E(|et|)=
)2/()1(
]2/)1[(22
-
distribution (denoted by shape in R output).
Note that since gamma1 is significant, the volatility has an
asymmetric behavior. Therefore a negative shock has a
stronger impact on the volatility compared to a positive shock
of the same size.
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.007093 0.001888 3.7574 0.000172
omega -0.677075 0.212770 -3.1822 0.001462
alpha1 -0.145367 0.042936 -3.3857 0.000710
beta1 0.893975 0.034112 26.2071 0.000000
gamma1 0.202717 0.045692 4.4366 0.000009
shape 7.926664 2.720128 2.9141 0.003567
LogLikelihood : 846.92
Information Criteria
------------------------------------
Akaike -3.4965
Bayes -3.4445
Shibata -3.4969
Hannan-Quinn -3.4761
Q-Statistics on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 0.1872 0.6653
Lag[p+q+1][1] 0.1872 0.6653
Lag[p+q+5][5] 4.7776 0.4436
d.o.f=0
H0 : No serial correlation
Q-Statistics on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.6769 0.4107
Lag[p+q+1][3] 0.9526 0.3291
Lag[p+q+5][7] 2.5747 0.7652
d.o.f=2
ARCH LM Tests
------------------------------------
Statistic DoF P-Value
ARCH Lag[2] 0.9725 2 0.6149
ARCH Lag[5] 1.0934 5 0.9547
ARCH Lag[10] 5.4934 10 0.8559
Nyblom stability test
------------------------------------
Joint Statistic: 1.6436
Individual Statistics:
mu 0.20752
omega 0.12081
alpha1 0.15261
beta1 0.13304
gamma1 0.93741
shape 0.08736
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.49 1.68 2.12
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 1.7639 0.07840 *
Negative Sign Bias 1.2413 0.21510
Positive Sign Bias 0.9747 0.33022
Joint Effect 8.8291 0.03165 **
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 20.66 0.35571
2 30 39.23 0.09736
3 40 54.47 0.05098
4 50 66.51 0.04860
Residual analysis of EGARCH model shows that the model fits
the data adequately – residuals are white noise and
show no ARCH effect. However the goodness of fit test shows
that the t-distribution is not a good choice for the
error terms (test p-values are small and rejects the null
hypothesis of error term having a t-distribution. The qqplot
shows that the error distribution has thicker tails than the t-
distribution. (Further analysis shows that the ged
distribution does a better job representing the extreme values
distribution)
Fitting an ARMA(0,0)-GJRGARCH(1,1) model or TGARCH
model
The GJRGARCH(1,1) model fitted by the rugarch package has
the following expression
)ln()()ln(
,
2
11
2
1111
2
tttt
tttttt
aN
eaar
where µt can follow an ARMA process, but most typically it
will be constant. Nt-1 is the indicator variable s.t.
Nt-1= 1 when at-1 (shock at time t-1) is negative, and Nt-1 = 0
otherwise. Gamma1 (γ1) is the leverage parameter. So
if gamma1 in output is significant, then we can conclude that
the volatility process has an asymmetric behavior.
> #Fit ARMA(0,0)-TGARCH(1,1) model with t-distribution
> gjrgarch11.t.spec=ugarchspec(variance.model=list(model =
"gjrGARCH",
garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)),
distribution.model = "std")
> #estimate model
> gjrgarch11.t.fit=ugarchfit(spec=gjrgarch11.t.spec, data=ret)
Warning message:
In .makefitmodel(garchmodel = "gjrGARCH", f = .gjrgarchLLH,
T = T, :
NaNs produced
> gjrgarch11.t.fit
*---------------------------------*
* GARCH Model Fit *
*---------------------------------*
Conditional Variance Dynamics
-----------------------------------
GARCH Model : gjrGARCH(1,1)
Mean Model : ARFIMA(0,0,0)
Distribution : std
Optimal Parameters
------------------------------------
Estimate Std. Error t value Pr(>|t|)
mu 0.007202 0.001766 4.077739 0.000045
omega 0.000212 0.000094 2.262826 0.023646
alpha1 0.000001 0.001394 0.000791 0.999369
beta1 0.781111 0.065122 11.994488 0.000000
gamma1 0.215386 0.069611 3.094141 0.001974
shape 7.179979 2.031526 3.534279 0.000409
Using the R output above, the ARMA(0,0)-TGARCH(1,1) model
can be written as follows. Note that the arch(1)
coefficient is zero and we remove it from the model.
2
1
2
11
2
781.0)215.00000.0(00021.0
,0072.0
tttt
ttttt
aN
eaar
Where error term is assumed to have t-distribution with 7
degrees of freedom.
or
2
1
2
11
2
781.0215.000021.0
,0072.0
tttt
ttttt
aN
eaar
Where Nt-1 is an indicator variable for negative innovations
such that
00
01
1
1
1
t
t
t
aif
aif
N
For a standardized shock with magnitude 2, (i.e. two standard
deviations), we have
966.1
002.0781.0)002.04()000.0(00021.0
002.0781.0)002.04()215.00000.0(00021.0
)2(
)2(
1
2
1
2
tt
tt
e
e
Where the value for
2
a is computed as
2
1
22
ttt
. Since
2
2
2
Robust Standard Errors:
Estimate Std. Error t value Pr(>|t|)
mu 0.007202 0.001921 3.749767 0.000177
omega 0.000212 0.000112 1.902791 0.057068
alpha1 0.000001 0.000054 0.020238 0.983853
beta1 0.781111 0.063980 12.208691 0.000000
gamma1 0.215386 0.056979 3.780097 0.000157
shape 7.179979 2.274951 3.156102 0.001599
LogLikelihood : 844.6336
Information Criteria
------------------------------------
Akaike -3.4870
Bayes -3.4350
Shibata -3.4873
Hannan-Quinn -3.4666
Q-Statistics on Standardized Residuals
------------------------------------
statistic p-value
Lag[1] 0.1348 0.7135
Lag[p+q+1][1] 0.1348 0.7135
Lag[p+q+5][5] 4.7791 0.4434
d.o.f=0
H0 : No serial correlation
Q-Statistics on Standardized Squared Residuals
------------------------------------
statistic p-value
Lag[1] 0.7412 0.3893
Lag[p+q+1][3] 1.0145 0.3138
Lag[p+q+5][7] 2.5887 0.7631
d.o.f=2
ARCH LM Tests
------------------------------------
Statistic DoF P-Value
ARCH Lag[2] 1.015 2 0.6020
ARCH Lag[5] 1.239 5 0.9411
ARCH Lag[10] 5.120 10 0.8830
Nyblom stability test
------------------------------------
Joint Statistic: 2.2942
Individual Statistics:
mu 0.18155
omega 0.27666
alpha1 0.05641
beta1 0.20413
gamma1 0.03198
shape 0.06486
Asymptotic Critical Values (10% 5% 1%)
Joint Statistic: 1.49 1.68 2.12
Individual Statistic: 0.35 0.47 0.75
Sign Bias Test
------------------------------------
t-value prob sig
Sign Bias 2.117 0.03474 **
Negative Sign Bias 1.408 0.15987
Positive Sign Bias 0.766 0.44408
Joint Effect 10.173 0.01715 **
Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
group statistic p-value(g-1)
1 20 19.83 0.4048
2 30 29.37 0.4457
3 40 37.17 0.5535
4 50 52.78 0.3300
Elapsed time : 0.458046
> plot(gjrgarch11.t.fit, which="all")
Residual analysis of TGARCH model shows that the model fits
the data adequately – residuals are white noise and
show no ARCH effect. The goodness of fit test also shows that
the t-distribution is adequate.
Apply information criteria for model selection
> # MODEL COMPARISON
> # compare information criteria
> model.list = list(garch11 = garch11.fit, garch11.t =
garch11.t.fit,
+ egarch11 = egarch11.t.fit,
+ gjrgarch11 = gjrgarch11.t.fit)
> info.mat = sapply(model.list, infocriteria)
> rownames(info.mat) = rownames(infocriteria(garch11.fit))
> info.mat
garch11 garch11.t egarch11 gjrgarch11
Akaike -3.428558 -3.468892 -3.480644 -3.487042
Bayes -3.393831 -3.425483 -3.428554 -3.434952
Shibata -3.428694 -3.469105 -3.480950 -3.487348
Hannan-Quinn -3.414909 -3.451830 -3.460170 -3.466568
Best model according to model selection criteria is the GJR-
GARCH(1,1) model with t-distribution
R CODE:
# Analysis of daily S&P500 index
#
library(fBasics)
library(tseries)
library(rugarch)
# import data in R
# import libraries for TS analysis
myd= read.table('sp500_feb1970_Feb2010.txt', header=T)
# create time series object •
rts= ts(myd$return, start = c(1970, 1), frequency=12)
# create a simple numeric object
ret =myd$return;
# CREATE TIME PLOT
plot(rts)
# Plots ACF function of vector data
acf(ret)
# Plot ACF of squared data to check for non-linear dependence
acf(ret^2)
# Computes Ljung-Box test on squared returns to test non-linear
independence at lag 6
and 12
Box.test(ret^2,lag=6,type='Ljung')
Box.test(ret^2,lag=12,type='Ljung')
# Computes Ljung-Box test on absolute returns to test non-
linear independence at lag 6
and 12
Box.test(abs(ret),lag=6,type='Ljung')
Box.test(abs(ret),lag=12,type='Ljung')
# FITTING AN GARCH(1,1) MODEL WITH GAUSSIAN
DISTRIBUTION
# Use ugarchspec() function to specify model
garch11.spec=ugarchspec(variance.model=list(garchOrder=c(1,1
)),
mean.model=list(armaOrder=c(0,0)))
#estimate model
garch11.fit=ugarchfit(spec=garch11.spec, data=ret)
garch11.fit
#persistence = alpha1+beta1
persistence(garch11.fit)
#half-life: ln(0.5)/ln(alpha1+beta1)
halflife(garch11.fit)
#create selection list of plots for garch(1,1) fit
plot(garch11.fit)
#to display all subplots on one page
plot(garch11.fit, which="all")
#FIT ARMA(0,0)-GARCH(1,1) MODEL WITH T-
DISTRIBUTION
# specify model using functions in rugarch package
garch11.t.spec=ugarchspec(variance.model=list(garchOrder=c(1
,1)),
mean.model=list(armaOrder=c(0,0)), distribution.model = "std")
#estimate model
garch11.t.fit=ugarchfit(spec=garch11.t.spec, data=ret)
garch11.t.fit
plot(garch11.t.fit)
#FIT ARMA(0,0)-EGARCH(1,1) MODEL WITH GAUSSIAN
DISTRIBUTION
egarch11.spec=ugarchspec(variance.model=list(model =
"eGARCH", garchOrder=c(1,1)),
mean.model=list(armaOrder=c(0,0)))
#estimate model
egarch11.fit=ugarchfit(spec=egarch11.spec, data=ret)
egarch11.fit
plot(egarch11.fit, which="all")
#FIT ARMA(0,0)-EGARCH(1,1) MODEL WITH T-
DISTRIBUTION
egarch11.t.spec=ugarchspec(variance.model=list(model =
"eGARCH", garchOrder=c(1,1)),
mean.model=list(armaOrder=c(0,0)), distribution.model =
"ged")
#estimate model
egarch11.t.fit=ugarchfit(spec=egarch11.t.spec, data=ret)
egarch11.t.fit
plot(egarch11.t.fit, which="all")
# compute expected value E(|e|)
shape=coef(egarch11.t.fit)[6]
exp.abse=(2*sqrt(shape-2)*gamma((shape+1)/2))/((shape-
1)*gamma(shape/2)*sqrt(pi))
#FIT ARMA(0,0)-TGARCH(1,1) MODEL WITH T-
DISTRIBUTION
gjrgarch11.t.spec=ugarchspec(variance.model=list(model =
"gjrGARCH",
garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)),
distribution.model = "std")
#estimate model
gjrgarch11.t.fit=ugarchfit(spec=gjrgarch11.t.spec, data=ret)
gjrgarch11.t.fit
plot(gjrgarch11.t.fit, which="all")
#FIT ARMA(0,0)-IGARCH(1,1) MODEL WITH SKEWED T-
DISTRIBUTION
igarch11.t.spec=ugarchspec(variance.model=list(model =
"iGARCH", garchOrder=c(1,1)),
mean.model=list(armaOrder=c(0,0)), distribution.model = "std")
#estimate model
igarch11.t.fit=ugarchfit(spec=igarch11.t.spec, data=ret)
igarch11.t.fit
plot(igarch11.t.fit, which="all")
# MODEL COMPARISON
# compare information criteria
model.list = list(garch11 = garch11.fit, garch11.t =
garch11.t.fit,
egarch11 = egarch11.t.fit,
gjrgarch11 = gjrgarch11.t.fit)
info.mat = sapply(model.list, infocriteria)
rownames(info.mat) = rownames(infocriteria(garch11.fit))
info.mat
# RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE
OBSERVATIONS FOR FORECAST
# EVALUATION STATISTICS
garch11.fit = ugarchfit(spec=garch11.spec, data=ret,
out.sample=100)
garch11.t.fit = ugarchfit(spec=garch11.t.spec, data=ret,
out.sample=100)
egarch11.t.fit = ugarchfit(egarch11.t.spec, data=ret,
out.sample=100)
tgarch11.t.fit = ugarchfit(spec=gjrgarch11.t.spec, data=ret,
out.sample=100)
# COMPUTE 100 1-STEP AHEAD ROLLING FORECASTS
W/O RE-ESTIMATING
garch11.fcst = ugarchforecast(garch11.fit, n.roll=100,
n.ahead=1)
garch11.t.fcst = ugarchforecast(garch11.t.fit, n.roll=100,
n.ahead=1)
egarch11.t.fcst = ugarchforecast(egarch11.t.fit, n.roll=100,
n.ahead=1)
tgarch11.t.fcst = ugarchforecast(tgarch11.t.fit, n.roll=100,
n.ahead=1)
# COMPUTE FORECAST EVALUATION STATISTICS USING
FPM() FUNCTION
fcst.list = list(garch11=garch11.fcst, garch11.t=garch11.t.fcst,
egarch11.t=egarch11.t.fcst,
tgarch11.t=tgarch11.t.fcst)
fpm.mat = sapply(fcst.list, fpm)
fpm.mat
CSC425 – Time series analysis and forecasting
Homework 4 -

More Related Content

Similar to The average weekly earnings of google shares are $1.005 per share .docx

Cerutti -- TAFA2013
Cerutti -- TAFA2013Cerutti -- TAFA2013
Cerutti -- TAFA2013
Federico Cerutti
 
Dynamic systems project (1)
Dynamic systems project (1)Dynamic systems project (1)
Dynamic systems project (1)
Kshitija Joshi
 
Loops and functions in r
Loops and functions in rLoops and functions in r
Loops and functions in r
manikanta361
 
autocorrelation.pptx
autocorrelation.pptxautocorrelation.pptx
autocorrelation.pptx
PriyadharshanBobby
 
Advanced Statistics Homework Help
Advanced Statistics Homework HelpAdvanced Statistics Homework Help
Advanced Statistics Homework Help
Statistics Homework Helper
 
Polynomials.pdf
Polynomials.pdfPolynomials.pdf
Polynomials.pdf
lordofdankness
 
Chapter 4 a
Chapter 4 aChapter 4 a
Chapter 4 a
Ferawati Faisal
 
Interpreting Logistic Regression.pptx
Interpreting Logistic Regression.pptxInterpreting Logistic Regression.pptx
Interpreting Logistic Regression.pptx
GairuzazmiMGhani
 
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
ShuaiGao3
 
Wang labsummer2010
Wang labsummer2010Wang labsummer2010
Wang labsummer2010
russodl
 
Data analysis on bank data
Data analysis on bank dataData analysis on bank data
Data analysis on bank data
ANISH BHANUSHALI
 
Binary Logistic Regression
Binary Logistic RegressionBinary Logistic Regression
Binary Logistic Regression
Seth Anandaram Jaipuria College
 
Week8 Live Lecture for Final Exam
Week8 Live Lecture for Final ExamWeek8 Live Lecture for Final Exam
Week8 Live Lecture for Final Exam
Brent Heard
 
Predicting US house prices using Multiple Linear Regression in R
Predicting US house prices using Multiple Linear Regression in RPredicting US house prices using Multiple Linear Regression in R
Predicting US house prices using Multiple Linear Regression in R
Sotiris Baratsas
 
Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...
Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...
Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...
Federico Cerutti
 
Sep logic slide
Sep logic slideSep logic slide
Sep logic slide
rainoftime
 
P set5 question_7
P set5 question_7P set5 question_7
P set5 question_7
Kunyu He
 
Week 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docxWeek 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docx
cockekeshia
 
categorical data analysis Chapter 6b.pdf
categorical data analysis Chapter 6b.pdfcategorical data analysis Chapter 6b.pdf
categorical data analysis Chapter 6b.pdf
AbaMacha
 
2014-mo444-practical-assignment-01-paulo_faria
2014-mo444-practical-assignment-01-paulo_faria2014-mo444-practical-assignment-01-paulo_faria
2014-mo444-practical-assignment-01-paulo_faria
Paulo Faria
 

Similar to The average weekly earnings of google shares are $1.005 per share .docx (20)

Cerutti -- TAFA2013
Cerutti -- TAFA2013Cerutti -- TAFA2013
Cerutti -- TAFA2013
 
Dynamic systems project (1)
Dynamic systems project (1)Dynamic systems project (1)
Dynamic systems project (1)
 
Loops and functions in r
Loops and functions in rLoops and functions in r
Loops and functions in r
 
autocorrelation.pptx
autocorrelation.pptxautocorrelation.pptx
autocorrelation.pptx
 
Advanced Statistics Homework Help
Advanced Statistics Homework HelpAdvanced Statistics Homework Help
Advanced Statistics Homework Help
 
Polynomials.pdf
Polynomials.pdfPolynomials.pdf
Polynomials.pdf
 
Chapter 4 a
Chapter 4 aChapter 4 a
Chapter 4 a
 
Interpreting Logistic Regression.pptx
Interpreting Logistic Regression.pptxInterpreting Logistic Regression.pptx
Interpreting Logistic Regression.pptx
 
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
 
Wang labsummer2010
Wang labsummer2010Wang labsummer2010
Wang labsummer2010
 
Data analysis on bank data
Data analysis on bank dataData analysis on bank data
Data analysis on bank data
 
Binary Logistic Regression
Binary Logistic RegressionBinary Logistic Regression
Binary Logistic Regression
 
Week8 Live Lecture for Final Exam
Week8 Live Lecture for Final ExamWeek8 Live Lecture for Final Exam
Week8 Live Lecture for Final Exam
 
Predicting US house prices using Multiple Linear Regression in R
Predicting US house prices using Multiple Linear Regression in RPredicting US house prices using Multiple Linear Regression in R
Predicting US house prices using Multiple Linear Regression in R
 
Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...
Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...
Argumentation Extensions Enumeration as a Constraint Satisfaction Problem: a ...
 
Sep logic slide
Sep logic slideSep logic slide
Sep logic slide
 
P set5 question_7
P set5 question_7P set5 question_7
P set5 question_7
 
Week 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docxWeek 4 Lecture 12 Significance Earlier we discussed co.docx
Week 4 Lecture 12 Significance Earlier we discussed co.docx
 
categorical data analysis Chapter 6b.pdf
categorical data analysis Chapter 6b.pdfcategorical data analysis Chapter 6b.pdf
categorical data analysis Chapter 6b.pdf
 
2014-mo444-practical-assignment-01-paulo_faria
2014-mo444-practical-assignment-01-paulo_faria2014-mo444-practical-assignment-01-paulo_faria
2014-mo444-practical-assignment-01-paulo_faria
 

More from mattinsonjanel

The changes required in the IT project plan for Telecomm Ltd would.docx
The changes required in the IT project plan for Telecomm Ltd would.docxThe changes required in the IT project plan for Telecomm Ltd would.docx
The changes required in the IT project plan for Telecomm Ltd would.docx
mattinsonjanel
 
The Catholic University of America Metropolitan School of .docx
The Catholic University of America Metropolitan School of .docxThe Catholic University of America Metropolitan School of .docx
The Catholic University of America Metropolitan School of .docx
mattinsonjanel
 
The Case of Frank and Judy. During the past few years Frank an.docx
The Case of Frank and Judy. During the past few years Frank an.docxThe Case of Frank and Judy. During the past few years Frank an.docx
The Case of Frank and Judy. During the past few years Frank an.docx
mattinsonjanel
 
The Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docx
The Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docxThe Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docx
The Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docx
mattinsonjanel
 
THE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docx
THE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docxTHE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docx
THE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docx
mattinsonjanel
 
The chart is a guide rather than an absolute – feel free to modify.docx
The chart is a guide rather than an absolute – feel free to modify.docxThe chart is a guide rather than an absolute – feel free to modify.docx
The chart is a guide rather than an absolute – feel free to modify.docx
mattinsonjanel
 
The Challenge of Choosing FoodFor this forum, please read http.docx
The Challenge of Choosing FoodFor this forum, please read http.docxThe Challenge of Choosing FoodFor this forum, please read http.docx
The Challenge of Choosing FoodFor this forum, please read http.docx
mattinsonjanel
 
The Civil Rights Movem.docx
The Civil Rights Movem.docxThe Civil Rights Movem.docx
The Civil Rights Movem.docx
mattinsonjanel
 
The Churchill CentreReturn to Full GraphicsThe Churchi.docx
The Churchill CentreReturn to Full GraphicsThe Churchi.docxThe Churchill CentreReturn to Full GraphicsThe Churchi.docx
The Churchill CentreReturn to Full GraphicsThe Churchi.docx
mattinsonjanel
 
The Categorical Imperative (selections taken from The Foundati.docx
The Categorical Imperative (selections taken from The Foundati.docxThe Categorical Imperative (selections taken from The Foundati.docx
The Categorical Imperative (selections taken from The Foundati.docx
mattinsonjanel
 
The cave represents how we are trained to think, fell or act accor.docx
The cave represents how we are trained to think, fell or act accor.docxThe cave represents how we are trained to think, fell or act accor.docx
The cave represents how we are trained to think, fell or act accor.docx
mattinsonjanel
 
The Case Superior Foods Corporation Faces a ChallengeOn his way.docx
The Case Superior Foods Corporation Faces a ChallengeOn his way.docxThe Case Superior Foods Corporation Faces a ChallengeOn his way.docx
The Case Superior Foods Corporation Faces a ChallengeOn his way.docx
mattinsonjanel
 
The Case You can choose to discuss relativism in view of one .docx
The Case You can choose to discuss relativism in view of one .docxThe Case You can choose to discuss relativism in view of one .docx
The Case You can choose to discuss relativism in view of one .docx
mattinsonjanel
 
The Case Study of Jim, Week Six The body or text (i.e., not rest.docx
The Case Study of Jim, Week Six The body or text (i.e., not rest.docxThe Case Study of Jim, Week Six The body or text (i.e., not rest.docx
The Case Study of Jim, Week Six The body or text (i.e., not rest.docx
mattinsonjanel
 
The Case of Missing Boots Made in ItalyYou can lead a shipper to.docx
The Case of Missing Boots Made in ItalyYou can lead a shipper to.docxThe Case of Missing Boots Made in ItalyYou can lead a shipper to.docx
The Case of Missing Boots Made in ItalyYou can lead a shipper to.docx
mattinsonjanel
 
The Cardiovascular SystemNSCI281 Version 51University of .docx
The Cardiovascular SystemNSCI281 Version 51University of .docxThe Cardiovascular SystemNSCI281 Version 51University of .docx
The Cardiovascular SystemNSCI281 Version 51University of .docx
mattinsonjanel
 
The Cardiovascular SystemNSCI281 Version 55University of .docx
The Cardiovascular SystemNSCI281 Version 55University of .docxThe Cardiovascular SystemNSCI281 Version 55University of .docx
The Cardiovascular SystemNSCI281 Version 55University of .docx
mattinsonjanel
 
The Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docx
The Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docxThe Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docx
The Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docx
mattinsonjanel
 
The British Airways Swipe Card Debacle case study;On Friday, Jul.docx
The British Airways Swipe Card Debacle case study;On Friday, Jul.docxThe British Airways Swipe Card Debacle case study;On Friday, Jul.docx
The British Airways Swipe Card Debacle case study;On Friday, Jul.docx
mattinsonjanel
 
The Case Abstract Accuracy International (AI) is a s.docx
The Case  Abstract  Accuracy International (AI) is a s.docxThe Case  Abstract  Accuracy International (AI) is a s.docx
The Case Abstract Accuracy International (AI) is a s.docx
mattinsonjanel
 

More from mattinsonjanel (20)

The changes required in the IT project plan for Telecomm Ltd would.docx
The changes required in the IT project plan for Telecomm Ltd would.docxThe changes required in the IT project plan for Telecomm Ltd would.docx
The changes required in the IT project plan for Telecomm Ltd would.docx
 
The Catholic University of America Metropolitan School of .docx
The Catholic University of America Metropolitan School of .docxThe Catholic University of America Metropolitan School of .docx
The Catholic University of America Metropolitan School of .docx
 
The Case of Frank and Judy. During the past few years Frank an.docx
The Case of Frank and Judy. During the past few years Frank an.docxThe Case of Frank and Judy. During the past few years Frank an.docx
The Case of Frank and Judy. During the past few years Frank an.docx
 
The Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docx
The Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docxThe Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docx
The Case of MikeChapter 5 • Common Theoretical Counseling Perspe.docx
 
THE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docx
THE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docxTHE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docx
THE CHRONICLE OF HIGHER EDUCATIONNovember 8, 2002 -- vol. 49, .docx
 
The chart is a guide rather than an absolute – feel free to modify.docx
The chart is a guide rather than an absolute – feel free to modify.docxThe chart is a guide rather than an absolute – feel free to modify.docx
The chart is a guide rather than an absolute – feel free to modify.docx
 
The Challenge of Choosing FoodFor this forum, please read http.docx
The Challenge of Choosing FoodFor this forum, please read http.docxThe Challenge of Choosing FoodFor this forum, please read http.docx
The Challenge of Choosing FoodFor this forum, please read http.docx
 
The Civil Rights Movem.docx
The Civil Rights Movem.docxThe Civil Rights Movem.docx
The Civil Rights Movem.docx
 
The Churchill CentreReturn to Full GraphicsThe Churchi.docx
The Churchill CentreReturn to Full GraphicsThe Churchi.docxThe Churchill CentreReturn to Full GraphicsThe Churchi.docx
The Churchill CentreReturn to Full GraphicsThe Churchi.docx
 
The Categorical Imperative (selections taken from The Foundati.docx
The Categorical Imperative (selections taken from The Foundati.docxThe Categorical Imperative (selections taken from The Foundati.docx
The Categorical Imperative (selections taken from The Foundati.docx
 
The cave represents how we are trained to think, fell or act accor.docx
The cave represents how we are trained to think, fell or act accor.docxThe cave represents how we are trained to think, fell or act accor.docx
The cave represents how we are trained to think, fell or act accor.docx
 
The Case Superior Foods Corporation Faces a ChallengeOn his way.docx
The Case Superior Foods Corporation Faces a ChallengeOn his way.docxThe Case Superior Foods Corporation Faces a ChallengeOn his way.docx
The Case Superior Foods Corporation Faces a ChallengeOn his way.docx
 
The Case You can choose to discuss relativism in view of one .docx
The Case You can choose to discuss relativism in view of one .docxThe Case You can choose to discuss relativism in view of one .docx
The Case You can choose to discuss relativism in view of one .docx
 
The Case Study of Jim, Week Six The body or text (i.e., not rest.docx
The Case Study of Jim, Week Six The body or text (i.e., not rest.docxThe Case Study of Jim, Week Six The body or text (i.e., not rest.docx
The Case Study of Jim, Week Six The body or text (i.e., not rest.docx
 
The Case of Missing Boots Made in ItalyYou can lead a shipper to.docx
The Case of Missing Boots Made in ItalyYou can lead a shipper to.docxThe Case of Missing Boots Made in ItalyYou can lead a shipper to.docx
The Case of Missing Boots Made in ItalyYou can lead a shipper to.docx
 
The Cardiovascular SystemNSCI281 Version 51University of .docx
The Cardiovascular SystemNSCI281 Version 51University of .docxThe Cardiovascular SystemNSCI281 Version 51University of .docx
The Cardiovascular SystemNSCI281 Version 51University of .docx
 
The Cardiovascular SystemNSCI281 Version 55University of .docx
The Cardiovascular SystemNSCI281 Version 55University of .docxThe Cardiovascular SystemNSCI281 Version 55University of .docx
The Cardiovascular SystemNSCI281 Version 55University of .docx
 
The Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docx
The Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docxThe Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docx
The Case of Jeff Pedophile in InstitutionJeff is a 35-year-old .docx
 
The British Airways Swipe Card Debacle case study;On Friday, Jul.docx
The British Airways Swipe Card Debacle case study;On Friday, Jul.docxThe British Airways Swipe Card Debacle case study;On Friday, Jul.docx
The British Airways Swipe Card Debacle case study;On Friday, Jul.docx
 
The Case Abstract Accuracy International (AI) is a s.docx
The Case  Abstract  Accuracy International (AI) is a s.docxThe Case  Abstract  Accuracy International (AI) is a s.docx
The Case Abstract Accuracy International (AI) is a s.docx
 

Recently uploaded

HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
Kalna College
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
Kalna College
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
Celine George
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
Kalna College
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
Celine George
 
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxxSimple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
RandolphRadicy
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
Nguyen Thanh Tu Collection
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
lakshayrojroj
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
Kalna College
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
sanamushtaq922
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
TechSoup
 

Recently uploaded (20)

HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
 
220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology220711130097 Tulip Samanta Concept of Information and Communication Technology
220711130097 Tulip Samanta Concept of Information and Communication Technology
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17How to Setup Default Value for a Field in Odoo 17
How to Setup Default Value for a Field in Odoo 17
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
 
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxxSimple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
 

The average weekly earnings of google shares are $1.005 per share .docx

  • 1. The average weekly earnings of google shares are $1.005 per share with a standard deviation of $0.045. The distribution of returns is more or less symmetric but have high peak. Normality test (Jarque Bera Test) rejects hypothesis of normality for earnings data at 5% level. Jarque Bera Test data: returns X-squared = 54.1642, df = 2, p-value = 1.731e-12 The distribution of log(returns) is also not closer to normal distribution, with symmetry close to 0 but kurtosis statistics is 1.5 which is far from normal distribution statistic. The Jarque- Bera test is significant (p-value < 0.05) indicating that hypothesis of normal distribution for log(returns) can be rejected. Jarque Bera Test data: rets X-squared = 49.4632, df = 2, p-value = 1.816e-11 The following plot is time series plot of weekly price of google shares which shows increasing trend. Time series Plot of Google Prices Time plot of returns show that google stock returns shows periods of high volatility at various times. Most returns are between +/- 10%. Sample moments show that distribution of log returns is somewhat symmetric with very thin tails (kurtosis = 1.56). To check null hypothesis of non stationarity: Dickey Fuller Test is expressed as H0: φ1=1 vs Ha: φ1<>1
  • 2. where the null hypothesis indicates unit-root non-stationarity. The Dickey-Fuller test shows that the earnings time series is unit-root stationary. The test p-values for lags 7 is less than 0.05, therefore the null hypothesis of non stationarity can be rejected (small p-values< 0.05). Augmented Dickey-Fuller Test data: rets Dickey-Fuller = -7.1264, Lag order = 7, p-value = 0.01 alternative hypothesis: stationary To check serial correlations in the log returns: Log returns are not serially correlated as shown by the Ljung- Box test with p-values > 0.05 and the autocorrelation plot. Box-Pierce test data: coredata(rets) X-squared = 0.686, df = 1, p-value = 0.4075 To look for evidence of ARCH effects in the log returns: The analysis below shows a strong ARCH effect. The squared returns are strongly correlated. The Ljung-Box tests on squared residuals are highly significant with p-values < 0.005, and autocorrelation plots shows large autocorrelations for the first 15 lags. Box-Pierce test data: coredata(rets^2) X-squared = 8.1483, df = 1, p-value = 0.00431 Plot of PACF: There is no correlation till lag 10 which shows there is no AR lag. To fit an ARMA(0,0)-GARCH(2,1) model for the log returns using a normal- distribution for the error terms: Fitted Model:
  • 3. Residual Analysis: Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 28.78 0.06948 2 30 38.57 0.11019 3 40 46.39 0.19380 4 50 51.15 0.38929 Above output shows that error terms are normally distributed as all the P values are greater than 0.05. To fit ARMA(0,0)-eGARCH(1,1) model with Gaussian distribution: Fitted Model is: Residual Analysis: Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 28.95 0.06673 2 30 27.82 0.52739 3 40 46.91 0.18000 4 50 50.72 0.40546 Above output shows that error terms are normally distributed as all the P values are greater than 0.05. To fit ARMA(0,0)-TGARCH(2,1) model with norm-distribution: Fitted Model: Residual Analysis:
  • 4. Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 18.29 0.5030 2 30 31.28 0.3525 3 40 29.17 0.8742 4 50 51.36 0.3813 Above output shows that error terms are normally distributed as all the P values are greater than 0.05. BEST FIT FOR THE MODEL: garch21 egarch11 gjrgarch21 Akaike -3.436225 -3.451379 -3.463469 Bayes -3.391975 -3.407129 -3.401519 Shibata -3.436449 -3.451603 -3.463905 Hannan-Quinn -3.418814 -3.433968 -3.439094 From above output it can be said that AR(0)-EGARCH(1,1) and AR(0) – GJR(1,1) both have almost equal (smallest) values for all best fit criterion and hence can be considered as best model. Forecast Analysis: RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE OBSERVATIONS FOR FORECAST and EVALUATE STATISTICS for 5 Step Ahead Forecast. Model garch21 egarch11 tgarch21 MSE 0.0009497851 0.0009497741 0.0009499554 MAE 0.0224897000 0.0225260500 0.0225533000
  • 5. DAC 0.6000000000 0.6000000000 0.6000000000 Since MSE is smallest for GJRGARCH model. We should consider this model for forecasting. CODE: library(e1071) library(tseries) library(xts) library(rugarch) price = scan("clipboard") pricets=ts(price,frequency=52,start=c(2004,45)) returns=pricets/lag(pricets, -1) summary(price) skewness(price) kurtosis(price) sd(price) summary(returns) skewness(returns) kurtosis(returns) sd(returns) #Normality check hist(returns, prob=TRUE) lines(density(returns, adjust=2), type="l") jarque.bera.test(returns) #log return time series rets = log(pricets/lag(pricets, -1)) #Normality check hist(rets, prob=TRUE) lines(density(rets, adjust=2), type="l")
  • 6. jarque.bera.test(rets) plot.ts(price.ts) # strip off the dates and just create a simple numeric object (require:xts) ret = coredata(rets); # creates time plot of log returns plot(rets) summary(rets) skewness(rets) kurtosis(rets) sd(returns) #ADF test for checking null hypothesis of non stationarity adf.test(rets) # Computes Ljung-Box test on returns Box.test( coredata(rets)) # Computes Ljung-Box test on squared returns to test non-linear independence Box.test(coredata(rets^2)) # Computes Ljung-Box test on absolute returns to test non- linear independence Box.test(abs(coredata(rets))) par(mfrow=c(3,1)) # Plots ACF function of vector data acf(ret) # Plot ACF of squared returns to check for ARCH effect acf(ret^2) # Plot ACF of absolute returns to check for ARCH effect acf(abs(ret)) #plot returns, square returns and abs(returns) par(mfrow=c(3,1)) # Plots ACF function of vector data plot(rets, type='l')
  • 7. # Plot ACF of squared returns to check for ARCH effect plot(rets^2,type='l') # Plot ACF of absolute returns to check for ARCH effect plot(abs(rets),type='l') par(mfrow=c(1,1)) # plots PACF of squared returns to identify order of AR model pacf(coredata(rets),lag=10) #specify model using functions in rugarch package #Fit ARMA(0,0)-GARCH(2,1) model garch21.spec=ugarchspec(variance.model=list(garchOrder=c(2,1 )), mean.model=list(armaOrder=c(0,0))) #estimate model garch21.fit=ugarchfit(spec=garch21.spec, data=rets) garch21.fit #Fit ARMA(0,0)-eGARCH(1,1) model with Gaussian distribution egarch11.spec=ugarchspec(variance.model=list(model = "eGARCH", garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0))) #estimate model egarch11.fit=ugarchfit(spec=egarch11.spec, data=ret) egarch11.fit #Fit ARMA(0,0)-TGARCH(2,1) model with norm-distribution gjrgarch21.spec=ugarchspec(variance.model=list(model = "gjrGARCH", garchOrder=c(2,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "norm") #estimate model gjrgarch21.fit=ugarchfit(spec=gjrgarch21.spec, data=ret) gjrgarch21.fit
  • 8. # compare information criteria model.list = list(garch21 = garch21.fit, egarch11 = egarch11.fit, gjrgarch21 = gjrgarch21.fit) info.mat = sapply(model.list, infocriteria) rownames(info.mat) = rownames(infocriteria(garch21.fit)) info.mat # RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE OBSERVATIONS FOR FORECAST # EVALUATION STATISTICS garch21.fit = ugarchfit(spec=garch21.spec, data=ret, out.sample=100) egarch11.fit = ugarchfit(egarch11.spec, data=ret, out.sample=100) tgarch21.fit = ugarchfit(spec=gjrgarch21.spec, data=ret, out.sample=100) garch21.fcst = ugarchforecast(garch21.fit, n.roll=100, n.ahead=5) egarch11.fcst = ugarchforecast(egarch11.fit, n.roll=100, n.ahead=5) tgarch21.fcst = ugarchforecast(tgarch21.fit, n.roll=100, n.ahead=5) fcst.list = list(garch21=garch21.fcst, egarch11=egarch11.fcst, tgarch21=tgarch21.fcst) fpm.mat = sapply(fcst.list, fpm) fpm.mat EXPLORATORY ANALYSIS
  • 9. nobs 469.000000 NAs 0.000000 Minimum -0.166652 Maximum 0.164808 1. Quartile -0.022391 3. Quartile 0.029000 Mean 0.003843 Median 0.005614 Sum 1.802469 SE Mean 0.002079 LCL Mean -0.000242 UCL Mean 0.007929 Variance 0.002027 Stdev 0.045027 Skewness -0.040829 Kurtosis 1.569306 Title: Jarque - Bera Normalality TestTest Results: STATISTIC: X-squared: 49.4632 P VALUE: Asymptotic p Value: 1.816e- 11 The distribution of log(returns) is not normal distribution, with symmetry close to 0 but kurtosis statistics is 1.5 which is far from normal distribution statistic. The Jarque-Bera test is significant (p-value < 0.05) indicating that hypothesis of normal distribution for log(returns) can be rejected. The following plot is time series plot of weekly price of Google shares which shows increasing trend. ( Time series Plot of Google Prices ) Time plot of returns show that google stock returns shows
  • 10. periods of high volatility at various times. Most returns are between +/- 10%. Sample moments show that distribution of log returns is somewhat symmetric with very thin tails (kurtosis = 1.56). There is various times where the returns produce +/-15% with higher volatility also. Volatility doesn’t seem to die down quickly and it continues for a while after a volatile period. To check null hypothesis of non stationarity: Dickey Fuller Test is expressed as H0: φ1=1 vs Ha: φ1<>1 where the null hypothesis indicates unit-root non-stationarity. The Dickey-Fuller test shows that the earnings time series is unit-root stationary. The test p-values for lags 7 is less than 0.05, therefore the null hypothesis of non stationarity can be rejected (small p-values< 0.05). Augmented Dickey-Fuller TestTest Results: PARAMETER: Lag Order: 7 STATISTIC: Dickey-Fuller: -7.1331 P VALUE: 0.01 alternative hypothesis: stationary ACF TESTS The ACF plots below show the Google stock returns are not correlated indicating a constant mean model for rt. Both the squared returns time series and the absolute time series show large autocorrelations. We can conclude that the log returns process has a strong non-linear dependence. Ljung Box testing for ARCH effects for Lags of 6-12-18 for squared returns and absolute returns Box-Ljung testdata: coredata(rets^2)X-squared = 48.3339, df = 6, p-value = 1.013e-08Box-Ljung testdata: coredata(rets^2)X- squared = 71.9976, df = 12, p-value = 1.352e-10Box-Ljung testdata: coredata(rets^2)X-squared = 98.7945, df = 18, p-value = 3.68e-13
  • 11. The Ljung Box tests confirm that the Ljung Box tests on the squared returns are autocorrelated. The analysis shows a strong ARCH effect. The squared returns are strongly correlated. The Ljung-Box tests on squared residuals are highly significant with p-values < 0.005, and autocorrelation plots shows large autocorrelations for the first 18 lags. Plot of PACF: There is no correlation till lag 13 which shows there is no AR lag. MODEL FITTING *---------------------------------** GARCH Model Fit **---------------------------------*Conditional Variance Dynamics -----------------------------------GARCH Model: sGARCH(1,1)Mean Model: ARFIMA(0,0,0)Distribution: std Optimal Parameters------------------------------------ Estimate Std. Error t value Pr(>|t|)mu 0.004432 0.001778 2.4924 0.012689omega 0.000103 0.000053 1.9574 0.050295alpha1 0.094169 0.032716 2.8784 0.003997beta1 0.856326 0.044635 19.1850 0.000000shape 6.797338 2.000925 3.3971 0.000681 To fit an ARMA(0,0)-GARCH(2,1) model for the log returns using a normal distribution for the error terms: Fitted Model: with 7 degrees of freedom Residual AnalysisQ-Statistics on Standardized Residuals--------- --------------------------- statistic p-valueLag[1]
  • 12. 0.0339 0.8539Lag[p+q+1][1] 0.0339 0.8539Lag[p+q+5][5] 2.4766 0.7800d.o.f=0H0 : No serial correlationQ-Statistics on Standardized Squared Residuals------------------------------------ statistic p-valueLag[1] 0.1274 0.7212Lag[p+q+1][3] 1.4245 0.2327Lag[p+q+5][7] 3.4346 0.6333d.o.f=2 Above output shows there is no evidence of autocorrelation in residuals. They behave like white noise. Also, there is no evidence of serial correlation in squared residuals. They also behave like white noise. Adjusted Pearson Goodness-of-Fit Test:------------------------------------ group statistic p-value(g- 1)1 20 8465 02 30 13148 03 40 17834 04 50 22521 0 Test for Goodness of fit. Normal Distribution rejected. To fit ARMA(0,0)-eGARCH(1,1) model with Gaussian distribution: Conditional Variance Dynamics ----------------------------------- GARCH Model: eGARCH(1,1)Mean Model: ARFIMA(0,0,0)Distribution: norm Optimal Parameters----------- ------------------------- Estimate Std. Error t value Pr(>|t|)mu 0.004814 0.001837 2.6205 0.008780omega - 0.427600 0.165861 -2.5781 0.009936alpha1 -0.086690 0.033886 -2.5583 0.010518beta1 0.931657 0.026273 35.4604 0.000000gamma1 0.177187 0.048248 3.6724 0.000240 Fitted Model is: Residual Analysis:Q-Statistics on Standardized Residuals-------- ---------------------------- statistic p-valueLag[1] 0.03655 0.8484Lag[p+q+1][1] 0.03655 0.8484Lag[p+q+5][5] 2.73813 0.7403d.o.f=0H0 : No serial correlationQ-Statistics on Standardized Squared Residuals------------------------------------ statistic p-valueLag[1] 0.2255 0.6348Lag[p+q+1][3]
  • 13. 2.6812 0.1015Lag[p+q+5][7] 4.1362 0.5300d.o.f=2ARCH LM Tests------------------------------------ Statistic DoF P-ValueARCH Lag[2] 2.224 2 0.3290ARCH Lag[5] 4.682 5 0.4559ARCH Lag[10] 7.053 10 0.7204 Above output shows there is no evidence of autocorrelation in residuals. They behave like white noise. Also, there is no evidence of serial correlation in squared residuals. They also behave like white noise. Adjusted Pearson Goodness-of-Fit Test:------------------------------------ group statistic p-value(g- 1)1 20 26.65 0.11312 30 32.04 0.31793 40 43.67 0.27984 50 47.74 0.5243 Above output shows that error terms are normally distributed as all the P values are greater than 0.05. To fit ARMA(0,0)-tGARCH(1,1) model with Gaussian distribution:Conditional Variance Dynamics ----------------------- ------------GARCH Model: gjrGARCH(2,1)Mean Model: ARFIMA(0,0,0)Distribution: norm Optimal Parameters----------- ------------------------- Estimate Std. Error t value Pr(>|t|)mu 0.004928 0.001860 2.649926 0.008051omega 0.000120 0.000053 2.257334 0.023987alpha1 0.000000 0.000877 0.000011 0.999991alpha2 0.072854 0.037335 1.951388 0.051011beta1 0.828559 0.053752 15.414339 0.000000gamma1 0.397469 0.144242 2.755564 0.005859gamma2 -0.315459 0.131445 -2.399922 0.016399 Fitted Model is: Residual Analysis:Q-Statistics on Standardized Residuals-------- ---------------------------- statistic p-valueLag[1] 0.2311 0.6307Lag[p+q+1][1] 0.2311 0.6307Lag[p+q+5][5] 2.9412 0.7090d.o.f=0H0 : No serial correlationQ-Statistics on Standardized Squared Residuals------------------------------------ statistic p-valueLag[1] 2.137 0.14380Lag[p+q+1][4] 4.191 0.04063Lag[p+q+5][8] 4.680 0.45620d.o.f=3ARCH LM Tests------------------------------------ Statistic DoF P-
  • 14. ValueARCH Lag[2] 2.461 2 0.2921ARCH Lag[5] 4.904 5 0.4277ARCH Lag[10] 7.140 10 0.7122 Above output shows there is no evidence of autocorrelation in residuals. They behave like white noise. Also, there is no evidence of serial correlation in squared residuals. They also behave like white noise. Adjusted Pearson Goodness-of-Fit Test:------------------------------------ group statistic p-value(g- 1)1 20 20.00 0.39472 30 32.43 0.30143 40 30.87 0.82034 50 54.56 0.2714 Above output shows that error terms are normally distributed as all the P values are greater than 0.05. BEST FIT FOR THE MODEL: garch11 egarch11 gjrgarch11Akaike -3.479720 -3.455538 -3.474405Bayes -3.435471 -3.411288 -3.412455Shibata -3.479944 -3.455762 -3.474841Hannan-Quinn -3.462310 -3.438127 -3.450030 From above output it can be said that AR(0)-EGARCH(1,1) have the (smallest) values for all best fit criterion and hence can be considered as best model. Forecast Analysis: RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE OBSERVATIONS FOR FORECAST and EVALUATE STATISTICS for 5 Step Ahead Forecast. garch11 egarch11 tgarch21 MSE 0.000950199 0.0009498531 0.0009499473MAE 0.02257449 0.0225407 0.02255243 DAC 0.6 0.6 0.6 Since MSE is smallest for eGARCH model. We should consider this model for forecasting. CODE: #Tomas Georgakopoulos CSC 425 Final Project setwd("C:/Course/CSC425")
  • 15. # Analysis of Google weekly returns from library(forecast) library(TSA) # import data in R and compute log returns # import libraries for TS analysis library(zoo) library(tseries) myd= read.table('Weekly-GOOG-TSDATA.csv', header=T, sep=',') pricets = zoo(myd$price, as.Date(as.character(myd$date), format=c("%m/%d/%Y"))) #log return time series rets = log(pricets/lag(pricets, -1)) # strip off the dates and just create a simple numeric object ret = coredata(rets); #compute statistics library(fBasics) basicStats(rets) #HISTOGRAM par(mfcol=c(1,2)) hist(rets, xlab="Weekly Returns", prob=TRUE, main="Histogram") #Add approximating normal density curve xfit<- seq(min(rets,na.rm=TRUE),max(rets,na.rm=TRUE),length=40) yfit<- dnorm(xfit,mean=mean(rets,na.rm=TRUE),sd=sd(rets,na.rm=TR UE)) lines(xfit, yfit, col="blue", lwd=2) #CREATE NORMAL PROBABILITY PLOT
  • 16. qqnorm(rets) qqline(rets, col = 'red', lwd=2) # creates time plot of log returns par(mfrow=c(1,1)) plot(rets) #Perform Jarque-Bera normality test. normalTest(rets,method=c('jb')) #SKEWNESS TEST skew_test=skewness(rets)/sqrt(6/length(rets)) skew_test print("P-value = ") 2*(1-pnorm(abs(skew_test))) #FAT-TAIL TEST k_stat = kurtosis(rets)/sqrt(24/length(rets)) print("Kurtosis test statistic") k_stat print("P-value = ") 2*(1-pnorm(abs(k_stat))) #COMPUTE DICKEY-FULLER TEST library(fUnitRoots) adfTest(rets, lags=7, type=c("c")) # Computes Ljung-Box test on squared returns to test non-linear independence at lag 6 and 12 Box.test(coredata(rets^2),lag=6,type='Ljung') Box.test(coredata(rets^2),lag=12,type='Ljung') Box.test(coredata(rets^2),lag=18,type='Ljung') # Computes Ljung-Box test on absolute returns to test non- linear independence at lag 6 and 12
  • 17. Box.test(abs(coredata(rets)),lag=6,type='Ljung') Box.test(abs(coredata(rets)),lag=12,type='Ljung') Box.test(abs(coredata(rets)),lag=18,type='Ljung') # Plots ACF function of vector data par(mfrow=c(3,1)) acf(ret) # Plot ACF of squared returns to check for ARCH effect acf(ret^2) # Plot ACF of absolute returns to check for ARCH effect acf(abs(ret)) #plot returns, square returns and abs(returns) # Plots ACF function of vector data par(mfrow=c(3,1)) plot(rets, type='l') # Plot ACF of squared returns to check for ARCH effect plot(rets^2,type='l') # Plot ACF of absolute returns to check for ARCH effect plot(abs(rets),type='l') par(mfrow=c(1,1)) # plots PACF of squared returns to identify order of AR model pacf(coredata(rets),lag=30) #GARCH Models library(rugarch) #Fit AR(0,0)-GARCH(1,1) model garch11.spec=ugarchspec(variance.model=list(garchOrder=c(1,1 )), mean.model=list(armaOrder=c(0,0)),distribution.model = "std") #estimate model
  • 18. garch11.fit=ugarchfit(spec=garch11.spec, data=rets) garch11.fit #Fit AR(0,0)-eGARCH(1,1) model with Gaussian distribution egarch11.spec=ugarchspec(variance.model=list(model = "eGARCH",garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0))) #estimate model egarch11.fit=ugarchfit(spec=egarch11.spec, data=rets) egarch11.fit #Fit AR(0,0)-TGARCH(1,1) model with norm-distribution gjrgarch11.spec=ugarchspec(variance.model=list(model = "gjrGARCH",garchOrder=c(2,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "norm") #estimate model gjrgarch11.fit=ugarchfit(spec=gjrgarch11.spec, data=rets) gjrgarch11.fit # compare information criteria model.list = list(garch11 = garch11.fit, egarch11 = egarch11.fit, gjrgarch11 = gjrgarch11.fit) info.mat = sapply(model.list, infocriteria) rownames(info.mat) = rownames(infocriteria(garch11.fit)) info.mat # RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE OBSERVATIONS FOR FORECAST # EVALUATION STATISTICS garch11.fit = ugarchfit(spec=garch11.spec, data=rets, out.sample=100) egarch11.fit = ugarchfit(egarch11.spec, data=rets, out.sample=100)
  • 19. tgarch11.fit = ugarchfit(spec=gjrgarch11.spec, data=rets, out.sample=100) garch11.fcst = ugarchforecast(garch11.fit, n.roll=100, n.ahead=1) egarch11.fcst = ugarchforecast(egarch11.fit, n.roll=100, n.ahead=1) tgarch11.fcst = ugarchforecast(tgarch11.fit, n.roll=100, n.ahead=1) fcst.list = list(garch11=garch11.fcst, egarch11=egarch11.fcst, tgarch21=tgarch11.fcst) fpm.mat = sapply(fcst.list, fpm) fpm.mat CSC425 – Time series analysis and forecasting Homework 5 – not be submitted The goal of this assignment is to provide students with some practical training on GARCH/EGARCH/TGARCH models for the analysis of the volatility of a stock return. Solution
  • 20. s will be posted on Thursday November 7th 2013 Reading assignment: 1. Read Chapter 4 in short book and Chapter 3 in long book on volatility models 2. Review course documents posted under week 7 and 8. Problem Use the datafile nordstrom_w_00_13.csv that contains the Nordstrom (JWN ) stock weekly prices from January 2000 to October 2013. The data file contains dates (date), daily prices (price). You can also use the code and the analysis of the S&P500 returns used in week 7 and 8 lectures as your reference for the analysis of this data. Analyze the Nordstrom stock log returns following the steps below.
  • 21. 1. Compute log returns, and analyze their time plot. Moments N 693 Sum Weights 693 Mean 0.00268299 Sum Observations 1.85931229 Std Deviation 0.06068019 Variance 0.00368209 Skewness -0.2804891 Kurtosis 7.55351876 Uncorrected SS 2.55299156 Corrected SS 2.54800304 Coeff Variation 2261.66262 Std Error Mean 0.00230505
  • 22. Time plot of returns show that Nordstrom stock returns shows periods of high volatility at various times, and consistently high volatility from 2007 to 2010. Most returns are between +/- 10%. Sample moments show that distribution of log returns is somewhat symmetric with very fat tails (kurtosis = 7.55). return -0.5 -0.4 -0.3 -0.2 -0.1
  • 23. 0.0 0.1 0.2 0.3 0.4 date 01/01/2000 01/01/2002 01/01/2004 01/01/2006 01/01/2008 01/01/2010 01/01/2012 01/01/2014 01/01/2016 2. Is there evidence of serial correlations in the log returns? Use autocorrelations and 5% significance level to answer the question. Log returns are not serially correlated as shown by the Ljung- Box test with p-values >
  • 24. 0.05 and the autocorrelation plot. . Name of Variable = return Mean of Working Series 0.002683 Standard Deviation 0.060636 Number of Observations 693 Autocorrelation Check for White Noise To Chi- Pr > Lag Square DF ChiSq -------------------- Autocorrelations-------------------- 6 6.16 6 0.4050 -0.009 0.011 -0.048 -0.009 0.078 -0.006 12 9.08 12 0.6957 -0.042 -0.038 -0.019 0.011 -0.015 0.016
  • 25. 18 26.17 18 0.0960 0.033 -0.026 0.088 -0.032 0.101 -0.056 24 31.58 24 0.1377 0.029 -0.037 0.025 -0.042 -0.026 -0.048 30 33.84 30 0.2871 -0.029 -0.003 -0.037 0.023 0.011 -0.016 3. Is there evidence of ARCH effects in the log returns? Use appropriate tests at 5% significance level to answer this question. The analysis below shows a strong ARCH effect. The squared returns are strongly correlated. The Ljung-Box tests on squared residuals are highly significant with p-values < 0.001, and autocorrelation plots shows large autocorrelations for the first 10 lags.
  • 26. Name of Variable = returnsq Mean of Working Series 0.003684 Standard Deviation 0.011302 Number of Observations 693 Autocorrelation Check for White Noise To Chi- Pr > Lag Square DF ChiSq -------------------- Autocorrelations-------------------- 6 331.56 6 <.0001 0.534 0.281 0.123 0.101 0.167 0.240 12 407.05 12 <.0001 0.246 0.187 0.053 0.036 0.032 0.082
  • 27. 18 469.70 18 <.0001 0.069 0.072 0.128 0.127 0.156 0.145 24 494.90 24 <.0001 0.149 0.090 0.050 0.035 0.014 0.031 30 501.01 30 <.0001 0.033 0.064 0.051 0.023 0.010 -0.004 4. Fit an GARCH(1,1) model for the log returns using a t- distribution for the error terms. Perform model checking (analyze if residuals are white noise, if squared residuals are white noise, and check if t-distribution is a good fit for the data) and write down the fitted model. The GARCH model with t-distribution is an adequate model for the volatility of the
  • 28. returns. All parameters are significant and the squared residuals are white noise (LB tests on squared residuals are non significant). Fitted GARCH model can be expressed as follows: rt=0.005 +at at=σtet with σt 2 =0.1483 a 2 t-1+0.836 σ 2 t-1 (Intercept ARCH0 can be considered equal to zero) Where error term et has t-distribution with 1/0.185=5 degrees of freedom.
  • 29. The AUTOREG Procedure GARCH Estimates SSE 2.55069233 Observations 693 MSE 0.00368 Uncond Var 0.00531549 Log Likelihood 1102.73026 Total R-Square . SBC -2172.7554 AIC - 2195.4605 MAE 0.04086373 AICC - 2195.3732 MAPE 113.334007 HQC - 2186.6796
  • 30. Normality Test 126.0152 Pr > ChiSq <.0001 Parameter Estimates Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 0.004653 0.001570 2.96 0.0030 ARCH0 1 0.0000848 0.0000429 1.98 0.0482 ARCH1 1 0.1483 0.0369 4.01 <.0001 GARCH1 1 0.8358 0.0359 23.30 <.0001 TDFI 1 0.1851 0.0448 4.14 <.0001
  • 31. Inverse of t DF R output Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.004729 0.001465 3.2281 0.001246 omega 0.000086 0.000050 1.7302 0.083590 alpha1 0.145749 0.052318 2.7858 0.005340 beta1 0.836471 0.051967 16.0962 0.000000 shape 5.345569 1.009241 5.2966 0.000000 5. Fit and EGARCH(1,1) model for the NDX log returns using a normal distribution for the error terms. Perform model checking and write down the fitted model. The EGARCH model is adequate although the Gaussian distribution on the error terms is
  • 32. not sufficient to describe most extreme events. No ARCH effects are shown in residuals. The leverage parameter “theta” is significant showing that volatility of Nordstrom stock returns is affected more heavily by negative shocks. The fitted model can be written as follows: rt=0.0012 +at at=σtet with ln σt 2 =-0.194+0.213 g(et-1) +0.996 ln σ 2 t-1 g(et-1)= -0.47et-1+[|et-1|-E(et-1)] The AUTOREG Procedure
  • 33. Exponential GARCH Estimates SSE 2.54945444 Observations 693 MSE 0.00368 Uncond Var . Log Likelihood 1093.55049 Total R-Square . stres -7 -6 -5 -4 -3 -2
  • 34. -1 0 1 2 3 4 5 6 7 quantiles -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 t-distribution QQplot for residuals of GARCH model
  • 35. SBC -2154.3958 AIC - 2177.101 MAE 0.04095052 AICC - 2177.0136 MAPE 101.222881 HQC - 2168.32 Normality Test 71.9939 Pr > ChiSq <.0001 Parameter Estimates Standard Approx Variable DF Estimate Error t Value Pr > |t| Intercept 1 0.001236 0.001752 0.71 0.4806
  • 36. EARCH0 1 -0.1940 0.0636 -3.05 0.0023 EARCH1 1 0.2133 0.0316 6.75 <.0001 EGARCH1 1 0.9662 0.0106 91.41 <.0001 THETA 1 -0.4748 0.1121 -4.23 <.0001 R output Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.001271 0.001774 0.71655 0.473654 omega -0.169047 0.110169 -1.53443 0.124924 alpha1 -0.095670 0.035615 -2.68620 0.007227 beta1 0.970507 0.018820 51.56682 0.000000 gamma1 0.194542 0.059579 3.26526 0.001094 In R model is written as
  • 37. rt=0.0012 +at at=σtet with ln σt 2 =-0.169-0.095( et-1 +0.194(|et-1|-E(et-1))+0.970 ln σ 2 t-1 where error term has t-distribution with 6 degrees of freedom. Note that the leverage coefficients of et-1 in SAS and R are equivalent. 6. Fit and EGARCH(1,1) model for the Nordstrom log returns using a t- distribution for the error terms. Perform model checking and write down the fitted model.
  • 38. The EGARCH model t-distributed errors is a good model for the data. No ARCH effects are shown in residuals. The leverage parameter “theta” is significant and negative showing that volatility of Nordstrom stock returns is affected more heavily by negative shocks. The fitted model can be written as follows: rt=0.0032 +at at=σtet with ln σt 2 =-0.191+0.158 g(et-1) +0.974 ln σ 2 t-1 g(et-1)= -0.55et-1+[|et-1|-E(et-1)]
  • 39. et has t-distribution with 6 degrees of freedom. The MODEL Procedure Nonlinear Liklhood Summary of Residual Errors DF DF Adj Equation Model Error SSE MSE Root MSE R-Square R-Sq 7 686 2.5482 0.00371 0.0609 -0.0001 -0.0088 nresid.y 686 1028.4 1.4991 1.2244 Nonlinear Liklhood Parameter Estimates Approx Approx Parameter Estimate Std Err t Value Pr
  • 40. > |t| intercept 0.003273 0.00160 2.05 0.0410 earch0 -0.19123 0.0932 -2.05 0.0405 earch1 0.158378 0.0490 3.23 0.0013 egarch1 0.974881 0.0139 70.01 <.0001 theta -0.55013 0.1969 -2.79 0.0053 df 5.993367 1.3083 4.58 <.0001 R output Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.003374 0.001552 2.1743 0.029681 omega -0.137932 0.098212 -1.4044 0.160191 alpha1 -0.104435 0.034086 -3.0638 0.002185
  • 41. beta1 0.977603 0.016446 59.4433 0.000000 gamma1 0.180592 0.075474 2.3928 0.016722 shape 5.783774 1.169335 4.9462 0.000001 In R model is written as rt=0.0033 +at at=σtet with ln σt 2 =-0.138-0.104( et-1 +0.180(|et-1|-E(et-1))+0.978 ln σ 2 t-1 where error term has t-distribution with 6 degrees of freedom. Note that the leverage coefficients of et-1 in SAS and R are equivalent. Name of Variable = resid2
  • 42. Mean of Working Series 1.483942 Standard Deviation 2.819517 Number of Observations 693 Autocorrelation Check for White Noise To Chi- Pr > Lag Square DF ChiSq -------------------- Autocorrelations-------------------- 6 5.11 6 0.5299 0.026 0.020 -0.044 -0.061 0.024 -0.004 12 13.61 12 0.3261 0.025 0.088 0.014 -0.041 0.017 -0.039 18 19.28 18 0.3748 0.043 -0.032 -0.038 -0.028 -0.049 0.020
  • 43. 24 23.55 24 0.4873 0.004 0.028 -0.025 -0.051 -0.039 -0.021 7. Find a GJK-TGARCH(1,1) model for the Nordstrom log returns using a t-distribution for the innovations. Perform model checking and write down the fitted model. Similar to the AR(0)- EGARCH(1,1) model, the AR(0)- GJR(1,1) model is also a good model for the data. No ARCH effects are shown in residuals. The leverage parameter is significant and positive showing that volatility of Nordstrom stock returns is affected more heavily by negative shocks. The fitted model can be written as follows: rt=0.0036 +at
  • 44. at=σtet with σt 2 =(0.034 +0.13Nt-1)a 2 t-1 +0.800 σ 2 t-1 with Nt-1 = 1 if at-1<0, and Nt-1 = 0 if at-1>0 et has t-distribution with 5 degrees of freedom. The MODEL Procedure Nonlinear Liklhood Parameter Estimates Approx Approx Parameter Estimate Std Err t Value Pr > |t| intercept 0.003589 0.00157 2.28
  • 45. 0.0226 df 5.028263 0.9762 5.15 <.0001 arch0 0.000095 0.000044 2.18 0.0297 arch1 0.034154 0.0259 1.32 0.1869 garch1 0.800444 0.0584 13.71 <.0001 gamma 0.129939 0.0496 2.62 0.0090 R output Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.003880 0.001519 2.5535 0.010665 omega 0.000083 0.000053 1.5798 0.114152 alpha1 0.039211 0.032406 1.2100 0.226283 beta1 0.858372 0.058370 14.7058 0.000000
  • 46. gamma1 0.153341 0.074560 2.0566 0.039723 shape 5.767186 1.177356 4.8984 0.000001 The fitted model can be written as follows: rt=0.0039 +at at=σtet with σt 2 =(0.039 +0.15Nt-1)a 2 t-1 +0.858 σ 2 t-1 with Nt-1 = 1 if at-1<0, and Nt-1 = 0 if at-1>0 et has t-distribution with 6 degrees of freedom.
  • 47. 8. Is the leverage effect significant at the 5% level? The leverage parameters in both the EGARCH and the GJR models are significant, and have values that indicate that volatility react more heavily to negative shocks. 9. What model provides the best fit for the data? Explain. Since the leverage parameters in the AR(0)-EGARCH(1,1) and AR(0) – GJR(1,1) models are significant, and residuals are white noise with no ARCH effect, we can conclude that both models provide a good explanation of the volatility behavior for Nordstrom stock returns. Either models can be chosen, there is no clear winner. (Note that in SAS, PROC MODEL does not compute BIC criterion – backtesting can be
  • 48. used to compare models.) In R the egarch(1,1) and the GJR-GARCH(1,1) models have very similar BIC values- garch11.t egarch11 gjrgarch11 Akaike -3.172122 -3.186143 -3.183976 Bayes -3.139358 -3.146827 -3.144660 10. Use the selected model to compute up to 5 step-ahead forecasts of the simple returns and its volatility. The following predictions are based on the AR(0)- EGARCH(1,1) model. sigma is the predicted conditional standard deviation or volatility, and series is the predicted return (note that predicted returns are the sample mean returns since returns are white noise)
  • 49. R output for forecasts sigma series 2013-10-29 0.02732 0.003374 2013-10-30 0.02764 0.003374 2013-10-31 0.02796 0.003374 2013-11-01 0.02827 0.003374 2013-11-04 0.02858 0.003374 SAS code *import data from file; proc import datafile='nordstrom_w_00_13.csv' out=myd replace; resid -7 -6
  • 51. quantiles -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 t-distribution QQplot of residuals for GJRGARCH model S&P500 analysis Fitting an AR(1)-GARCH(1,1) model with Gaussian errors > # Fitting a ARMA(0,0)-GARCH(1,1) model using the rugarch package > # log returns show weak serial autocorrelations in the mean and an ARCH effect > # Fitting an GARCH(1,1) model
  • 52. > # Use ugarchspec() function to specify model > garch11.spec=ugarchspec(variance.model=list(garchOrder=c(1,1 )), mean.model=list(armaOrder=c(0,0))) > #estimate model > garch11.fit=ugarchfit(spec=garch11.spec, data=ret) > garch11.fit *---------------------------------* * GARCH Model Fit * *---------------------------------* Conditional Variance Dynamics -----------------------------------
  • 53. GARCH Model : sGARCH(1,1) Mean Model : ARFIMA(0,0,0) Distribution : norm Optimal Parameters ------------------------------------ Estimate Std. Error t value Pr(>|t|) mu 0.006814 0.001798 3.7889 0.000151 omega 0.000090 0.000049 1.8302 0.067224 alpha1 0.118390 0.031384 3.7723 0.000162 beta1 0.844396 0.034387 24.5556 0.000000
  • 54. The fitted ARMA(0,0)-GARCH(1,1) model with Gaussian errors can be written as 222 8444.01184.000009.0 0068.0 tttttt tt aea ar
  • 55. Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.006814 0.001914 3.5592 0.000372 omega 0.000090 0.000070 1.2858 0.198502 alpha1 0.118390 0.041165 2.8760 0.004028 beta1 0.844396 0.040113 21.0503 0.000000 LogLikelihood : 828.5681 Information Criteria ------------------------------------ Akaike -3.4286
  • 56. Bayes -3.3938 Shibata -3.4287 Hannan-Quinn -3.4149 Q-Statistics on Standardized Residuals ------------------------------------ statistic p-value Lag[1] 0.5261 0.4682 Lag[p+q+1][1] 0.5261 0.4682 Lag[p+q+5][5] 5.9001 0.3161 d.o.f=0 H0 : No serial correlation Q-Statistics on Standardized Squared Residuals
  • 57. ------------------------------------ statistic p-value Lag[1] 0.2657 0.6062 Lag[p+q+1][3] 0.8252 0.3637 Lag[p+q+5][7] 3.0889 0.6863 d.o.f=2 ARCH LM Tests ------------------------------------ Statistic DoF P-Value ARCH Lag[2] 0.5084 2 0.7755 ARCH Lag[5] 0.9231 5 0.9685 ARCH Lag[10] 6.3220 10 0.7875
  • 58. Nyblom stability test ------------------------------------ Joint Statistic: 1.3254 Individual Statistics: mu 0.07929 omega 0.20176 alpha1 0.02459 beta1 0.09300 Asymptotic Critical Values (10% 5% 1%) Joint Statistic: 1.07 1.24 1.6 Individual Statistic: 0.35 0.47 0.75
  • 59. Sign Bias Test ------------------------------------ t-value prob sig Sign Bias 2.1382 0.0330120 ** Negative Sign Bias 0.5723 0.5673614 Positive Sign Bias 1.3403 0.1807809 Joint Effect 17.4223 0.0005786 *** Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 43.12 0.0012496 2 30 53.82 0.0033902
  • 60. 3 40 75.76 0.0003804 4 50 79.60 0.0037117 Ljung-Box test for serial correlation computed on residuals, and Ljung- Box test for ARCH/GARCH effect computed on squared residuals. Goodness of fit test for distribution of error term. The null hypothesis states that the distribution for the error terms in the model is adequate. Thus a small p-value < α, indicates that null hypothesis can be rejected and the distribution assumption is
  • 61. not adequate. > #create selection list of plots for garch(1,1) fit > plot(garch11.fit) > #to display all subplots on one page > plot(garch11.fit, which="all") Residual analysis of GARCH model shows that the model fits the data adequately. Ljung Box test (Q-statistic) on residuals is not significant, showing that hypothesis of no correlation for residuals cannot be rejected. Similarly the Ljung Box test (Q-statistic) on the squared standardized residuals is not significant suggesting that residuals show no ARCH/GARCH effect. The Adjusted Pearson goodness of fit test is significant indicating that the normal distribution assumed for the error term is not appropriate, as also shown by the QQ plot of the residuals.
  • 62. Fitting an AR(1)-GARCH(1,1) model with t-distributed errors Elapsed time : 0.260026 > plot(garch11.fit, which="all") Error in plot.new() : figure margins too large > # use Student-t innovations > #specify model using functions in rugarch package > #Fit ARMA(0,0)-GARCH(1,1) model with t-distribution > garch11.t.spec=ugarchspec(variance.model=list(garchOrder=c(1 ,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "std")
  • 63. > #estimate model > garch11.t.fit=ugarchfit(spec=garch11.t.spec, data=ret) > garch11.t.fit *---------------------------------* * GARCH Model Fit * *---------------------------------* Conditional Variance Dynamics ----------------------------------- GARCH Model : sGARCH(1,1) Mean Model : ARFIMA(0,0,0) Distribution : std Optimal Parameters
  • 64. ------------------------------------ Estimate Std. Error t value Pr(>|t|) mu 0.008012 0.001746 4.5892 0.000004 omega 0.000122 0.000068 1.7901 0.073444 alpha1 0.123683 0.038919 3.1780 0.001483 beta1 0.821471 0.050706 16.2008 0.000000 shape 6.891814 1.978494 3.4834 0.000495 The fitted ARMA(0,0)-GARCH(1,1) model with Gaussian errors can be written as 222 8215.01237.000012.0
  • 65. 0080.0 tttttt tt aea ar Error term {et} has t-distribution with 7 degrees of freedom Robust Standard Errors: Estimate Std. Error t value Pr(>|t|)
  • 66. mu 0.008012 0.001817 4.4090 0.000010 omega 0.000122 0.000071 1.7216 0.085136 alpha1 0.123683 0.038112 3.2453 0.001173 beta1 0.821471 0.041476 19.8061 0.000000 shape 6.891814 1.976630 3.4866 0.000489 LogLikelihood : 839.2684 Information Criteria ------------------------------------ Akaike -3.4689 Bayes -3.4255 Shibata -3.4691 Hannan-Quinn -3.4518
  • 67. Q-Statistics on Standardized Residuals ------------------------------------ statistic p-value Lag[1] 0.4662 0.4947 Lag[p+q+1][1] 0.4662 0.4947 Lag[p+q+5][5] 5.6618 0.3405 d.o.f=0 H0 : No serial correlation Q-Statistics on Standardized Squared Residuals ------------------------------------ statistic p-value
  • 68. Lag[1] 0.2474 0.6189 Lag[p+q+1][3] 0.8569 0.3546 Lag[p+q+5][7] 2.9570 0.7066 d.o.f=2 ARCH LM Tests ------------------------------------ Statistic DoF P-Value ARCH Lag[2] 0.5959 2 0.7423 ARCH Lag[5] 0.9740 5 0.9646 ARCH Lag[10] 6.0871 10 0.8079 Nyblom stability test ------------------------------------
  • 69. Joint Statistic: 1.396 Individual Statistics: mu 0.17184 omega 0.23451 alpha1 0.04303 beta1 0.10209 shape 0.07244 Asymptotic Critical Values (10% 5% 1%) Joint Statistic: 1.28 1.47 1.88 Individual Statistic: 0.35 0.47 0.75 Sign Bias Test
  • 70. ------------------------------------ t-value prob sig Sign Bias 2.121 0.0343991 ** Negative Sign Bias 0.549 0.5832924 Positive Sign Bias 1.206 0.2284569 Joint Effect 16.352 0.0009603 *** Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 22.66 0.25269 2 30 44.47 0.03312
  • 71. 3 40 39.50 0.44759 4 50 43.64 0.68967 Residual analysis of GARCH model with t-distributed error terms shows that the model fits the data adequately. Ljung Box test (Q-statistic) on residuals is not significant, showing that hypothesis of no correlation for residuals cannot be rejected. Similarly the Ljung Box test (Q-statistic) on the squared standardized residuals is not significant suggesting that residuals show no ARCH/GARCH effect. The Adjusted Pearson goodness of fit test is not significant indicating that the distribution of the error terms can be described by a t-distribution with 7 degrees of freedom, as also shown by the QQ plot of the residuals (created using plot(garch11.t.fit, which=9). Fitting an ARMA(0,0)-EGARCH(1,1) model
  • 72. The EGARCH model fitted by the rugarch package has a slightly different form than the model in the textbook. Here is the general expression of the EGARCH(1,1) model: )ln(|))(||(|()ln( , 2 1111111 2 ttttt tttttt eEee
  • 73. eaar where µt can follow an ARMA process, but most typically it will be constant. Gamma1 (γ1) is the leverage parameter. So if gamma1 in output is significant, then we can conclude that the volatility process has an asymmetric behavior. Fitting an ARMA(0,0)-EGARCH(1,1) model with Gaussian distribution (similar to SAS example) > #Fit ARMA(0,0)-eGARCH(1,1) model with Gaussian distribution > egarch11.spec=ugarchspec(variance.model=list(model = "eGARCH",
  • 74. garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0))) > #estimate model > egarch11.fit=ugarchfit(spec=egarch11.spec, data=ret) > egarch11.fit *---------------------------------* * GARCH Model Fit * *---------------------------------* Conditional Variance Dynamics ----------------------------------- GARCH Model : eGARCH(1,1) Mean Model : ARFIMA(0,0,0) Distribution : norm
  • 75. Optimal Parameters ------------------------------------ Estimate Std. Error t value Pr(>|t|) mu 0.005937 0.001860 3.1915 0.001415 omega -0.610497 0.263901 -2.3134 0.020703 alpha1 -0.111069 0.042614 -2.6064 0.009150 beta1 0.902462 0.041695 21.6442 0.000000 gamma1 0.209405 0.050542 4.1432 0.000034 Using the R output above, the ARMA(0,0)-EGARCH(1,1) model can be written as follows.
  • 76. Fitted model: rt = 0.0059 + at, at=σtet ln(σ2t) = -0.610 + (-0.111 et-1 + 0.209(|et-1| - E(|et-1|)) + 0.9024 ln(σ 2 t-1) Note that since et has Gaussian distribution, the E(|et|)=sqrt(2/pi) = 0.7979 or approx 0.80 (see page 143 in textbook). Thus we can rewrite the expression above as
  • 78. eifee And after some algebra, we can write: 0320.0 0098.0 )ln(9024.07767.0)ln(
  • 81. tt ttx tt eife eife For a standardized shock with magnitude 2, (i.e. two standard deviations), we have 56.1 )2098.0exp( ))2(320.0exp( )2( )2( 1
  • 83. e e Therefore, the impact of negative shock of size two-standard deviations is about 56% higher than the impact of a positive shock of the same size. Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.005937 0.001958 3.0328 0.002423 omega -0.610497 0.364615 -1.6744 0.094060 alpha1 -0.111069 0.066343 -1.6742 0.094096 beta1 0.902462 0.057336 15.7400 0.000000
  • 84. gamma1 0.209405 0.048127 4.3511 0.000014 LogLikelihood : 835.9936 Information Criteria ------------------------------------ Akaike -3.4553 Bayes -3.4119 Shibata -3.4555 Hannan-Quinn -3.4382 Q-Statistics on Standardized Residuals
  • 85. ------------------------------------ statistic p-value Lag[1] 0.3351 0.5627 Lag[p+q+1][1] 0.3351 0.5627 Lag[p+q+5][5] 5.1570 0.3970 d.o.f=0 H0 : No serial correlation Q-Statistics on Standardized Squared Residuals ------------------------------------ statistic p-value Lag[1] 0.7262 0.3941 Lag[p+q+1][3] 1.0203 0.3124
  • 86. Lag[p+q+5][7] 2.8738 0.7194 d.o.f=2 ARCH LM Tests ------------------------------------ Statistic DoF P-Value ARCH Lag[2] 1.018 2 0.6010 ARCH Lag[5] 1.165 5 0.9482 ARCH Lag[10] 6.026 10 0.8131 Nyblom stability test ------------------------------------ Joint Statistic: 1.5861 Individual Statistics:
  • 87. mu 0.1829 omega 0.1224 alpha1 0.1527 beta1 0.1301 gamma1 1.0125 Asymptotic Critical Values (10% 5% 1%) Joint Statistic: 1.28 1.47 1.88 Individual Statistic: 0.35 0.47 0.75 Sign Bias Test ------------------------------------ t-value prob sig
  • 88. Sign Bias 1.973 0.04902 ** Negative Sign Bias 1.165 0.24478 Positive Sign Bias 1.041 0.29840 Joint Effect 11.259 0.01041 ** Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 22.49 0.2604 2 30 35.86 0.1777 3 40 50.31 0.1060 4 50 55.07 0.2558
  • 89. Residual analysis of EGARCH model shows that the model fits the data adequately – residuals are white noise and show no ARCH effect. The goodness of fit test supports the choice of a Gaussian distribution for the error term. Although the qqplot shows that the error distribution has thicker left tail than the normal distribution. We will fit the t-distribution to check if that’s a better fit for the behavior of extreme values. Fitting an ARMA(0,0)-EGARCH(1,1) model with t-distribution > #Fit ARMA(0,0)-eGARCH(1,1) model with t-distribution > egarch11.t.spec=ugarchspec(variance.model=list(model = "eGARCH", garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "std")
  • 90. > #estimate model > egarch11.t.fit=ugarchfit(spec=egarch11.t.spec, data=ret) > egarch11.t.fit *---------------------------------* * GARCH Model Fit * *---------------------------------* Conditional Variance Dynamics ----------------------------------- GARCH Model : eGARCH(1,1) Mean Model : ARFIMA(0,0,0) Distribution : std
  • 91. Optimal Parameters ------------------------------------ Estimate Std. Error t value Pr(>|t|) mu 0.007093 0.001757 4.0369 0.000054 omega -0.677075 0.246000 -2.7523 0.005917 alpha1 -0.145367 0.045752 -3.1773 0.001487 beta1 0.893975 0.038715 23.0912 0.000000 gamma1 0.202717 0.055934 3.6242 0.000290 shape 7.926664 2.405188 3.2957 0.000982 Using the R output above, the ARMA(0,0)-EGARCH(1,1) model can be written as follows. Fitted model:
  • 92. rt = 0.007 + at, at=σtet ln(σ2t) = -0.677 + (-0.145 et-1 + 0.203(|et-1| - E(|et-1|)) + 0.894 ln(σ 2 t-1) with t-distribution with 8 degrees of freedom (nearest integer to shape value) Note that since et has t-distribution, the E(|et|)= )2/()1( ]2/)1[(22 - distribution (denoted by shape in R output).
  • 93. Note that since gamma1 is significant, the volatility has an asymmetric behavior. Therefore a negative shock has a stronger impact on the volatility compared to a positive shock of the same size. Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.007093 0.001888 3.7574 0.000172 omega -0.677075 0.212770 -3.1822 0.001462 alpha1 -0.145367 0.042936 -3.3857 0.000710 beta1 0.893975 0.034112 26.2071 0.000000 gamma1 0.202717 0.045692 4.4366 0.000009 shape 7.926664 2.720128 2.9141 0.003567
  • 94. LogLikelihood : 846.92 Information Criteria ------------------------------------ Akaike -3.4965 Bayes -3.4445 Shibata -3.4969 Hannan-Quinn -3.4761 Q-Statistics on Standardized Residuals ------------------------------------ statistic p-value Lag[1] 0.1872 0.6653
  • 95. Lag[p+q+1][1] 0.1872 0.6653 Lag[p+q+5][5] 4.7776 0.4436 d.o.f=0 H0 : No serial correlation Q-Statistics on Standardized Squared Residuals ------------------------------------ statistic p-value Lag[1] 0.6769 0.4107 Lag[p+q+1][3] 0.9526 0.3291 Lag[p+q+5][7] 2.5747 0.7652 d.o.f=2
  • 96. ARCH LM Tests ------------------------------------ Statistic DoF P-Value ARCH Lag[2] 0.9725 2 0.6149 ARCH Lag[5] 1.0934 5 0.9547 ARCH Lag[10] 5.4934 10 0.8559 Nyblom stability test ------------------------------------ Joint Statistic: 1.6436 Individual Statistics: mu 0.20752 omega 0.12081
  • 97. alpha1 0.15261 beta1 0.13304 gamma1 0.93741 shape 0.08736 Asymptotic Critical Values (10% 5% 1%) Joint Statistic: 1.49 1.68 2.12 Individual Statistic: 0.35 0.47 0.75 Sign Bias Test ------------------------------------ t-value prob sig Sign Bias 1.7639 0.07840 *
  • 98. Negative Sign Bias 1.2413 0.21510 Positive Sign Bias 0.9747 0.33022 Joint Effect 8.8291 0.03165 ** Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 20.66 0.35571 2 30 39.23 0.09736 3 40 54.47 0.05098 4 50 66.51 0.04860 Residual analysis of EGARCH model shows that the model fits the data adequately – residuals are white noise and
  • 99. show no ARCH effect. However the goodness of fit test shows that the t-distribution is not a good choice for the error terms (test p-values are small and rejects the null hypothesis of error term having a t-distribution. The qqplot shows that the error distribution has thicker tails than the t- distribution. (Further analysis shows that the ged distribution does a better job representing the extreme values distribution) Fitting an ARMA(0,0)-GJRGARCH(1,1) model or TGARCH model The GJRGARCH(1,1) model fitted by the rugarch package has the following expression )ln()()ln( , 2
  • 101. where µt can follow an ARMA process, but most typically it will be constant. Nt-1 is the indicator variable s.t. Nt-1= 1 when at-1 (shock at time t-1) is negative, and Nt-1 = 0 otherwise. Gamma1 (γ1) is the leverage parameter. So if gamma1 in output is significant, then we can conclude that the volatility process has an asymmetric behavior. > #Fit ARMA(0,0)-TGARCH(1,1) model with t-distribution > gjrgarch11.t.spec=ugarchspec(variance.model=list(model = "gjrGARCH", garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "std") > #estimate model > gjrgarch11.t.fit=ugarchfit(spec=gjrgarch11.t.spec, data=ret) Warning message: In .makefitmodel(garchmodel = "gjrGARCH", f = .gjrgarchLLH, T = T, :
  • 102. NaNs produced > gjrgarch11.t.fit *---------------------------------* * GARCH Model Fit * *---------------------------------* Conditional Variance Dynamics ----------------------------------- GARCH Model : gjrGARCH(1,1) Mean Model : ARFIMA(0,0,0) Distribution : std Optimal Parameters
  • 103. ------------------------------------ Estimate Std. Error t value Pr(>|t|) mu 0.007202 0.001766 4.077739 0.000045 omega 0.000212 0.000094 2.262826 0.023646 alpha1 0.000001 0.001394 0.000791 0.999369 beta1 0.781111 0.065122 11.994488 0.000000 gamma1 0.215386 0.069611 3.094141 0.001974 shape 7.179979 2.031526 3.534279 0.000409 Using the R output above, the ARMA(0,0)-TGARCH(1,1) model can be written as follows. Note that the arch(1) coefficient is zero and we remove it from the model. 2
  • 105. Where error term is assumed to have t-distribution with 7 degrees of freedom. or 2 1 2 11 2 781.0215.000021.0 ,0072.0
  • 106. tttt ttttt aN eaar Where Nt-1 is an indicator variable for negative innovations such that
  • 108. aif N For a standardized shock with magnitude 2, (i.e. two standard deviations), we have 966.1 002.0781.0)002.04()000.0(00021.0 002.0781.0)002.04()215.00000.0(00021.0 )2( )2( 1 2 1 2
  • 110. Where the value for 2 a is computed as 2 1 22 ttt . Since 2 2
  • 111. 2 Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.007202 0.001921 3.749767 0.000177 omega 0.000212 0.000112 1.902791 0.057068 alpha1 0.000001 0.000054 0.020238 0.983853 beta1 0.781111 0.063980 12.208691 0.000000 gamma1 0.215386 0.056979 3.780097 0.000157 shape 7.179979 2.274951 3.156102 0.001599
  • 112. LogLikelihood : 844.6336 Information Criteria ------------------------------------ Akaike -3.4870 Bayes -3.4350 Shibata -3.4873 Hannan-Quinn -3.4666 Q-Statistics on Standardized Residuals ------------------------------------ statistic p-value
  • 113. Lag[1] 0.1348 0.7135 Lag[p+q+1][1] 0.1348 0.7135 Lag[p+q+5][5] 4.7791 0.4434 d.o.f=0 H0 : No serial correlation Q-Statistics on Standardized Squared Residuals ------------------------------------ statistic p-value Lag[1] 0.7412 0.3893 Lag[p+q+1][3] 1.0145 0.3138 Lag[p+q+5][7] 2.5887 0.7631
  • 114. d.o.f=2 ARCH LM Tests ------------------------------------ Statistic DoF P-Value ARCH Lag[2] 1.015 2 0.6020 ARCH Lag[5] 1.239 5 0.9411 ARCH Lag[10] 5.120 10 0.8830 Nyblom stability test ------------------------------------ Joint Statistic: 2.2942 Individual Statistics:
  • 115. mu 0.18155 omega 0.27666 alpha1 0.05641 beta1 0.20413 gamma1 0.03198 shape 0.06486 Asymptotic Critical Values (10% 5% 1%) Joint Statistic: 1.49 1.68 2.12 Individual Statistic: 0.35 0.47 0.75 Sign Bias Test ------------------------------------ t-value prob sig
  • 116. Sign Bias 2.117 0.03474 ** Negative Sign Bias 1.408 0.15987 Positive Sign Bias 0.766 0.44408 Joint Effect 10.173 0.01715 ** Adjusted Pearson Goodness-of-Fit Test: ------------------------------------ group statistic p-value(g-1) 1 20 19.83 0.4048 2 30 29.37 0.4457 3 40 37.17 0.5535 4 50 52.78 0.3300
  • 117. Elapsed time : 0.458046 > plot(gjrgarch11.t.fit, which="all") Residual analysis of TGARCH model shows that the model fits the data adequately – residuals are white noise and show no ARCH effect. The goodness of fit test also shows that the t-distribution is adequate. Apply information criteria for model selection > # MODEL COMPARISON > # compare information criteria > model.list = list(garch11 = garch11.fit, garch11.t = garch11.t.fit, + egarch11 = egarch11.t.fit,
  • 118. + gjrgarch11 = gjrgarch11.t.fit) > info.mat = sapply(model.list, infocriteria) > rownames(info.mat) = rownames(infocriteria(garch11.fit)) > info.mat garch11 garch11.t egarch11 gjrgarch11 Akaike -3.428558 -3.468892 -3.480644 -3.487042 Bayes -3.393831 -3.425483 -3.428554 -3.434952 Shibata -3.428694 -3.469105 -3.480950 -3.487348 Hannan-Quinn -3.414909 -3.451830 -3.460170 -3.466568 Best model according to model selection criteria is the GJR- GARCH(1,1) model with t-distribution
  • 119. R CODE: # Analysis of daily S&P500 index # library(fBasics) library(tseries) library(rugarch) # import data in R # import libraries for TS analysis myd= read.table('sp500_feb1970_Feb2010.txt', header=T) # create time series object • rts= ts(myd$return, start = c(1970, 1), frequency=12) # create a simple numeric object
  • 120. ret =myd$return; # CREATE TIME PLOT plot(rts) # Plots ACF function of vector data acf(ret) # Plot ACF of squared data to check for non-linear dependence acf(ret^2) # Computes Ljung-Box test on squared returns to test non-linear independence at lag 6 and 12 Box.test(ret^2,lag=6,type='Ljung') Box.test(ret^2,lag=12,type='Ljung')
  • 121. # Computes Ljung-Box test on absolute returns to test non- linear independence at lag 6 and 12 Box.test(abs(ret),lag=6,type='Ljung') Box.test(abs(ret),lag=12,type='Ljung') # FITTING AN GARCH(1,1) MODEL WITH GAUSSIAN DISTRIBUTION # Use ugarchspec() function to specify model garch11.spec=ugarchspec(variance.model=list(garchOrder=c(1,1 )), mean.model=list(armaOrder=c(0,0))) #estimate model garch11.fit=ugarchfit(spec=garch11.spec, data=ret)
  • 122. garch11.fit #persistence = alpha1+beta1 persistence(garch11.fit) #half-life: ln(0.5)/ln(alpha1+beta1) halflife(garch11.fit) #create selection list of plots for garch(1,1) fit plot(garch11.fit) #to display all subplots on one page plot(garch11.fit, which="all") #FIT ARMA(0,0)-GARCH(1,1) MODEL WITH T- DISTRIBUTION # specify model using functions in rugarch package
  • 123. garch11.t.spec=ugarchspec(variance.model=list(garchOrder=c(1 ,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "std") #estimate model garch11.t.fit=ugarchfit(spec=garch11.t.spec, data=ret) garch11.t.fit plot(garch11.t.fit) #FIT ARMA(0,0)-EGARCH(1,1) MODEL WITH GAUSSIAN DISTRIBUTION egarch11.spec=ugarchspec(variance.model=list(model = "eGARCH", garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0))) #estimate model
  • 124. egarch11.fit=ugarchfit(spec=egarch11.spec, data=ret) egarch11.fit plot(egarch11.fit, which="all") #FIT ARMA(0,0)-EGARCH(1,1) MODEL WITH T- DISTRIBUTION egarch11.t.spec=ugarchspec(variance.model=list(model = "eGARCH", garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "ged") #estimate model egarch11.t.fit=ugarchfit(spec=egarch11.t.spec, data=ret) egarch11.t.fit plot(egarch11.t.fit, which="all")
  • 125. # compute expected value E(|e|) shape=coef(egarch11.t.fit)[6] exp.abse=(2*sqrt(shape-2)*gamma((shape+1)/2))/((shape- 1)*gamma(shape/2)*sqrt(pi)) #FIT ARMA(0,0)-TGARCH(1,1) MODEL WITH T- DISTRIBUTION gjrgarch11.t.spec=ugarchspec(variance.model=list(model = "gjrGARCH", garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "std") #estimate model gjrgarch11.t.fit=ugarchfit(spec=gjrgarch11.t.spec, data=ret) gjrgarch11.t.fit plot(gjrgarch11.t.fit, which="all")
  • 126. #FIT ARMA(0,0)-IGARCH(1,1) MODEL WITH SKEWED T- DISTRIBUTION igarch11.t.spec=ugarchspec(variance.model=list(model = "iGARCH", garchOrder=c(1,1)), mean.model=list(armaOrder=c(0,0)), distribution.model = "std") #estimate model igarch11.t.fit=ugarchfit(spec=igarch11.t.spec, data=ret) igarch11.t.fit plot(igarch11.t.fit, which="all") # MODEL COMPARISON # compare information criteria model.list = list(garch11 = garch11.fit, garch11.t = garch11.t.fit,
  • 127. egarch11 = egarch11.t.fit, gjrgarch11 = gjrgarch11.t.fit) info.mat = sapply(model.list, infocriteria) rownames(info.mat) = rownames(infocriteria(garch11.fit)) info.mat # RE-FIT MODELS LEAVING 100 OUT-OF-SAMPLE OBSERVATIONS FOR FORECAST # EVALUATION STATISTICS garch11.fit = ugarchfit(spec=garch11.spec, data=ret, out.sample=100) garch11.t.fit = ugarchfit(spec=garch11.t.spec, data=ret, out.sample=100) egarch11.t.fit = ugarchfit(egarch11.t.spec, data=ret, out.sample=100)
  • 128. tgarch11.t.fit = ugarchfit(spec=gjrgarch11.t.spec, data=ret, out.sample=100) # COMPUTE 100 1-STEP AHEAD ROLLING FORECASTS W/O RE-ESTIMATING garch11.fcst = ugarchforecast(garch11.fit, n.roll=100, n.ahead=1) garch11.t.fcst = ugarchforecast(garch11.t.fit, n.roll=100, n.ahead=1) egarch11.t.fcst = ugarchforecast(egarch11.t.fit, n.roll=100, n.ahead=1) tgarch11.t.fcst = ugarchforecast(tgarch11.t.fit, n.roll=100, n.ahead=1) # COMPUTE FORECAST EVALUATION STATISTICS USING FPM() FUNCTION
  • 129. fcst.list = list(garch11=garch11.fcst, garch11.t=garch11.t.fcst, egarch11.t=egarch11.t.fcst, tgarch11.t=tgarch11.t.fcst) fpm.mat = sapply(fcst.list, fpm) fpm.mat CSC425 – Time series analysis and forecasting Homework 4 -