Using contingency tables to measure systematic risk.

Contingency Tables Versus Beta

Question:  Below are two contingency tables describing the relationship between daily stock prices and daily changes in the S&P 500 for two companies.   One of the companies is a high-beta firm.   The other company a low-beta firm.

Movements in Stock Price Versus S&P Company One
Stock Close<Prior Low Stock Between Prior Low and High Stock Close>Prior High
S&P Close < Prior Low 12 18 4
S&P Between Prior Low & High 26 80 28
S&P > Prior High 5 31 48


Movements in Stock Price Versus S&P Company Two
Stock Close<Prior Low Stock Between Prior Low and High Stock Close>Prior High
S&P Close < Prior Low 10 21 3
S&P Between Prior Low & High 19 68 47
S&P > Prior High 14 48 22

The rows of the contingency table were formed by comparing the S&P close to the value of the low or high of the S&P on the previous market day.

The columns of the contingency table were formed by comparing the closing stock price to the low or high of the stock price on the previous day.

What table depicts the high beta stock?    What table depicts the low beta stock?  Defend your answer?

Use Stata to calculate Kendalls Tau B and Spearman’s rank correlation coefficient for the two firms.

How do these non-parametric statistics differ for these two firms?

Discuss implications of these results for future research.


 The count of observations on the diagonal of the contingency tables starting from the top right cell to the bottom left cell of the table represent the number of instances where stock prices move in tandem with the market.

The proportion of observations on this diagonal is 55.6% for company one compared to 39.7% for company 2.

Beta is the most common measure of the movement of stock prices with the market so it is relatively clear that company one has a higher beta than company two.

In fact, company one is Apple and company two is Duke Power.   According to yahoo finance, the beta for Apple is 1.40 and the beta for Duke Power is 0.01.   The values of the proportions of observations on the diagonal of the contingency table appear to correspond to yahoo finance beta estimates.   (Sample size of two is admittedly very small.)

Kendall’s Tau and Spearman’s rho are two statistics commonly used to measure the association between row and column variables of a contingency table.    The table below lists these two statistics for these two companies

Comparison of Non-Parametric Measures of Association Between Stock Price Movements and Market Movements
Apple Duke Ratio Apple to Duke


0.3672 0.0247 14.9


0.3980 0.0658 6.0

Concluding Thoughts:   Financial analysts use beta to measure the price of a stock.   The preliminary results presented here indicate that contingency tables and non-parametric statistics can be used to measure the association between movements company stock price and the overall market.   More research will be available on this topic shortly.

Authors Note:   I am planning the launch of a monthly financial and economics newsletter.  Please follow this blog to obtain advanced notice of this product.


Two Ways to Calculate a Portfolio PE Ratio

Two Ways to Calculate a Portfolio PE Ratio 

Question:  The table below contains data on the market cap and the earnings for four high-tech firms.

Market Cap and Earnings for Four Tech Firms
Market Cap

($ B)


($ B)

AAPL 892.16 46.65
MSFT 585.37 21.2
AMZN 475.37 1.92
TWTR 13.11 -0.44797


In this post, I am asking you to use two methods to calculate the PE ratio of this four-stock portfolio and to confirm that both methods provide the same answer.

Method One:

Calculate the PE ratio of this portfolio by taking the sum of the market cap numbers for the four stocks and dividing by the sum of the earnings of the four stocks.

Method Two:

Calculate the ratio of (market cap minus earnings) divided by market cap for the four stocks.

Calculate a weighted average of the values (MC-E)/MC for the four stocks with the ratio weighted by MC.  Give the name to this weighted average the letter f.

Calculate 1/(1-f).

Show that the PE ratio from method one is identical to 1/(1-f).


The straight forward way to calculate the PE ratio by taking the ratio of the sum of the market caps to the sum of the earnings is presented below.

Portfolio PE Ratio – Method One
Market Cap

($ B)


($ B)

AAPL 892.16 46.65
MSFT 585.37 21.2
AMZN 475.37 1.92
TWTR 13.11 -0.44797
Total 1966.0 69.3 28.4


This four-firm portfolio has a PE ratio of 28.4.

The PE ration calculation for method two  is presented below.


Portfolio PE Ratio — Method Two
Market Cap Earnings (MC-E)/MC Weight
AAPL 892.16 46.65 0.9477 0.4538
MSFT 585.37 21.2 0.9638 0.2977
AMZN 475.37 1.92 0.9960 0.2418
TWTR 13.11 -0.44797 1.0342 0.0067
1966.01 1.0000
f 0.9647
1/(1-f) 28.4


