Tuesday, September 18, 2012

Modeling Price Fluctuations

The premise of this post is that the movements in price of a security (e.g. stocks, bonds) can be viewed as a random process. Whether or not this is a valid assumption is somewhat of a philosophical question. The price of a security entirely depends on the factors of supply and demand, which are in turn deterministically governed by a multitude of more subtle factors. But like the outcome of a flip of a coin, which is completely determined by the equations of physics and the parameters of the system, such processes are much to complex to analyze in full generality. As a result, we model it as a stochastic process whose variance comes from all of these latent factors.

An illustration of random walks

Problem Statement and Assumptions

We are given the initial price \(P_0\) and we want to make inferences about the future stock price \(P_T\). The random variables \(P_i\) must also be non-negative. The time scale here is arbitrary and can be made as large or small as necessary.

Our key assumption here is that the changes in price are independent and identically distributed (iid). We characterize the price change as the ratio \[C_i = \frac{P_i}{P_{i-1}}\] Note that we didn't use a straightforward difference (\(P_i-P_{i-1}\)). The reason is because the difference most certainly isn't iid (a price of $1 has support on \([-1,\infty]\) whereas a price of $2 has support on \([-2,\infty]\)). You'll notice that our characterization corresponds to a percentage difference (plus one).

The Normal Distribution

The normal distribution (also known as the bell curve, the Gaussian, etc.) is ubiquitous in modeling random variables. And so it would be reasonable to conjecture that \(P_T\) is normally distributed. \[ f_{\mu,\sigma^2}(x) = \frac{1}{\sqrt{2\pi \sigma^2}}e^{-\frac{(x-\mu)^2}{2\sigma^2}} \]
The normal distribution

However in a similar vein as to why we didn't use the difference in price as our characterization of change, the normal distribution doesn't have the correct support. If we had used the distribution as our model, we would have found that the model would assign a positive probability to the future price being less than 0.

Logarithms to the Rescue

Okay, let's actually do the math without resorting to guessing. The price \(P_{1}\) can be expressed as \(C_1 \times P_0\), and \(P_{2}\) as \(C_2 \times P_1\), and so on. Inductively continuing this process yields \[ P_T = C_T C_{T-1} \dots C_1 P_0 \] Thus we have that \(P_T\) is proportional to the product of \(T\) iid random variables. The trick is to turn this product into a sum so then we can apply the central limit theorem. We do this by taking the logarithm of both sides \[ \begin{align*} \log P_T &= \log(C_T C_{T-1} \dots C_1 P_0) \\ &= \log C_T + \log C_{T-1} + \dots + \log C_1 + \log P_0 \\ &\thicksim N(\mu,\sigma^2) \end{align*} \] Since the \(C_i\)s are iid, their logarithms must also be iid. Now we can apply the central limit theorem to see that \(\log P_T\) converges to a normal distribution! The exponential of a normal distribution is known as the log-normal distribution so \(P_T\) is log-normal. \[ g_{\mu,\sigma^2}(x) = \frac{1}{x\sqrt{2\pi \sigma^2}}e^{-\frac{(\log x-\mu)^2}{2\sigma^2}} \]
The log-normal distribution

As a sanity check, we see that the support of the log-normal is on \((0,\infty]\) as expected.

But wait there's more!

In the beginning we noted that the choice of time-scale is arbitrary. By considering smaller time scales, we can view our \(C_i\)s as the product of finer grained ratios. Thus by the same argument as above, each of the \(C_i\)s must also be log-normally distributed.

Experimental Results

I took ~3200 closing stock prices of Microsoft Corporation (MSFT), courtesy of Yahoo! Finance from January 3, 2000 to today. I imported the data set into R and calculated the logarithms of the \(C_i\)s. I then plotted a normalized histogram of the results and overlaid the theoretical normal distribution on top of it. The plot is shown below:


Discussion

As you can see, the theoretical distribution doesn't fit our data exactly. The overall shape is correct, but our derived distribution puts too little mass in the center and too little on the edges.

We now must go back to our assumptions for further scrutiny. Our main assumption was that the changes are independent and identically distributed. In fact, it has been shown in many research papers (e.g. Schwert 1989) that the changes are not identically distributed, but rather vary over time. However, the central limit theorem is fairly robust in practice. Especially under a sufficiently large of samples, each "new" distribution will eventually sum to normality (and the sum of normal distributions is normal).

