Aan de slagGa gratis aan de slag

Estimating Beta

Now that you have calculated the monthly returns, you can estimate the beta for Mylan using regression analysis. The data object rets you calculated previously is stored in memory.

When you regress the company return (ticker: MYL) on the market index return (ticker: SPY), beta is the resulting coefficient for the market index return in that regression. In this exercise, we want to perform a regression of myl on spy using the lm() function and then extract the beta from the regression summary.

Note: To extract beta, recall that it is the second element of the coefficient matrix (i.e., coeff[2]).

Deze oefening maakt deel uit van de cursus

Equity Valuation in R

Cursus bekijken

Oefeninstructies

  • Run a regression of MYL return on SPY return.
  • Extract beta from the regression and store in beta variable.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Run regression
reg <- ___

# Save beta
beta <- ___
beta
Code bewerken en uitvoeren