Warren Buffett’s Intrinsic Value Calculator

In this post I will summarize how one can compute the intrinsic value of a company according to the below quote from Warren Buffet:

“Intrinsic value can be defined simply: It is the discounted value of the cash that can be taken out of a business during its remaining life.”

The sum of cash that can be taken out of the business over the next ten years is going to be the dividends plus the equity growth. Let us consider Disney (NYSE: DIS) over the period 2002 – 2011:

Year EPS Book Value Dividend
2002 NA $11.61 NA
2003 $0.65 $11.82 $0.21
2004 $1.11 $13.05 $0.24
2005 $1.19 $13.06 $0.27
2006 $1.60 $15.42 $0.31
2007 $2.24 $15.67 $0.35
2008 $2.28 $17.73 $0.35
2009 $1.76 $18.55 $0.35
2010 $2.03 $19.78 $0.40
2011 $2.52 $21.21 $0.60
SUM $15.38 $9.60 $3.08

We can see that Disney’s book value grew over by $9.60 in the period of 2002 – 2011 and the total dividends collected were $3.08. In other words the total earnings per share of $15.38 materialized in a total $12.68 for the shareholders over that period.

Using the above table we can easily calculate the Compound Annual Growth Rate, r, of Disney’s book value in order to estimate how much the book value will be in 10 years if we were to compound its current value, Current\_Book\_Value, which is $21.21 as of 2011, at that rate for 10 years (Future\_Book\_Value):

Future\_Book\_Value = Current\_Book\_Value\times(1 + r)^{10}

Once we have our future book value, Future\_Book\_Value, we will discount it with a rate d in order to compute the present value of that future value. d is usually the yield of  the 10 year federal note. The reason we are discounting with d is, because we want to compare it with something that we have total confidence in. In other words, how much money would we need to invest now in a 10 year federal note (which is a lot less risky than stock in a company), with a yield of d in order to have Future\_Book\_Value (which is what Disney’s book value will be) in ten years from now.

Present\_Value\_Of\_Future\_Book\_Value = \frac{Future\_Book\_Value}{(1 + d)^{10}}

For our example above, we have already computed r, which is r=0.0692. This will give us a:

Future\_Book\_Value=21.21\times(1 + 0.0692)^{10}=41.4123$

Discounting it with the 10 year federal note yield of d = 1.71\% will give us:

Present\_Value\_Of\_Future\_Book\_Value = \frac{41.4123}{(1 + 0.0171)^{10}} = 34.9536$

That is, investing $34.95 now in a 10 year federal note with a yield of d = 1.71\%, will lead to $41.41 in 10 years from now, guaranteed. If Disney is trading above $34.95, then we are better of investing in the sure thing, the 10 year federal note, assuming Disney does not pay any dividends. But, because we still get paid dividends from Disney, let ‘s go ahead and include them in our calculations as well before we decide if we want to invest in the company.

Next, we will also want to include any future dividends. If we assume that Disney will continue to pay its $0.60 dividend for each of the next ten years, we will see the following stream of cash flows in our pockets:

DCF_1 + DCF_2 + \dots + DCF_{10}

with DCF_i being the dividend cash flow on year i. Similar to the Future\_Book\_Value we will want to discount it with d. So the present value of all future dividend cash flows will be:

Present\_Value\_Of\_Future\_Dividend\_Cash\_Flow = \frac{DCF_1}{(1 + d)^1} + \frac{DCF_2}{(1 + d)^2} + \dots + \frac{DCF_{10}}{(1 + d)^{10}}

or in short:

Present\_Value\_Of\_Future\_Dividend\_Cash\_Flow = \sum_{i=1}^{10} \frac{DCF_i}{(1 + d)^i}

For d = 1.71\% and our assumption that Disney will pay out a $0.60 dividend each year, this would be (using this calculator):

Present\_Value\_Of\_Future\_Dividend\_Cash\_Flow = \frac{0.60}{(1 + 0.0171)^1} + \frac{0.60}{(1 + 0.0171)^2} + \dots + \frac{0.60}{(1 + 0.0171)^{10}} = $5.47