I suspect that the deviation from normality is primarily caused by dependence between samples. The heavy tails can be explained by the fact that a large drop/rise in price today may be correlated to another drop/rise in the near future. This is particularly true during times of extreme depression or economic growth. A similar argument can be made about the excess of mass in the center of the distribution. It is conceivable that times of low volatility will be followed by another time of low volatility.

Conclusion

While our model might not be perfect in practice, it is a good first step to developing a better model. I think what you should take from this is that it is important to experimentally verify your models rather than blindly taking your assumptions as ground truths. I'll conclude this post with a few closing remarks:
  • Many people actually do use the normal distribution to model changes in prices despite the obvious objections stated above. One can justify this by noting that the distribution of \(C_i\) in practice is usually close to 0. Thus the first order approximation \(e^x \approx 1+x\) is fairly accurate.
  • The histogram and fit shown above can be reproduced for almost any stock or index (e.g. S&P 500, DJIA, NASDAQ)
  • R is a great piece of software but has god awful tutorials and documentation. I am not in a position to recommend it yet because of this.

Friday, August 31, 2012

Valuation Techniques: Liquidation value

This is part of a series on valuation techniques.

When we talk about the value of a company, there are two fundamental components associated with it: assets and income. Very simplistically, we can view a company as a black box holding assets that grow over time in a stochastic manner.

I will define the liquidation value of a company as the net worth of a company's tangible assets in event of a bankruptcy.

How it useful?

Unfortunately, liquidation value isn't an accurate measurement of the intrinsic value of a company. Then how is it at all useful to an investor?

Neither accuracy nor precision are necessary conditions to make a profit in investing. The only necessary condition to successful investing is arbitrage. As long as we can buy a security for less than what it's worth, a profit can be made. Even if we don't know precisely what a security is worth, we need only to establish sufficiently tight lower bounds on the price to determine if it is a worthwhile investment.

That is exactly what the liquidation value is meant to provide. While it is difficult to predict the future earnings of a company, we still have a lower bound given by what the company currently holds. These figures are reported regularly on the balance sheet in financial statements.

Valuation Techniques

Investing ultimately comes down to the ability of an individual to value a company and the associated risks of such a valuation. There are hundreds of different models and techniques in use today, both simple ones devised by humans and enormously complex ones used in algorithmic trading.

I don't believe that there is one magic, all-encompassing, algorithm that will perform optimally in all (or even most) scenarios. The issue is that every company has a different business model, each of which would require a different model for valuation. This task is rather intractable, and so it is the job of the investor to be able to create robust models that hold under reasonable approximations. In addition, he must be able to understand which approximations hold for which businesses, and use the appropriate model.

Many present models involve looking at one aspect of a business, such as dividends, cash flow, earnings, etc. From these, you can derive dividend discount model, discounted cash flow, and P/E relative valuations, respectively. But naturally, these are rather crude in the sense that they don't look at all of the variables. And combining different valuation schemes is a non-trivial process.

In this series of articles, I will start with a set of assumptions and derive some models for valuation using these approximations. This post will be edited as articles are added.
  1. Liquidation value
  2. Dividend Discount Model

Tuesday, August 28, 2012

Hewlett-Packard (HPQ) Qualitative Analysis

Over the past week, Hewlett-Packard Company (ticker: HPQ) has fell over 17% to the current price of $16.83 per share. This drop was largely due to the company's recent 2012 Q3 earnings report released after hours on August 22, where they reported a net earnings loss of 8.9B.
The PC isn't going away any time
soon

On the surface, I think it is quite natural to feel grim about the company's prospects after such a dramatic loss. In my personal portfolio, if I had sold my shares before the earnings report, I would have realized a 12% gain, whereas now I am sitting on a 7% loss. So while emotionally I am obviously not happy with the turn of events, that should not impact the underlying analysis on which I base my trades.

In fact, it is precisely bear-ish sentiments like these that give investors arbitrage opportunities like this.

As such, I stick by original positive prospects for HP and would buy even more shares if I had the cash and sufficient diversification to do so. Here is why:

Thursday, August 23, 2012

Value vs. Growth Investing

