




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
time series analysis in R for financial data complete description with code
Typology: Thesis
1 / 416
This page cannot be seen from the preview
Don't miss anything!





























































































WILEY SERIES IN PROBABILITY AND STATISTICS
Established by WALTER A. SHEWHART and SAMUEL S. WILKS
Editors: David J Balding, Noel A. C. Cressie, Garrett M Fitzmaurice, Harvey Goldstein, lain M. Johnstone, Geert Molenberghs, David W Scott, Adrian F. M. Smith, Ruey S. Tsay, Sanford Weisberg Editors Emeriti: Vic Barnett, J Stuart Hunter, Joseph B. Kadane, JozefL. Teugels
A complete list of the titles in this series appears at the end of this volume.
University of Chicago
To Teresa
xiv PREFACE
intensity and realized volatility. Finally, Chapter 7 studies quantitative methods for risk management, including value at risk and conditional value at risk. The chapter covers important econometric and statistical methods to assess risk, including those based on extreme value theory and quantile regression. The book contains many plots and demonstrations. The goal is to simplify the analysis of financial data and to make the results easily understandable. Like many authors, I struggle to obtain a balance between the length of the book and new develop- ments in financial econometrics. Omission of some important topics is unavoidable. There is some overlap with Analysis of Financial Time Series in coverage, but all examples are new. I like to express my sincere thanks to my wife. Without her love and support, this book could not be written. I also like to thank my children; they are my inspiration and help me editing some chapters. Many readers and students constantly give me feedback and suggestions. Their input is invaluable. Finally, I like to thank Steve Quigley, Jacqueline Palmieri and their Wiley team for their support and encouragement. The web page of the book is http://faculty.chicagobooth.edu/ruey.tsay/teaching/introTS.
R. S. T. Chicago, Illinois October 2012
The importance of quantitative methods in business and finance has increased substantially in recent years because we are in a data-rich environment and the economies and financial markets are more integrated than ever before. Data are collected systematically for thousands of variables in many countries and at a finer timescale. Computing facilities and statistical packages for analyzing complicated and high dimensional financial data are now widely available. As a matter of fact, with an internet connection, one can easily download financial data from open sources within a software package such as R. All of these good features and capabilities are free and widely accessible. The objective of this book is to provide basic knowledge of financial time series, introduce statistical tools useful for analyzing financial data, and gain experience in financial applications of various econometric methods. We begin with the basic concepts of financial data to be analyzed throughout the book. The software R is intro- duced via examples. We also discuss different ways to visualize financial data in R. Chapter 2 reviews basic concepts of linear time series analysis such as stationarity and autocorrelation function, introduces simple linear models for handling serial depen- dence of the data, and discusses regression models with time series errors, seasonality, unit-root nonstationarity, and long-memory processes. The chapter also considers
An Introduction to Analysis of Financial Data with R , First Edition. Ruey S. Tsay. © 2013 John Wiley & Sons, Inc. Published 2013 by John Wiley & Sons, Inc.
ASSET RETURNS 3
One-Period Simple Return. Holding the asset for one period from date t − 1 to date t would result in a simple gross return
1 + Rt = P (^) t Pt − 1 or Pt = Pt − 1 ( 1 + R (^) t ). (1.1)
The corresponding one-period simple net return or simple return is
Rt = P (^) t Pt − 1 − 1 = P (^) t − Pt − 1 P (^) t − 1
. (1.2)
For demonstration, Table 1.1 gives five daily closing prices of Apple stock in December 2011. From the table, the 1-day gross return of holding the stock from December 8 to December 9 is 1 + R (^) t = 393. 62 / 390. 66 ≈ 1.0076 so that the corre- sponding daily simple return is 0.76%, which is (393.62-390.66)/390.66.
Multiperiod Simple Return. Holding the asset for k periods between dates t − k and t gives a k -period simple gross return
1 + Rt [ k ] = Pt P (^) t − k = Pt P (^) t − 1 × Pt − 1 P (^) t − 2 × · · · × Pt − k + 1 Pt − k = ( 1 + Rt )( 1 + Rt − 1 ) · · · ( 1 + Rt − k + 1 )
=
k ∏ − 1
j = 0
( 1 + R (^) t − j ).
Thus, the k -period simple gross return is just the product of the k one-period simple gross returns involved. This is called a compound return. The k -period simple net return is Rt [ k^ ]^ =^ ( Pt −^ P^ t − k )/ P^ t − k. To illustrate, consider again the daily closing prices of Apple stock of Table 1.1. Since December 2 and 9 are Fridays, the weekly simple gross return of the stock is 1 + Rt [5] = 393. 62 / 389. 70 ≈ 1.0101 so that the weekly simple return is 1.01%. In practice, the actual time interval is important in discussing and comparing returns (e.g., monthly return or annual return). If the time interval is not given, then it is implicitly assumed to be one year. If the asset was held for k years, then the annualized (average) return is defined as
Annualized{ R (^) t [ k ]} =
⎡ ⎣
k ∏ − 1
j = 0
( 1 + R (^) t − j )
⎤ ⎦
1 / k − 1.
TABLE 1.1. Daily Closing Prices of Apple Stock from December 2 to 9, 2011 Date 12/02 12/05 12/06 12/07 12/08 12/ Price($) 389.70 393.01 390.95 389.09 390.66 393.
4 FINANCIAL DATA AND THEIR PROPERTIES
This is a geometric mean of the k one-period simple gross returns involved and can be computed by
Annualized{ Rt [ k ]} = exp
⎡ ⎣ 1 k
∑ k^ −^1
j = 0
ln( 1 + Rt − j )
⎤ ⎦ (^) − 1,
where exp( x ) denotes the exponential function and ln( x ) is the natural logarithm of the positive number x. Because it is easier to compute arithmetic average than geometric mean and the one-period returns tend to be small, one can use a first-order Taylor expansion to approximate the annualized return and obtain
Annualized{ R (^) t [ k^ ]} ≈^ 1 k
k ∑ − 1
j = 0
R (^) t − j. (1.3)
Accuracy of the approximation in Equation (1.3) may not be sufficient in some appli- cations, however.
Continuous Compounding. Before introducing continuously compounded return, we discuss the effect of compounding. Assume that the interest rate of a bank deposit is 10% per annum and the initial deposit is $1.00. If the bank pays interest once a year, then the net value of the deposit becomes $1(1+0.1) = $1.1, 1 year later. If the bank pays interest semiannually, the 6-month interest rate is 10%/2 = 5% and the net value is $ 1( 1 + 0. 1 / 2 )^2 = $1.1025 after the first year. In general, if the bank pays interest m times a year, then the interest rate for each payment is 10%/ m and the net value of the deposit becomes $1( 1 + 0. 1 / m ) m^ , 1 year later. Table 1.2 gives the results for some commonly used time intervals on a deposit of $1.00 with interest rate of 10% per annum. In particular, the net value approaches
TABLE 1.2. Illustration of the Effects of Compounding: the Time Interval is 1 Year and the Interest Rate is 10% Per Annum
Number of Interest Rate Net Type Payments per Period Value
Annual 1 0.1 $1. Semiannual 2 0.05 $1. Quarterly 4 0.025 $1. Monthly 12 0.0083 $1.
Weekly 52 0.^1 52 $1.
Daily 365 0365.^1 $1. Continuously ∞ $1.