## 5.7 Problems: Descriptive Statistics

**Exercise 5.1**Compute time plots with

*ggplot2*function

`autoplot()`

**Exercise 5.2**In this question, you will compute descriptive statistics for the continuously compounded monthly return data on the Vanguard long term bond index fund (VBLTX), Fidelity Magellan stock mutual fund (FMAGX), and Starbucks stock (SBUX). You will use the R packages

**corrplot**,

**IntroCompFinR**,

**PerformanceAnalytics**,

**tseries**and

**zoo**.

- Downloading data and return calculations.
- Use the
**tseries**function`get.hist.quote()`

to download from Yahoo! the monthly adjusted closing prices on VBLTX, FMAGX and SBUX over the period 1998-01-01 through 2009-12-31. Download these prices as`"zoo"`

objects. - Use the
**PerformanceAnalytics**function`Return.calculate()`

to compute continuously compounded monthly returns and remove the first NA observation.

- Use the
- Univariate graphical analysis.
- Make time plots of the return data using the
**zoo**function`plot.zoo()`

. 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. - Make a equity curve/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?
- For each return series, use the
**IntroCompFinR**function`fourPanelPlot()`

to make a four-panel plot containing a histogram, boxplot, normal QQ-plot, and SACF plot. Do the return series look normally distributed? Briefly compare the return distributions. Do you see any evidence of time dependence in the returns?

- Make time plots of the return data using the
- Univariate numerical summary statistics and historical VaR.
- Compute numerical descriptive statistics for all assets using the R functions
`summary()`

,`mean()`

,`var()`

,`stdev()`

, and the**PerformanceAnalytics**functions`skewness()`

and`kurtosis()`

. Compare and contrast the descriptive statistics for the three assets. Which asset appears to be the riskiest asset? - 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?
- 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.
- 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?

- Compute numerical descriptive statistics for all assets using the R functions
- Bivariate graphical analysis and numerical summary statistics
- 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. - Use the
**corrplot**functions`corrplot()`

and`corrplot.mixed()`

to plot the correlation matrix of the returns on the three assets. - 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.

- Use the R

**Exercise 5.3**In this question, you will compute descriptive statistics for the continuously compounded weekly return data on the Vanguard long term bond index fund (VBLTX), Fidelity Magellan stock mutual fund (FMAGX), and Starbucks stock (SBUX). Repeat the analysis for the monthly returns but use instead weekly returns computed from end-of-week adjusted closing prices.

**Exercise 5.4**In this question, you will compute descriptive statistics for the continuously compounded daily return data on the Vanguard long term bond index fund (VBLTX), Fidelity Magellan stock mutual fund (FMAGX), and Starbucks stock (SBUX). Repeat the analysis for the monthly returns but use instead daily returns computed from end-of-day adjusted closing prices.

**Exercise 5.5**In this problem you will analyze the monthly simple returns on the Vanguard S&P 500 index (VFINX) and Amazon stock (AMZN) over the 5-year period January 2010, through January 2015. For this period there are T=60 monthly returns. The monthly prices for VFINX are in the

**IntroCompFinR**object

`VangardPrices`

and
the daily prices for AMZN are in the **IntroCompFinR**object .

- Compute simple monthly returns on AMZN and VFINX and plot these returns together in a single plot. Do the monthly returns from the two assets look like realizations from a covariance stationary stochastic process? Why or why not?
- Compare and contrast the return characteristics of the two assets. In addition, comment on any common features, if any, of the two return series.
- Plot the cumulative simple returns (equity curve) for each fund, which represents the growth of $1 invested in each fund over the sample period, and plot these returns in the same graph. Which fund performed better over the sample?
- Using the
**IntroCompFinR**function`fourPanelPlot()`

, create descriptive statistics plots for each asset. In addition, compute Based on statistics, do the returns on VFINX and AMZN look normally distributed? Is there any evidence of linear time dependence? Briefly justify your answer. - Which asset appears to be riskier? Briefly justify your answer.

**Exercise 5.6 (Descriptive statistics for weekly data) **
* Create weekly time series for MSFT, SP500

Repeat graphical and numerical descriptive statistics

Deduce stylized facts for weekly data

**Exercise 5.7 (Rolling descriptive statistics for daily data)**