lab 4

Eric Zivot
Econ 424 Winter 2015
Problem Set #4
Descriptive Statistics and the Constant Expected Return Model Due: Tuesday 2/3/15
at 8 pm via Canvas.
Readings





My class slides on descriptive statistics and lecture notes on the constant expected
return model
Ruppert chapter 4 (Exploratory data analysis)
“Working with Time Series in R" on class syllabus page (see Additional Material
column for weeks 2-3)
PerformanceAnalytics and zoo vignettes (see R Hints page on class webpage
under Packages)
Introduction to the corrplot package: http://cran.rproject.org/web/packages/corrplot/vignettes/corrplot-intro.html
Programs and Data



Econ424lab4.r
descriptiveStatistics.r
cerModelExamples.r
R script file hints for lab
R script file used for class examples
R script file used for class examples
Instructions
In this lab you will use R to


Compute univariate, bivariate and time series descriptive statistics
Estimate parameters of the constant expected return (CER) model, compute
standard errors and confidence intervals
Exercises
The following questions require R. On the class web page are the script files
econ424lab4.r, descriptiveStatistics.r and cerModelExamples.r.
The former contains hints for completing the assignment, and the latter files contains the
code for the doing the examples from class. As in lab 3, copy and paste all statistical
results and graphs into a MS Word document while you work, and add any comments
and answer all questions in this document. Please do not turn in the assignment without
comments!
In this lab, you will analyze continuously compounded monthly return data on the
Vanguard long term bond index fund (VBLTX), Fidelity Magellan stock mutual fund
(FMAGX), and Starbucks stock (SBUX). I encourage you to go to finance.yahoo.com
and research these assets. The script file econ424lab4.r walks you through all of the
computations for the lab. You do not need to show the R commands in your lab write up.
You will use the get.hist.quote() function from the tseries package to
automatically load this data into R. You will also use several functions from the
PerformanceAnalytics package. Remember to install packages before you load them
into R.
Part I: Descriptive Statistics
I. Univariate Graphical Analysis
1) Make time plots of the return data using the R command plot()as illustrated in the
script file econ424lab4.r. Comment on any relationships between the returns
suggested by the plots. Pay particular attention to the behavior of returns toward the
end of 2008 at the beginning of the financial crisis.
2) Make a cumulative return plot (future of $1 invested in each asset) and comment.
Which assets gave the best and worst future values over the investment horizon?
3) For each return series, make a four panel plot containing a histogram, density plot,
boxplot and normal QQ-plot. Do the return series look normally distributed? Briefly
compare the return distributions.
II. Univariate Numerical Summary Statistics
1) Compute numerical descriptive statistics for all assets using the R functions
summary(), mean(), var(), stdev(), skewness() (in package
PerformanceAnalytics) and kurtosis() (in package PerformanceAnalytics).
Compare and contrast the descriptive statistics for the three assets. Which asset
appears to be the riskiest asset?
2) Using the mean monthly return for each asset, compute an estimate of the annual
continuously compounded return (i.e., recall the relationship between the expected
monthly cc return and the expected annual cc return). Convert this annual
continuously compounded return into a simple annual return. Are there any surprises?
3) Using the estimate of the monthly return standard deviation for each asset, compute
an estimate of the annual return standard deviation. Briefly comment on the
magnitude of the annual standard deviations.
III. Historical VaR
1) For each asset compute the empirical 1% and 5% quantiles of the cc returns. Using
these quantiles compute the 1% and 5% historical (monthly) VaR values based on an
initial $100,000 investment. Which asset has the highest and lowest VaR values? Are
you surprised?
III. Bivariate Graphical Analysis
1) Use the R pairs() function to create all pair-wise scatterplots of returns Comment
on the direction and strength of the linear relationships in these plots.
2) Use the functions corrplot() and corrplot.mixed() in the R package
corrplot, plot the correlation matrix of the returns on the three assets.
IV. Bivariate Numerical Summary Statistics
Use the R functions var(), cov(), and cor() to compute the sample covariance
matrix and sample correlation matrix of the returns. Comment on the direction and
strength of the linear relationships suggested by the values of the covariances and
correlations.
V. Time Series Summary Statistics
Use the R function acf() to compute and plot the sample autocorrelation functions of
each return. Do the returns appear to be uncorrelated over time?
Part II: Constant Expected Return Model
Consider the constant expected return model (CER)
Rit  i   it , t  1, , T
 it ~ iid N (0,  i2 )
cov( it ,  jt )   ij
where Rit denotes the continuously compounded return on asset i, i =Vanguard long term
bond index fund (VBLTX), Fidelity Magellan stock mutual fund (FMAGX), and
Starbucks stock (SBUX).
a) Using sample descriptive statistics, give estimates for the model parameters
i ,  i2 ,  i ,  ij and ij . Arrange these estimates nicely in a table. Briefly comment.
 Hint: you already computed these estimates in Part I. Just put them in a table.
b) For each estimate of the above parameters (except ij) compute the estimated
standard error. That is, compute SE ( ˆ i ), SE (ˆ i2 ), SE (ˆ i ) and SE ( ˆij ). Briefly
comment on the precision of the estimates.
 Hint: the formulas for these standard errors were given in class, and are given in
the lecture notes on the constant expected return model
c) For each parameter i ,  i2 ,  i , and ij compute 95% and 99% confidence intervals.
Briefly comment on the width of these intervals.
d) Using the estimated values of i ,  i2 for each mutual fund, compute the normal
distribution 1% and 5% monthly value-at-Risk (VaR) based on an initial $100,000
investment. Compare these values with the historical VaR values computed earlier.
Ruppert, Chapter 4, Section 11 (R lab)
Do problems 1, 2 and 3 (skip discussion of Shapiro-Wilks statistic).