Econ 424
Descriptive Statistics for Financial Time
SeriesEric Zivot

January 26, 2015

Covariance Stationarity{    1         } = {}is a covariance stationary stochastic process, and each  is identically distributed with unknown pdf  ()Recall,[] =  indep of var() =  2 indep of cov( − ) =  indep of cor( − ) =  indep of Observed Sample:{1 = 1      =  } = {}
=1
are observations generated by the stochastic process
Descriptive Statistics
Data summaries (statistics) to describe certain features of the data, to learn
about the unknown pdf,  () and to capture the observed dependencies inthe data

Time PlotsLine plot of time series data with time/dates on horizontal axis

• Visualization of data - uncover trends, assess stationarity and time dependence• Spot unusual behavior• Plotting multiple time series can reveal commonality across series

Histograms
Goal: Describe the shape of the distribution of the data {}
=1Hisogram Construction:
1. Order data from smallest to largest values
2. Divide range into  equally spaced bins[−| − | − | · · · | − | − |−]3. Count number of observations in each bin
4. Create bar chart (optionally normalize area to equal 1)

R Functions
Function
Description
hist()
compute histogram
density() compute smoothed histogram
Note: The density() function computes a smoothed (kernel density) estimateof the unknown pdf at the point  using the formulaµX1 − ˆ() =  =1¶

(·) = kernel function
 = bandwidth (smoothing) parameterwhere (·) is a pdf symmetric about zero (typically the standard normal distribution). See Ruppert Chapter 4 for details.

Empirical Quantiles/Percentiles
Percentiles:For  ∈ [0 1] the 100 ×  percentile (empirical quantile) of a sample ofdata is the data value ̂ such that  · 100% of the data are less than ̂Quartiles
̂25 = first quartile̂50 = second quartile (median)̂75 = third quartile̂75 − ̂25 = interquartile range (IQR)

R functions
Functionsort()
min()max()
range()
quantile()
median()IQR()
summary()

Description
sort elements of data vector
compute minimum value of data vector
compute maximum value of data vector
compute min and max of a data vector
compute empirical quantiles
compute mediancompute inter-quartile range
compute summary statistics

Historical Value-at-Risk
Let {}
=1 denote a sample of  simple monthly returns on an investment,
and let $0 be the initial value of an investment. For  ∈ (0 1) the historical
VaR is$0 × ̂ = empirical  · 100% quantile of { }
̂ =1

Note: For continuously compounded returns {}
=1 use ) − 1)
$0 × (exp(̂ = empirical  · 100% quantile of { }
̂ =1

Sample Statistics
Plug-In Principle: Estimate population quantities using sample statistics
Sample Average (Mean)
1 X
 = ̄ = ̂ =1

Sample Variance
1 X( − ̄)2 = 2 = ̂2
 − 1 =1

Sample Standard Deviationq2 =  = ̂Sample Skewness
1 X[( − ̄)33 =  − 1 =1Sample Kurtosis
1 X[( − ̄)44 =  − 1 =1Sample Excess Kurtosis[−3R Functions
Function
Package
Description
mean()
base
compute sample mean
colMeans()
base
compute column means of matrix
var()
stats
compute sample variance
sd()
stats
compute sample standard deviation
skewness() PerformanceAnalytics compute sample skewness
kurtosis() PerformanceAnalytics compute sample excess kurtosis
Note: Use the R function apply(), to apply functions over rows or columns ofa matrix or data.frame

Empirical Cumulative Distribution Function
Recall, the CDF of a random variable  is () = Pr( ≤ )
The empirical CDF of a random sample is1(# ≤ )number of  values ≤ =sample size̂ () =How to compute and plot ̂ () for a sample {1     }• Sort data from smallest to largest values: {(1)     ()} and compute̂ () at these points• Plot ̂ () against sorted data {(1)     ()}• Use the R function ecdf()
Note: (1)     () are called the order statistics.
min(1     ) and () = max(1     )In particular, (1) =Quantile-Quantile (QQ) PlotsA QQ plot is useful for comparing your data with the quantiles of a distribution(usually the normal distribution) that you think is appropriate for your data.
You interpret the QQ plot in the following way:

• If the points fall close to a straight line, your conjectured distribution isappropriate• If the points do not fall close to a straight line, your conjectured distribution
is not appropriate and you should consider a diﬀerent distribution

R functions
Function Package
Description
qqnorm()statsQQ-plot against normal distribution
qqline()stats
draw straight line on QQ-plot
qqPlot()car
QQ-plot against specified distribution

Outliers• Extremely large or small values are called “outliers”• Outliers can greatly influence the values of common descriptive statistics.
In particular, the sample mean, variance, standard deviation, skewness andkurtosis• Percentile measures are more robust to outliers: outliers do not greatly
influence these measures (e.g. median instead of mean; IQR instead ofSD)

IQR (interquartile range) - outlier robust measure of spread = 75 − 25Moderate Outlier
̂75 + 15 ·     ̂75 + 3 · 

̂25 − 3 ·     ̂25 − 15 · 

Extreme Outlier  ̂75 + 3 ·   ̂25 − 3 · Boxplots
A box plot displays the locations of the basic features of the distribution of
one-dimensional data–the median, the upper and lower quartiles, outer fencesthat indicate the extent of your data beyond the quartiles, and outliers, if any.
R functions
Function
Package
Description
boxplot()
graphics
box plots for multiple series
chart.Boxplot() PerformanceAnalytics box plots for asset returns

Bivariate Descriptive Statistics{    (1 1) (2 2)    (   )   } = {( )}covariance stationary bivariate stochastic process with realized values{(1 1) (2 2)    (   )} = {( )}
=1
Scatterplot
XY plot of bivariate data
R functions: plot(), pairs()

Sample Covariance1 X( − ̄)( − ̄) =  = ̂ − 1 =1

Sample Correlation
=  = ̂R functions
Function Package
Description
var()
stats
compute sample variance-covariance matrix
cov()
stats
compute sample variance-covariance matrix
cor()
stats
compute sample correlation matrix

Time Series Descriptive Statistics
Sample AutocovarianceX
1( − ̄)(− − ̄)  = 1 2   ̂ = − 1 =+1

Sample Autocorrelation̂̂ = 2   = 1 2   ̂
Sample Autocorrelation Function (SACF)
Plot ̂ against R functions
Function

Package

Description
compute and plot
acf()
stats
sample autocorrelations
chart.ACF()
PerformanceAnalytics plot sample autocorrelations
chart.ACFplus() PerformanceAnalytics plot sample autocorrelations