You are on page 1of 7

Normality, Skewness and Kurtosis Test from Analysis of

Financial Time Series


YIK LUN, KEI
allen29@ucla.edu
This paper is a practice from the book called Analysis of Financial Time Series
by Ruey S. Tsay. All R codes and comments below are belonged to the book
and author.
setwd("~/Desktop/Chicago")
suppressPackageStartupMessages(require(fBasics))
ibm=read.table("m-ibm6708.txt",header=T)
simple.return=ibm[,2] #Get "ibm" simple returns
logrt=log(simple.return+1) #Transform into log returns
plot(logrt, type="l")
title(main='Monthly log returns of IBM stock from 1967,3 to 2008.12')

0.3

0.1

logrt

0.1

0.2

0.3

Monthly log returns of IBM stock from 1967,3 to 2008.12

100

200

300
Index

mean(logrt)
## [1] 0.006208082
1

400

500

var(logrt) #(sd(rt))^2
## [1] 0.005258775
sd(logrt) #sqrt(var(rt))
## [1] 0.07251741
basicStats(logrt) #Compute all summary or descriptive statistics
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##
##

logrt
nobs
502.000000
NAs
0.000000
Minimum
-0.303683
Maximum
0.302915
1. Quartile -0.037641
3. Quartile
0.048443
Mean
0.006208
Median
0.005260
Sum
3.116457
SE Mean
0.003237
LCL Mean
-0.000151
UCL Mean
0.012567
Variance
0.005259
Stdev
0.072517
Skewness
-0.135343
Kurtosis
1.693092

Two sided t test


t.test(logrt,alternative=c("two.sided"),cond.level=0.95)# greater or less
##
##
##
##
##
##
##
##
##
##
##

One Sample t-test


data: logrt
t = 1.9181, df = 501, p-value = 0.05567
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-0.0001509194 0.0125670842
sample estimates:
mean of x
0.006208082

Normality test

normalTest(logrt,method='jb')
##
## Title:
## Jarque - Bera Normalality Test
##
## Test Results:
##
STATISTIC:
##
X-squared: 62.8363
##
P VALUE:
##
Asymptotic p Value: 2.265e-14
##
## Description:
## Tue Aug 25 21:57:51 2015 by user:
#The result shows the normality for log-return is rejected
library(tseries)
jarque.bera.test(logrt)
##
## Jarque Bera Test
##
## data: logrt
## X-squared = 62.836, df = 2, p-value = 2.265e-14
qqnorm(logrt);qqline(logrt,col=2)

0.1
0.1
0.3

Sample Quantiles

0.2

0.3

Normal QQ Plot

Theoretical Quantiles

Skewness
Statistically, two numerical measures of shape, skewness and excess kurtosis, can
be used to test for normality. If either of these values is not close to zero, then
your data set is not normally distributed.
skewness(logrt)
## [1] -0.1353432
## attr(,"method")
## [1] "moment"

(1) If skewness is less than -1 or greater than 1, the distribution is highly skewed.
(2) If skewness is between -1 and -0.5 or between 0.5 and 1, the distribution is
moderately skewed.
(3) If skewness is between -0.5 and 0.5, the distribution is approximately symmetric.

Perform skewness test (Test for symmetry)


skew=skewness(logrt)
T=length(logrt)
test=skew/sqrt(6/T) # follow N(0,1)
test
## [1] -1.237977
## attr(,"method")
## [1] "moment"

Compute two-sided p-value of the test statistic


pvalue=2*pnorm(test)
pvalue
## [1] 0.2157246
## attr(,"method")
## [1] "moment"

Kurtosis
In statistics, kurtosis is a measure of the peakedness of the probability distribution of a random variable. Kurtosis tells the height and sharpness of the central
peak, relative to that of a standard bell curve.
kurtosis(logrt)
## [1] 1.693092
## attr(,"method")
## [1] "excess"

(1) A normal distribution has kurtosis exactly 3 (excess kurtosis exactly 0). Any
distribution with kurtosis = 3 (excess = 0) is called mesokurtic.
(2) A distribution with kurtosis <3 (excess kurtosis <0) is called platykurtic.
Compared to a normal distribution, its central peak is lower and broader, and
its tails are shorter and thinner.
(3) A distribution with kurtosis >3 (excess kurtosis >0) is called leptokurtic.
Compared to a normal distribution, its central peak is higher and sharper, and
its tails are longer and fatter.

Perform kurtosis test


k4=kurtosis(logrt)
test=k4/sqrt(24/T) # follow N(0,1)
test
## [1] 7.743311
## attr(,"method")
## [1] "excess"

Compute two-sided p-value of the test statistic


pvalue=2*(1-pnorm(test))
pvalue
## [1] 9.769963e-15
## attr(,"method")
## [1] "excess"

Though it looks normal, but numerical measure is more precise.


hist(logrt,breaks=50)

20
0

10

Frequency

30

40

Histogram of logrt

0.3

0.2

0.1

0.0

0.1

0.2

0.3

logrt

Reference:
Tsay, Ruey S. Analysis of financial time series. Vol. 543. John
Wiley & Sons, 2005.

You might also like