If you have done any research on stocks, mutual funds, etc., you have probably heard the terms value stocks and growth stocks. These two adjectives are used to describe the underlying motivation and strategy for investing in a particular security. Many (if not most) investors and the media portray these two as distinct camps with clashing investment ideologies.

Benjamin Graham (1894-1976) is hailed as the
father of value investing
Proponents of value investing favor low priced stocks, selling below their intrinsic value. Typical characteristics of value stocks are low price/earnings (P/E), price/book (P/B), and high dividends. The idea is that over time, the overall market will realize that the stock is undervalued and correct itself accordingly. As such, it is associated long term investors.

On the other hand, growth investing is a matter of investing in companies with higher than expected growth rates. The premise is that the stock price reflects the opinions of Wall Street analysts on earnings and cash flow. If the company beats these expectations, then the stock price will move up. In order to facilitate high earnings growth, these stocks typically have low or no dividend yields.

Tuesday, August 21, 2012

Day trading and why you shouldn't do it

Day trading is when you try to take advantage of the intraday fluctuations in prices of financial instruments like stocks and bonds. The idea is that even though the overall daily price may decrease, the price will increase at some points throughout the day. If a trader can time his buys right before the increases and sell right before it starts decreasing, he can make a profit.

Consider the following intraday time series for a stock:


Overall, the stock price dropped from $10 to $8, a 20% loss. However, an omniscient investor could in theory buy the stock at 10 AM, sell at 11 AM, buy again at 1 PM, sell at 2 PM, buy at 3 PM, and finally sell at 4 PM. The net result is a $3/share, a 30% gain.

This kind of arbitrage can almost always occur, regardless of market conditions or time scale. This is because while the overall trends are consistent and can be predictable, the small fluctuations caused by people buying and selling shares is inevitable. There will almost always be both buyers and sellers throughout the day and if at any given point the number of supply exceeds the demand, the price will go up temporarily.

Thursday, August 16, 2012

#1 Fallacy in Investing

Whenever I talk with people or read about investing, the same misconception comes up over and over. Many, if not most, people believe that rapid growth of a business will equate to a higher stock price in the future. The reasoning being if a company's value increases, the stock price will necessarily reflect that growth since a stock is portion of the company.

The problem is very subtle because the reasoning is 100% correct. So where is the fallacy?

Wednesday, August 15, 2012

Diversity is Safety

Today, I sold about 30% of my shares of CSCO at a 10% gain. The reason why I sold is not because I am happy with the return or I think the price will go down, but rather because I feel that my portfolio is not diverse enough.

As you can see from my previous post, I currently own positions in 6 stocks. About 20% of my portfolio value was in CSCO. Why is this a bad thing? If the stock performs well, my portfolio does proportionally well. The flip-side is that if it performs poorly, my portfolio will also do poorly. That single fact is what concerns me the most.

To illustrate the problem, let's consider a more extreme situation. Suppose I had all of my wealth invested equally in a single stock, which we will call AAA. Now let's say our 1 year prospects for this stock is normally distributed an expected value of 10% gain and a standard deviation of 20%.

We can expect a 10% gain on average. However the law of large numbers only holds true over the course of many samples. In this case, there is 34% that you will lose money this year. In fact, there is a 1% chance that you will lose over half of your money. The risk is simply too high to justify this kind of investment strategy.

The probability that you will lose money

Tuesday, August 14, 2012

Do stock prices matter?

Do stock prices by themselves have any impact on whether or not you should buy it?

TLDR: No.

As an example, consider the two stocks: General Electric and Berkshire Hathaway Class A.

Stock Ticker Price Market Capitalization
General Electric Company GE 20.99 221.63B
Berkshire Hathaway Inc. BRK.A 127,380.00 210.91B

As you can see, GE's stock costs less than 6000 times less than Berkshire Hathaway's, yet the two companies have about the same market value. The reason behind this is that GE has 10.56 billion shares outstanding while Berkshire Hathaway has a only 1.66 million shares.

Yet from a psychological standpoint, people will drawn more towards low priced shares. However, the raw share price has nothing to do with the market value of the company.

Does that mean the share price should be completely taken out of consideration when picking stocks? For most companies, the answer is yes. There are two cases where it does matter: when the share price is extremely high (e.g. BRK.A at $127,380) or extremely low (e.g. SPEX at $0.48).