The second method for calculating a PE ratio gives the same result as a the first – 28.4.

Implications:   The PE ratio of a portfolio can be expressed as function of the weighted average of the ratio of the difference between market cap and earnings of the firm to market cap of the firm.    This is a very useful result.

PE ratios of firms are frequently not useful.

First, the PE ratio can become very large when earnings are very small. This means it is misleading to look at a weighted average of PE ratios because one firm can have a a very large impact. In our current example, the PE ratio of Amazon is 248 and the weighted average PE ratio for the four stocks is  77.

Second, PE ratios have no economic meaning when earnings are negative.

The PE ratio of a firm with negative earnings would reduce the weighted average of PE ratios in a portfolio.  By contrast, (MC-E)/MC will be larger than 1 if E is less than 0.

A firm with slightly negative earnings would have a negative PE ratio with a larger absolute value than a firm with very large losses.  This ranking of firms is incorrect because larger losses should be associated with lower relative valuations.   By contrast, (MC-E)/MC will always rise when E falls.

By contrast, the ratio of the difference between market cap and earnings over market cap is inversely related to the valuation of a firm.   When earnings are negative this ratio is greater than one.   When earnings are zero the ratio equals one.   When earnings are very small the ratio approaches one and is not an outlier.  The ratio of the difference between the market cap and earnings to market cap is intuitively defined for all earnings and not impacted by outliers.

In my next post, I will show that statistical tests based on samples of the ratio of the difference between the market cap and earnings to market cap are more useful than statistical tests based on PE ratios.


Measuring Returns for Different Investment-Consumption Patterns

Measuring Returns for Different Investment-Consumption Patterns

Question:   An investment advisor tells his client to invest $1,000 per month in VFIAX (Vanguard S&P fund) for five years.   The person will then live off the proceeds in this fund for 36 consecutive months.

Calculate the return on assets from this investment/consumption plan for two different start dates – January 1, 2002 and January 1, 2003.

What is the NPV of investment returns from this investment strategy/ consumption plan on the same start dates?

What should investors who are planning to save for five years and spend for three years learn from this example?

Mutual funds and ETFs tend to advertise holding period returns based on specific purchase dates and specific sale dates.   These returns are based on the price of securities on two dates only.   What does the example presented here tell you about the usefulness of two-period return statistics reported by mutual funds?

Methodological Note:  The shares purchased each month are $1,000/PVFIAX where PVFIAX is the price of the ETF.   I sum over 60 months to get the total shares purchased, which I will denote TSHARES. The formula for cash inflow for the 36 months are (1/36)*TSHARE*PVFIAX.

The cash inflow/outflow column and the date column are inputted into the XIRR function in Excel to give the IRR of the inflows/outflows on these particular dates. The XNPV function gives net present value of the cash flows.


The value of VFIAX reached its pre financial crisis high in 10/2007 and reached its crisis trough in 02/2009.   Hindsight is 20/20 but it appears as though diversification prior to the downturn would have been beneficial.

What follows are return calculations for the two scenarios.

Results are in the table below.

Returns for Two Investment/Consumption Scenarios
Invest Period Consumption Period IRR NPV
2002/2006 2007/2009 12.04 $15,766
2003/2007 2008/2010 2.98*e-9 $801


  • The person who stopped saving in December 2006 did fairly well despite the financial crisis.The IRR for this investor was 12.04 %.   The NPV of the investments was $15,766.   (NPV calculation assumes a5 percent cost of capital.) 
  • The person who stopped investing in December 2007 realized a return only slightly higher than 0 percent.The NPV of this person’s investment was around $800.

Discussion of Investment Strategy:

In my view, a 100 percent VFIAX strategy is unwise for an investor with this type of investment and consumption period.

How to fix this problem is a more difficult question.  It is important to note that the strategy of putting 100 percent of funds in VFIA for an investor with a start date of January 1 2009 or January 1, 2010 did quite well.

529 plans offer life-cycle funds that drift towards a more conservative investment as the person nears the date where he must spend money.   Lifecycle funds would have done reasonably well for both of the scenarios considered here.  However, the life-cycle approach creates miserable results when the market does poorly in the first few years of the investment period and then rebounds.

