This page runs one real CAPM estimate from start to finish. First we download prices and build returns. Then we fit a line to get β and α and ask what they mean. At the end we use β to get the return investors should require. Everything uses real data from Yahoo Finance and FRED.
Stock or fund, grouped by its β (5 years of monthly returns against SPY)
Load a price file for any stock: a CSV downloaded from Yahoo Finance, or the Historical Data table selected and copied from the Yahoo page. You can also replace the market index or the risk-free rate with your own file, for example a FRED CSV. Files stay in your browser and are not uploaded anywhere.
Stocks and the market need a date column and a price column (Adj Close is used when present). Daily, weekly or monthly prices all work. The risk-free rate needs a date and an annual rate in percent, as in FRED's TB3MS or DTB3.
Part I · Get the data
Where (stock): Yahoo Finance → → Historical Data.
Settings: Time period = the last years, Frequency = . Download the file, or select the table and copy it into Excel.
Keep: the date and the Adj Close column.
Yahoo shows two price columns. Close is the price as it was quoted that day. Adj Close is rewritten after the fact to account for stock splits and dividends. Here are both for :
The CAPM is about returns, not prices. Each period's return is the percent change in Adj Close:
In Excel, with Adj Close in column B starting in row 2, type =B3/B2−1 in C3 and fill down. The most recent :
The CAPM compares excess returns: what the stock and the market earned beyond a riskless Treasury bill.
Where: FRED, the St. Louis Fed's free data site. For monthly returns use TB3MS (3-month T-bill, monthly). For weekly returns use DTB3 (the same bill, daily). Click Download → CSV.
Careful: FRED quotes an annual percent, like 4.25. Divide by 100, then by , to get a rate: .
Where: the same Fama–French file. Its RF column is the return on a 1-month T-bill during that , already per .
Careful: only divide by 100: =RF/100. Do not divide by 12 again. And Mkt-RF is already the market's excess return, so for the market this step is done for you.
Part II · Estimate β and α
Each dot is one . Left to right is the market's excess return that ; bottom to top is 's. Try to draw the line that best follows the cloud. Dashed segments are your line's misses.
Excel's =SLOPE(stock excess, market excess) and =INTERCEPT(…) pick the one line with the smallest total squared miss. That is all a regression is.
The best-fitting line has an exact formula, so nobody really has to search for it. Write Ri for the stock's excess return and Rm for the market's, in each of the n s, and put a bar on top for an average. Then:
β is the covariance of the stock with the market, divided by the variance of the market. In words: in the s when the market was above its average, how far above its own average was the stock, relative to how far the market moved? Once β is known, the line must pass through the point of averages, which gives α:
And R², the share of the stock's variance explained by the market:
With the data above:
β, the slope, says how much the stock moves with the market. α, the intercept, is where the line crosses the vertical axis: the stock's average excess return in a when the market did exactly zero. ε, the miss, is each dot's distance from the line: the firm-specific part of that , such as earnings surprises, product news, or lawsuits.
How sure are we about β? A different stretch of history would give a somewhat different line. The reasonable range above is wide for volatile stocks and short windows.
Pick any , or click a dot above. Using Excel's best line, the stock's return splits into three pieces. It starts on the with the biggest firm-specific surprise.
What we are doing: using the line from Step 4 to split the stock's risk into two pieces. Risk here means variance, the average squared distance of returns from their mean. Because every return is market part + α + miss, and the misses are unrelated to the market, the variances add up:
Step by step, for (all numbers per ):
Now diversify. Suppose you split your money equally across N stocks like this one: same β, but each with its own unrelated firm news. Every stock feels the same market, so the market part stays. The firm-specific parts partly cancel: good news at one firm offsets bad news at another, and their variance shrinks by a factor of N:
Why this matters for the CAPM. Firm-specific risk is easy to get rid of, so investors are not paid for bearing it. Market risk cannot be diversified away, so that is the risk that has to earn a reward. β measures how much market risk a stock adds, which is why β is the only input in the CAPM.
The computer invents a fake stock with the same β and the same amount of firm-specific noise, but a true α of exactly zero. It lives through the same market history, and we run the same regression. Any α it shows is pure luck. Repeat many times.
Reading it. A stock with a lot of firm-specific noise can show a large α over a few years by luck alone. And with thousands of stocks out there, some will land far out in the tail by chance. Looking back and picking the winner is easy. Knowing in advance which stock will have a positive α is not. That is why the CAPM treats the expected α as zero.
There is no single "correct" β. Analysts choose how far back to look and how often to measure returns. Each choice changes every step above.
Yahoo Finance reports a β for every stock and fund, labeled Beta (5Y Monthly): 5 years of monthly returns against the S&P 500, the same recipe as the ◂ cell when you choose 5 years, monthly and SPY. Open the links and compare. Small differences are normal, because each data provider makes slightly different choices: the exact months, the index with or without dividends, and whether to subtract the risk-free rate.
Adjusted β. Very high and very low βs tend to drift back toward 1 over time. So data providers such as Bloomberg report an adjusted β = ⅔ × raw β + ⅓ × 1.
Part III · From β to the CAPM
What we are doing: connecting everything so far to the Portfolio Optimizer from class, where each investor finds the portfolio with the highest Sharpe ratio. The CAPM is what you get when everyone uses the Optimizer with the same inputs. Four steps:
So the Optimizer and the CAPM are the same idea at two levels: one investor choosing a portfolio, and the whole market in equilibrium. It also explains α from Step 7: a positive α is a reason to tilt away from the market, because adding that asset would raise your Sharpe ratio.
Each dot is one asset from the top of the page, placed at the return the CAPM requires for it. The risk-free rate and premium come from Step 11 (defaults: T-bill and 6%), and σ and β from the window you selected. Switch the horizontal axis and watch the dots.
One stock only gives us a β. The CAPM makes a claim about all stocks together: average returns should rise in a straight line with β. The line starts at zero for β = 0 (T-bills) and passes through the market at β = 1. This is the security market line.
To test it, researchers sort all U.S. stocks every year by β into ten groups. Each dot is one group, measured from July 1963 to August 2026.
What the picture says. Higher β does come with somewhat higher average returns, which is the core CAPM idea. But the real line is flatter than the CAPM line: low-β stocks did better than predicted, and high-β stocks did worse. It is one of the best-known findings in finance, and part of why later models add factors like SMB and HML.
What we are doing: getting ready to compute the return investors should require from , per year, going forward. The CAPM formula needs three inputs:
β comes from the past because we cannot observe the future co-movement, so we use history as our best guess. It has no units, so a β estimated from ly data can be used directly with annual rates. The other two inputs describe today, because we want the return investors require from now on.
Take the current yield on a U.S. Treasury, as an annual rate. Nothing to convert: FRED already quotes it per year, and the answer we want is per year.
This is how much more than the risk-free rate investors expect to earn from the whole stock market in a typical year: E[rm] − rf. It cannot be looked up; it has to be estimated. Three common ways:
Step 12 plugs your three inputs into the formula.
All assets under the same choices, from lowest to highest required return:
Look at the ranking. Low-β assets such as Coca-Cola, utilities and gold move little with the market, so investors ask for little more than the risk-free rate. High-β assets such as Nvidia and the leveraged funds amplify market swings, so they need a much higher expected return to be worth holding. Negative-β assets, such as the short S&P 500 fund and the volatility fund, need less than the risk-free rate. They pay off when everything else falls, so they work like insurance, and investors accept a low or even negative expected return for that protection. How risky an asset is on its own plays no role. Only β does.
With 5 years of monthly data, NVDA's β is against SPY (with FRED's TB3MS as the risk-free rate) and against the Fama–French market (with French's RF). Excel Exercise 2 follows this page's default (SPY and TB3MS), so its β of 2.21 matches the first number; its last question asks for the Fama–French version too. Same idea, slightly different ingredients. Data: Yahoo Finance adjusted closes; FRED series TB3MS, DTB3 and DGS10; the Fama–French market factor and risk-free rate (monthly and weekly), ten beta-sorted portfolios and the historical premium from Kenneth French's Data Library. Step 7 simulates normally distributed firm-specific shocks.