Descriptive Statistics

Descriptive Statistics

You can’t see this text! Introduction to Computational Finance and Financial Econometrics Descriptive Statistics Eric Zivot Summer 2015 Eric Zivot (Copyright © 2015) Descriptive Statistics 1 / 28 Outline 1 Univariate Descriptive Statistics 2 Bivariate Descriptive Statistics 3 Time Series Descriptive Statistics Eric Zivot (Copyright © 2015) Descriptive Statistics 2 / 28 Covariance Stationarity {..., X1,..., XT ,...} = {Xt} is a covariance stationary stochastic process, and each Xt is identically distributed with unknown pdf f (x). Recall, E[Xt] = µ indep of t 2 var(Xt) = σ indep of t cov(Xt, Xt−j ) = γj indep of t cor(Xt, Xt−j ) = ρj indep of t Eric Zivot (Copyright © 2015) Descriptive Statistics 3 / 28 Descriptive Statistics Observed Sample: T {X1 = x1,..., XT = xT } = {xt}t=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, f (x), and to capture the observed dependencies in the data. Eric Zivot (Copyright © 2015) Descriptive Statistics 4 / 28 Time Plots Line 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 Eric Zivot (Copyright © 2015) Descriptive Statistics 5 / 28 Histograms T Goal: Describe the shape of the distribution of the data {xt}t=1 Hisogram Construction: 1 Order data from smallest to largest values 2 Divide range into N equally spaced bins [−| − | − | · · · | − | − |−] 3 Count number of observations in each bin 4 Create bar chart (optionally normalize area to equal 1) Eric Zivot (Copyright © 2015) Descriptive Statistics 6 / 28 R Functions Function Description hist() compute histogram density() compute smoothed histogram Note: The density() function computes a smoothed (kernel density) estimate of the unknown pdf at the point x using the formula: T 1 X x − xt ˆf (x) = k Tb b t=1 k(·) = kernel function b = bandwidth (smoothing) parameter where k(·) is a pdf symmetric about zero (typically the standard normal distribution). See Ruppert Chapter 4 for details. Eric Zivot (Copyright © 2015) Descriptive Statistics 7 / 28 Empirical Quantiles/Percentiles Percentiles: For α ∈ [0, 1], the 100 × αth percentile (empirical quantile) of a sample of data is the data valueq ˆα such that α · 100% of the data are less than qˆα. Quartiles: qˆ.25 = first quartile qˆ.50 = second quartile (median) qˆ.75 = third quartile qˆ.75 − qˆ.25 = interquartile range (IQR) Eric Zivot (Copyright © 2015) Descriptive Statistics 8 / 28 R Functions Function Description sort() sort elements of data vector min() compute minimum value of data vector max() compute maximum value of data vector range() compute min and max of a data vector quantile() compute empirical quantiles median() compute median IQR() compute inter-quartile range summary() compute summary statistics Eric Zivot (Copyright © 2015) Descriptive Statistics 9 / 28 Historical Value-at-Risk T Let {Rt}t=1 denote a sample of T simple monthly returns on an investment, and let $W0 be the initial value of an investment. For α ∈ (0, 1), the historical VaRα is: R $W0 × qˆα R T qˆα = empirical α · 100% quantile of {Rt}t=1 T Note: For continuously compounded returns {rt}t=1 use: r $W0 × (exp(ˆqα) − 1) r T qˆα = empirical α · 100% quantile of {rt}t=1 Eric Zivot (Copyright © 2015) Descriptive Statistics 10 / 28 Sample Statistics Plug-In Principle: Estimate population quantities using sample statistics. Sample Average (Mean): T 1 X x =x ¯ =µ ˆ T t x t=1 Sample Variance: T 1 X (x − x¯)2 = s2 =σ ˆ2 T − t x x 1 t=1 Sample Standard Deviation: q 2 sx = sx =σ ˆx Eric Zivot (Copyright © 2015) Descriptive Statistics 11 / 28 Sample Statistics cont. Sample Skewness: T 1 X (x − x¯)3/s3 = skew[ T − t x 1 t=1 Sample Kurtosis: T 1 X (x − x¯)4/s4 = kurtd T − t x 1 t=1 Sample Excess Kurtosis: kurtd − 3 Eric Zivot (Copyright © 2015) Descriptive Statistics 12 / 28 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 of a matrix or data.frame. Eric Zivot (Copyright © 2015) Descriptive Statistics 13 / 28 Empirical Cumulative Distribution Function Recall, the CDF of a random variable X is: FX (x) = Pr(X ≤ x) The empirical CDF of a random sample is: 1 Fˆ (x) = (#x ≤ x) X n i number of xi values ≤ x = sample size Eric Zivot (Copyright © 2015) Descriptive Statistics 14 / 28 Empirical Cumulative Distribution Function cont. How to compute and plot FˆX (x) for a sample {x1,..., xn}. Sort data from smallest to largest values: {x(1),..., x(n)} and compute FˆX (x) at these points Plot FˆX (x) against sorted data {x(1),..., x(n)} Use the R function ecdf() Note: x(1),..., x(n) are called the order statistics. In particular, x(1) = min(x1,..., xn) and x(n) = max(x1,..., xn). Eric Zivot (Copyright © 2015) Descriptive Statistics 15 / 28 Quantile-Quantile (QQ) Plots A 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 is appropriate If the points do not fall close to a straight line, your conjectured distribution is not appropriate and you should consider a different distribution Eric Zivot (Copyright © 2015) Descriptive Statistics 16 / 28 R Functions Function Package Description qqnorm() stats QQ-plot against normal distribution qqline() stats draw straight line on QQ-plot qqPlot() car QQ-plot against specified distribution Eric Zivot (Copyright © 2015) Descriptive Statistics 17 / 28 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 and kurtosis Percentile measures are more robust to outliers: outliers do not greatly influence these measures (e.g. median instead of mean; IQR instead of SD) Eric Zivot (Copyright © 2015) Descriptive Statistics 18 / 28 Outliers cont. IQR (interquartile range) - outlier robust measure of spread: IQR = q.75 − q.25 Moderate Outlier: qˆ.75 + 1.5 · IQR < x < qˆ.75 + 3 · IQR qˆ.25 − 3 · IQR < x < qˆ.25 − 1.5 · IQR Extreme Outlier: x > qˆ.75 + 3 · IQR x < qˆ.25 − 3 · IQR Eric Zivot (Copyright © 2015) Descriptive Statistics 19 / 28 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 fences that 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 Eric Zivot (Copyright © 2015) Descriptive Statistics 20 / 28 Outline 1 Univariate Descriptive Statistics 2 Bivariate Descriptive Statistics 3 Time Series Descriptive Statistics Eric Zivot (Copyright © 2015) Descriptive Statistics 21 / 28 Bivariate Descriptive Statistics {..., (X1, Y1), (X2, Y2),... (XT , YT ),...} = {(Xt, Yt)} Covariance stationary bivariate stochastic process with realized values: T {(x1, y1), (x2, y2),... (xT , yT )} = {(xt, yt)}t=1 Scatterplot: XY plot of bivariate data R functions: plot(), pairs() Eric Zivot (Copyright © 2015) Descriptive Statistics 22 / 28 Bivariate Descriptive Statistics cont. Sample Covariance: T 1 X (x − x¯)(y − y¯) = s =σ ˆ T − t t xy xy 1 t=1 Sample Correlation: sxy = rxy =ρ ˆxy sx sy Eric Zivot (Copyright © 2015) Descriptive Statistics 23 / 28 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 Eric Zivot (Copyright © 2015) Descriptive Statistics 24 / 28 Outline 1 Univariate Descriptive Statistics 2 Bivariate Descriptive Statistics 3 Time Series Descriptive Statistics Eric Zivot (Copyright © 2015) Descriptive Statistics 25 / 28 Time Series Descriptive Statistics Sample Autocovariance: T 1 X γˆ = (x − x¯)(x − x¯) j = 1, 2,... j T − t t−j 1 t=j+1 Sample Autocorrelation: γˆj ρˆj = , j = 1, 2,... σˆ2 Sample Autocorrelation Function (SACF): Plotρ ˆj against j Eric Zivot (Copyright © 2015) Descriptive Statistics 26 / 28 R Functions Function Package Description compute and plot acf() stats sample autocorrelations chart.ACF() PerformanceAnalytics plot sample autocorrelations chart.ACFplus() PerformanceAnalytics plot sample autocorrelations Eric Zivot (Copyright © 2015) Descriptive Statistics 27 / 28 You can’t see this text! faculty.washington.edu/ezivot/ Eric Zivot (Copyright © 2015) Descriptive Statistics 28 / 28.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    28 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us