My view on how to solve this problem is evolving.  A 60/40 (stock/bond) portfolio would have done well in these time periods but I don’t believe that it will work in the next crash.  Interest rates are now very low and I expect in the next crisis bonds and stocks will crash together.   Perhaps allocating some resources into an inflation-indexed bond fund would help balance returns during the next crisis.

The trend in investment is toward investment in passively managed funds like the ones offered by Vanguard.    This is at best a partial solution.   Investors need help in allocating money across several passively managed funds.  This includes advice on initial allocations and reallocation over time.

I believe there is a need for an actively managed fund that invests exclusively in passively managed funds and reallocated assets across funds as market conditions change.

Note on traditional holding period statistics:  The value of VFIAX in January 2002 was 17.9.  In December of 2010 the value of VFIAX was 39.5.   The return for this 7.9 year  holding period was at 10.5%.

Holding Period Calculation
Jan-03 17.9
Dec-10 39.5
Holding Period in Years 7.92
ROR 10.5%

However a person who started investing in January 2003 and started spending in January 2008 earned squat!   

The mutual funds can legally and honestly report great eight-year or ten-year holding return but their clients aren’t doing particularly well.

Such a surprise!   

Expected Profit and Risk with Random Transaction Dates

Profit and risk when there are four random purchase dates and four random sale dates

Question:   In 2013 a person buys QQQ the high tech ETF) on one of four randomly selected dates determined by when the broker arranges a meeting.   I

The person who bought the QQQ shares in 2014 got fired in 2015.   As soon as the person was fired he realized he needed cash so he called his broker and said “SELL QQQ” The firing is a random event independent of the market and out of control of the person, which occurred on one of four dates.

The four potential purchase and four potential sales dates for the QQQ transactions are presented below.

Information on Potential Purchases and Sales of QQQ
Potential Purchase Date Purchase Price QQQ Quantity purchased $25,000/Price Potential Sale Date Sale Price
20-May-14 88.0 284.1 5-Jan-15 101.4
7-Jul-14 95.1 262.9 8-Aug-15 110.5
7-Aug-14 94.2 265.4 24-Aug-15 98.5
10-Sep-14 100.1 249.8 5-Nov-15 114.7

The person spends $25,000 on the purchase of QQQ in 2014 and sells all shares in 2015.

Assume no dividends are paid.

What are all possible profit outcomes from the purchase and sale of the QQQ securities?

What is the expected profit?

What is the variance of profit?

Analysis:  The number of share purchased is $25,000 divided by the purchase price; hence the purchase price determines the number of shares purchased.

Tabulation of Number of Shares Purchased
Potential Purchase Date Purchase Price QQQ Number of shares purchased
20-May-14 88.0 284.1
7-Jul-14 95.1 262.9
7-Aug-14 94.2 265.4
10-Sep-14 100.1 249.8

Revenue received after the sale is price at time of sale times the number of shares owned.

Profit after the sale is revenue minus the $25,000 initial investment.

There are four possible purchase dates and four possible sale dates.   The purchase and sale dates are independent so there are a total of 16 possible equally likely combinations of sale and purchase dates.   The probability of each purchase/sale combination is 0.0625 (0.25*0.25).

The profit calculation for the 16 purchase-sale combinations is presented in the table below.

Potential Profit Calculation for Four Purchase Dates and Four Sale Dates
Comb # Probability Purchase Date Sale Date Number of Shares Owned Sale Price Profit
1 0.0625 20-May-14 5-Jan-15 284.1 101.4 $3,807
2 0.0625 20-May-14 8-Aug-15 284.1 100.5 $3,552
3 0.0625 20-May-14 24-Aug-15 284.1 98.5 $2,984
4 0.0625 20-May-14 5-Nov-15 284.1 114.7 $7,586
5 0.0625 7-Jul-14 5-Jan-15 262.9 101.4 $1,656
6 0.0625 7-Jul-14 8-Aug-15 262.9 100.5 $1,420
7 0.0625 7-Jul-14 24-Aug-15 262.9 98.5 $894
8 0.0625 7-Jul-14 5-Nov-15 262.9 114.7 $5,152
9 0.0625 7-Aug-14 5-Jan-15 265.4 101.4 $1,911
10 0.0625 7-Aug-14 8-Aug-15 265.4 100.5 $1,672
11 0.0625 7-Aug-14 24-Aug-15 265.4 98.5 $1,141
12 0.0625 7-Aug-14 5-Nov-15 265.4 114.7 $5,441
13 0.0625 10-Sep-14 5-Jan-15 249.8 101.4 $325
14 0.0625 10-Sep-14 8-Aug-15 249.8 100.5 $100
15 0.0625 10-Sep-14 24-Aug-15 249.8 98.5 -$400
16 0.0625 10-Sep-14 5-Nov-15 249.8 114.7 $3,646
Min -$400
Max $7,586
Range $7,986