In the first case, it's important because the share price may simply be so high that you cannot afford to buy a single share (there is no such thing as a fractional share). If you want a piece of Warren Buffett's BRK.A, you'll have to pay generously for even the smallest portion of his wealth.

In the latter case, the stock is considered a penny stock (less than $1). Many stock brokers charge an additional fee for trading penny stocks. This fee may cut significantly into your profits or worsen your losses.

Saturday, August 11, 2012

The first stocks

My initial stock purchases were made on August 1, 2012. Exactly a 10 days has elapsed between then and the market close yesterday. Here is a summary of what I invested in and what they are worth now.
Company Ticker Bought Price/Share Current Price/Share % Gain
Cisco Systems Inc. CSCO 15.86 17.70 11.60%
Hewlett-Packard Co. HPQ 17.87 19.41 8.62%
JP Morgan Chase JPM 36.06 36.92 2.38%
NRG Energy NRG 19.81 20.88 5.40%
PG&E Corp. PCG 45.85 45.39 -0.99%
Xerox Corp. XRX 6.94 7.17 3.31%

So far, I have a 4.51% return overall. If we compound that 36 times to extrapolate my portfolio's worth in a year, we arrive at a staggering 490% yearly growth!

Like a boss

Friday, August 10, 2012

Are stocks a Ponzi scheme?

The premise behind investing in stocks is simple: buy low and sell high. You should be wondering, why should stock prices increase at all? Ultimately the reason is because other investors want to invest in it, in hopes of selling their shares at an even higher price than what they paid for.

But wait, isn't this just an elaborate Ponzi scheme? Let me explain.

Puts Nigerian scammers to shame

Ponzi Schemes

For those who are not familiar with the Ponzi scheme, it is a rather simple, yet clever scam. It is named after Charles Ponzi (1882-1949) who successfully employed the scheme to scam thousands of New Englanders back in the 1920's [1].


Thursday, August 9, 2012

Stocks, bonds, derivatives, oh my!

Today, there are dozens of types of financial instruments employed, ranging from debt securities to derivatives. However, by far the most common are stocks and bonds. These two form the staples of any investor's portfolio, both an individual's and an institution's. By Amdahl's law, the bulk of one's time should be spent understanding how these two securities operate and studying how to maximize returns in these two areas.

Bonds

Bonds are essentially loans given to a company as a way for them to raise both short term and long term funds. You pay a certain amount of money up front, called the principal, in return for regular interest payments. When the bond term ends, known as reaching maturity, the principal will be returned to you in full.

U.S. Steel Corporation bond
The interest rate, called the coupon, is fixed throughout the lifetime of the bond and is typically paid either annually or semi-annually (every 6 months). Short-term maturities (1-5 years) are safer and thus have lower coupon rates than longer-term maturities (10-30 years).

Wednesday, August 8, 2012

From zero to 401k

Ok so as you probably know, a 401k doesn't actually stand for $401,000. It's a type of retirement savings account named after subsection 401(k) of some U.S. legalese [1]. So what's all the buzz behind it and why does it matter?

Road to retirement

A 401(k) account is provided through your employer. The idea behind it is that you put some money in every year and lock the sum away until you retire. By imposing some rather strict guidelines and fees on early withdrawals, a 401(k) account offers two very worthwhile benefits.

The blog takes flight


As the saying goes, "time is money"; and if you look at the interest rates on today's bank accounts, it is certainly not time well spent. Currently, Citibank offers a 0.01% annual percentage yield (APY), which means if I keep $1000 in my checking account, at the end of the year it will have yielded a paltry 10 cents. In 10 years time, I will have finally made my first dollar.

Thanks, but no thanks
In contrast, if that same $1000 had been invested in the stock market, the story is much different. Despite the dot-com bust in 2000-2002 and the more recent subprime mortgage crisis of 2008, the S&P 500 index has averaged a 9.2% annual growth over the past 45 years [1]. This means if all I did was invest in the top 500 publicly trade companies, in 10 years time my portfolio would grow a whopping 241%. That same $1000 I put in my checking account for a $1 return would have netted me $1410. And this is with almost zero work on my part: no stock research whatsoever.

Obligatory Disclaimer

The author is not qualified to give financial, tax, or legal advice and disclaims any and all liability for this information.