General one-factor linear model 
/////////////////////////////////
1-factor linear model has the following form:
  
    y= alpha + beta *x

  where y   is the dependent variable
        x   is the independent variable
      alpha is the intercept
      beta  is the slope

  We try to use x plus a and b to explain or predict y

  1-factor: since we have just one independent variable
 
  linear : a) if we draw a graph based on y and x, 
              it is a straight line

           b) the power of the independent variable, i.e., 
              x is one.

/////////////////////////////////

Formulae for CAPM
/////////////////////////////////
CAPM
      E[R(i)] = Rf + beta *[R(m)-Rf]                (1)

   where E[]    is the expectation 
         R(i)   is for stock i's return 
         Rf     is the risk-free rate 
         beta   is the market risk (slope)
         R(m)   is the market return

To estimate beta, we run the following regression 

    R(i,t) = Rf(t) + beta *[R(m,t)-Rf(t)] + e(t)    (2)

   where R(i,t) is the stock i's return at time t
         Rf(t)  is the risk-free rate at time t
         beta   is the market risk (slope)
         R(m,t) is the market return at time t
         e(t)   is a random factor
 
For example, for IBM, we have the following form. 
    to make our notation clear, we drop the notation of t

    R(IBM)  = alpha + beta *[R(m)-Rf] + e           (3)
    
Sometime, we write the following way:

     R(IBM)- Rf = alpha + beta *[R(m)0 - Rf]        (4)

  The interpretation of Equation (4) is clearer. 
      The left-hand side is the risk premium for IBM
      It is the product of two factors: 
                 a) market risk of IBM, and 
                 b) the market risk premium
  
/////////////////////////////////

market risk, firm specific risk, total risk  
/////////////////////////////////

 Total risk = market risk + firm specific risk

      sigma: total risk 

      beta : market risk

/////////////////////////////////

manually download historical data from Yahoo!Finance
/////////////////////////////////
We have the following steps 

   Step 1: go to finance.yahoo.com
 
   Step 2: enter a ticker, such as ibm
   
   step 3: click "historical data" 
 
   step 4: choose beginning and ending dates
           frequency 

   Step 5: click "Apply"

   Step 6: download to your spreadsheet

/////////////////////////////////