The minimum profit is -$400.   The maximum profit is $7,985.

The expected profit is obtained by taking the dot product or the sumproduct of the probability vector with the profit vector.   The variance was obtained from the computational formula.

Var (Profit) = E(profit2) – E(Profit)2

For a discussion of these calculations see the previous post.

The expected value and variance or profit from the purchase of QQQ on one of four dates in 2014 and the sale of QQQ on one of four dates in 2015 are presented below.

Expected Profit and Variance of Profit Calculations
E(PROFIT) 2555.4
E(PROFIT2) 11036765.0
E(PROFIT2)-E(PROFIT)2 4506556.2
E(PROFIT-E(PROFIT))2 4506556.2

Financial Discussion:

The purchaser of QQQ or any stock that buys randomly and is forced to sell because of random events unrelated to the market bears substantial risk compared to an investor with enough liquid assets who will not need to sell in an emergency.   Investors would be wise to consider the level of the market and their ability to hold through downturns prior to selling.  The experts say that stock market returns beat returns on other securities over the long haul.  But this investor was only able to hold for a year.

Outcomes could have been worse.   The broker put the investor in QQQ a relatively diversified ETF that focuses on tech stocks.  Had the broker put his client in one particular stock (say IBM) and the investor was forced to sell he would have realized a large loss.

A note on the difference between geometric and arithmetic averages

Question:  The table below has price data and daily return data for Vanguard fund VB.   Calculate the arithmetic and geometric averages of the daily return data.   Show that the geometric average accurately reflects the relationship between the initial and final stock price and the arithmetic average does not accurately explain this relationship.

Daily Price and Returns For Vanguard 

Fund VB

Date Adjusted Close Daily Return
7/1/16 115.480674
7/5/16 113.99773 0.987158509
7/6/16 114.744179 1.006547929
7/7/16 114.913373 1.001474532
7/8/16 117.202487 1.019920345
7/11/16 118.128084 1.007897418
7/12/16 119.451781 1.011205608
7/13/16 119.10344 0.997083836
7/14/16 119.262686 1.001337039
7/15/16 119.402023 1.00116832
7/18/16 119.63093 1.001917112
7/19/16 119.202965 0.996422622
7/20/16 119.959369 1.006345513
7/21/16 119.481646 0.996017627
7/22/16 120.297763 1.00683048
7/25/16 120.019083 0.997683415
7/26/16 120.616248 1.004975584
7/27/16 120.347522 0.997772058
7/28/16 120.536625 1.001571308
7/29/16 120.894921 1.002972507
8/1/16 120.735675 0.998682773
8/2/16 119.12335 0.986645828

Analysis:   The table below presents calculation of the two averages and the count of return days.  The product of the initial value of the ETF, the pertinent average and the count of return days is the estimate of the final value.   Estimates of final ETF value are calculated for both the arithmetic average and the geometric average and these estimates are compared to the actual value of the stock on the final day in the period.

Understanding The Difference Between Arithmetic Mean and Geometric Mean Returns
Statistic Value Note
Arithmetic Average of Daily Stock Change Ratio 1.001506208 Average function
Geometric Average of Daily Stock Change Ratio 1.001479966 Geomean function
Count of Return Days 21 Count Function
Estimate of final value based on arithmetic average 119.1889153 Initial Value x Arithmetic Return Average x Count Days
Estimate of final value based on geometric average 119.12335 Initial Value X Geometric Return Average x Count Days
Ending Value 119.12335 Copy from data table

There is another way to show that the daily return should be modeled with the geometric mean rather than arithmetic mean.  The average daily return of the stock is (FV/IV)(1/n) – 1 where FV is final value and IV is initial value and n is the number of market days in the period, which for this problem is 21.

Using this formula we find the daily average holding period return is 0.001479966.  Note that 1 minus the geometric mean of the daily stock price ratio is also 0.001479966.

The geometric mean gives us the correct holding period return.