Once we have our Present\_Value\_Of\_Future\_Book\_Value and Present\_Value\_Of\_Future\_Dividend\_Cash\_Flow, all that is left to do in order for us to figure what Disney is worth today (intrinsic value) is to sum up those two values, which is $34.95+$5.47=$40.42. In other words, if we were to buy Disney at a price of $40.42, we would make a 1.7% annual return on our money for the next ten years. As of the time where this data was taken, Disney was trading at $44.33, which makes it overvalued. So if we were to choose between the 10 year federal note and Disney, we would go for the 10 year federal note because we are getting our 1.7% annual return at zero risk.

You can use the following Python script to fetch ten year data from Morningstar for a given stock symbol and compute its intrinsic value:

import urllib
import sys
import pandas as pd


def main():
    # Get stock ticker and discount rate
    ticker, discount = get_user_input()

    # Get Key Ratios from Morningstar
    kr_df = ratios_download(ticker)

    # get book values
    book_values, dividend = get_book_div(ticker, kr_df)

    average_book_change, years = calculate_average_book_change(book_values)

    intrinsic_value = calculate_intrinsic_value(book_values, average_book_change, years, ticker, dividend, discount)


def get_user_input():
    ticker = input('\nEnter stock ticker to research: ')
    discount = float(input('\nEnter discount rate (10y TNote): '))
    return ticker, discount


def ratios_download(ticker):
    # Get key ratios from Morningstar
    try:
        url = 'http://financials.morningstar.com/ajax/exportKR2CSV.html?&callback=?&t=' + ticker + '&region=usa&culture=en-US&cur=USD&order=asc'
        kr_df = pd.read_csv(url, skiprows=2, index_col=0)
        # df.to_csv('test.csv')
        return kr_df
    except Exception as e:
        print("------------------------")
        print('Could not find ticker on Morningstar: %s \n' % ticker)
        print('Check ticker spelling and that data exists:\n')
        print(url)
        print('\nError: %s' % e)
        print()
        main()


def get_book_div(ticker, kr_df):
    # Get book value history
    book_values = kr_df.loc['Book Value Per Share * USD']
    print('\nBook Value History')
    print(book_values)

    # Get Dividend History
    dividend_history = kr_df.loc['Dividends USD']

    print('\nDividend History:')
    print(dividend_history)

    # Get user input for expected dividend
    dividend = float(input('\nChoose expected dividend: 
))

    return book_values, dividend


def calculate_average_book_change(book_values):
    # get years over which to calculate average change.
    # remove TTM and initial year
    years = book_values.size - 2
    print('\nNumber of years: %i' % years)

    # calculate average book value change
    base = float(book_values[-2]) / float(book_values[0])
    upper = 1 / years
    a = base**upper
    average_book_change = 100 * (a - 1)

    print('\nAverage change in book value: %6.2f%% ' % average_book_change)

    # warn if growth company
    if average_book_change >= 15:
        print('Warning - average book value change is high.  Stock may be growth company.  Consider a DCF value calculation')

    return average_book_change, years


def calculate_intrinsic_value(book_values, average_book_change, years, ticker, dividend, discount):
    discount = discount / 100
    current_book_value = float(book_values[-1])

    print('\nCurrent Book Value: $%6.2f' % current_book_value)

    # Compute the book value of the company if we compund it for 10 year at a rate of 'average_book_change'
    # FV = PV (1 + average_book_change)^10
    compounded_book_value = current_book_value * (average_book_change / 100 + 1) ** 10

    # Compute the present value of the future book value (compounded value) if we discound it with a rate 'discount'
    # PV = FV / (1 + discount)^10
    present_value_of_compounded_book_value = compounded_book_value / ((1 + discount)**10)

    # For the dividend we just calculate the Present Value of future cash flows:
    #   present_value_dividend_flow = SUM (Dividend_i/(1 + r)^i)
    # with i =1..10 and r=discount
    present_value_dividend_flow = 0
    for i in range(1, 11):
        present_value_dividend_flow += dividend / (1 + discount)**i

    intrinsic_value = present_value_dividend_flow + present_value_of_compounded_book_value

    print('\nIntrinsic Value (10-year): $%6.2f \n' % intrinsic_value)


if __name__ == "__main__":

    main()