讲解Markdown、辅导R程序设计、讲解HTML留学生、辅导R

- 首页 >> 其他


Homework 1

YOUR NAME HERE

Due Thursday 1/31 by Midnight

PLEASE SUBMIT ONE OF THE FOLLOWING TO BLACKBOARD:

1. The PDF or HTML generated from this .Rmd file

Your code, output, and any answers should be included

2. A .R file with your work, and a word document with your write-up/solutions.

If you are not familiar with R Markdown and want to use it, you can come by my office or speak with a

classmate. I recommend it, as it’s quite convenient, but it’s your choice.

The goal of this homework is to give you practice fitting and interpreting the simple linear regression model in

R. It will also introduce you to one of the few business applications in which regression with a single covariate

is used in practice; calculating a stock’s “Beta”, or predicting how a stock will respond to movements in the

broader market. If you are curious about it, see http://www.investopedia.com/terms/b/beta.asp.

The dataset returns.csv contains monthly returns (in %) for the S&P 500 as well as three individual

companies. The variables are:

SP500 - monthly returns for the S&P 500

KO - monthly returns for Coca-Cola

AAPL - monthly returns for Apple

BAC - monthly returns for Bank of America

Download the data from Blackboard and load it below.

returns <- read.csv('https://s3.amazonaws.com/douglas2/MAS432/returns.csv')

1. Start by summarizing each variable. Include, at minimum, numerical summaries of the return variables

(SP500, BAC, AAPL, KO).

# Your code here

2. Assess the normality of the returns for BAC, AAPL, and KO and discuss what your findings imply for

the appropriateness of the linear regression model.

# Your code here

3. Using scatterplots, investigate the relationship between the S&P500 (the X variable) and each individual

stock’s returns (the Y variable). Does the relationship appear approximately linear?

# Your code here

4. Fit simple linear regression models to predict returns for BAC, AAPL, and KO as a function of the

SP500.

# Your code here

5. Report the slope parameters for each of these models.

βBAC = your answer here

βAAP L = your answer here

βKO = your answer here

6. How do you interpret the slope parameter? Based on your answer, which of the three stocks would you

recommend to someone who is risk averse and does not like volatility in their portfolio?

your answer here

7. How do you interpret the intercept parameter? Is the intercept meaningful in this application?

1

your answer here

8. Which model had the highest R2 and what was it? What do you think this says about the fit of the

model, and why?

your answer here

9. Provide an estimate, 95% confidence interval, and 95% prediction interval for Apple returns if the S&P

500 rises 5%.

your answer here

10. You can check your β’s by going to finance.yahoo.com and entering the company symbol in the search

at the top. The measure Beta is given in the second column of info near the top. Note that depending

when you check, Yahoo may have updated the estimate to include new data that, but your estimate

should be reasonably close.

Beta is always calculated using simple linear regression. However, if you look elsewhere - for

example, Google finance - you’ll see a different (sometimes substantially) value reported. How is

that possible?

your answer here