Problem 6: Sampling Frequency and Portfolios

Get the 11 stock monthly and daily returns. Make sure to download the daily file again because I modified vwret which had a timing issue. Make the 11 stock portfolio. Now regress them all on the market return and fill Table 1

1

In Row Average, put the average of the statistics for the 11 stocks. Use the row Average to build intuition to answer the questions below

2

Problem 7: Typical Output Analysis

Consider the AAPL regression on daily returns. For each diagnostic plot, indicate what it is supposed to detect, and if you find anything suspicious for the regression. You don’t need to show a normal probability plot but check for yourself that it is very non normal.

a) Standardized residuals vs the market return in Figure 1.

b) Absolute value of the standardized residuals vs the market return in Figure 2.

d) Autocorrelation function of the standardized residuals in Figure 3. Do not use the standard acf command. Instead, use the library: forecast, and use the Acf command (with uppercase A).

3

For Problem 6, you can loop around lm for the 12 regressions. You can also do them all with: mymod <- lm( stkrets~rm) # creates the 12 regressions

modsum<-summary(mymod) # creates the summary object with all the good stuff in it.

coefficients(mymod) # also works to print the output with estimates and std.errs.

But mymod is a multivariate linear model object, a list where each regression is an item in the list, then each regression is itself a list. Same for modsum. It makes it hard to retrieve in a vector for example, all the standard errors. To see the problem, do names(mymod), names(modsum).

Some commands don’t work. You can’t use things like: confint(mymod)

What we want is not two steps down in the hierarchy of the list ( of list)

You can extract it with the lapply (ell apply!) and sapply commands. They are similar to apply

but work to extract components of lists. In coefficients(mymod), you see in what order the output is. Now try this for example, you will see what it does:

lapply(modsum, coefficients) is exactly the same as coefficients(modsum). But is is now a list with 12 items. This takes what we need from it: sapply(lapply(modsum,coefficients),'[‘,c(2,4))

              coefficients output for all                   ‘[‘ says to                     c(2,4) takes

elements 2 and 4

              regressions                                   go down one level