Financial Stuff

Once upon a time I spent years (and years) writing tutorials on things financial because it was fascinating, because I needed to know some things
... and because I couldn't understand much of what I read on the Internet.

After a time, it was tiring ... so I stopped, then decided to stick some of the stuff into eBook format.
(Maybe 'cause I bought me a Kindle, eh?)
Who knows? Somebody may find something of interest.

Note:
The original HTML tutorials had a bunch of links to Internet sites and references to spreadsheets, etc. etc.
Since the eBooks are magical transformations of the tutorials, I tried to tremove all them links and spreadsheet references ... but I may have missed a few.

Anyway, a bunch of introductory stuff follows, then there's some stuff more specific:


What to Invest in: diversification

If you knew what stocks would perform well in the future, that's what you'd buy.
Alas, that information isn't available (and past performance won't help much).
So what to do, given our ignorance of the future?
We might take consolation in the comment of Warren Buffett (perhaps the greatest of modern investors).

Diversification is a protection against ignorance

Diversification means you'd invest in stocks (domestic and foreign) and/or bonds and/or mutual funds
... a variety of assets that don't all move in the same direction.


Suppose you invested in, say GE (General Electric) and the DOW.
Then you'd find that they tend to go up and down together.
What's good is that, in good times, they both go up.
What's bad is that, in bad times, they both go down.

It's that going down together that you'd want to avoid
... and the fact that you might just as well own one of 'em
... so maybe buy one, say the GE, and look for something other than the DOW.

That's "diversification".


The beauty of diversification (ignoring the fact that it's an admission of our ignorance) is that our comfort index is increased ... and we sleep better.

Look at a portfolio of Vanguard Funds:
60% in VFINX (tracking the S&P500)
30% in VGTSX (investing in Europe, the Pacific and emerging markets)
10% in VBMFX (investing in a broad assortment of bonds)

The growth of the Portfolio may not be the best, but it ain't the worst either.
Indeed, it's fairly steady compared to a portfolio of U.S. stocks (reflected in VFINX).

>Fairly steady?
Well ... less volatile.
>Volatile?
We'll get to volatility soon enough. In the meantime ...
>In the meantime how to pick "diversified" stocks that "don't move together", that let you sleep and ...
Yes, well that involves something called Correlation which we'll talk about next.

Note, however, that once you've decided on some allocation of assets (like 60% of this and 30% of that etc.), that allocation will change with time.
If one asset outperforms and if you wish to maintain a 60:30:10 ratio (for example), you'd have to sell the better performers and buy more of the poorer performers.

That's rebalancing and you may want to do that monthly or yearly or perhaps when the allocations deviate too much from your "ideal" allocation.

When you start a Portfolio you'll (probably) contribute periodically. If you get paid monthly, you'll (probably) add to your holdings on a monthly basis.
If you wanted to maintain a particular allocatiun, then that'd be a good time to buy the poorer performers to increase their portfolio weight.

If you really want to feel good about your monthly contributions, you'll call your investment ritual Dollar Cost Averaging.
But DCA has a Dark Side that you should be aware of.
Arguments abound for one ritual versus another ... for example DCA vs Value Averaging.
Indeed, many recommend investing All-at-Once ... just in case you come into a bunch of money.



When selecting various assets for your Portfolio, you may be tempted to avoid those with a high Correlation.

>Huh?

Many think of "Correlation" as being an indication of whether the prices of two stocks move up and down together.
The most common flavour of "Correlation" is the Pearson product-moment Correlation Coefficient , applied to two sets of returns ... probably monthly returns, over the past few years.

The Pearson Correlation is a number between -1 and +1 and when it's close to +1 one (often) interprets that to mean that the two stock prices tend to move up and down together.
In such a case, maybe you wouldn't want both stocks in your Portfolio ... if they move together.

However, the Pearson Correlation actually measures whether the two sets of returns tend to be above or below their average together ... and that's a horse of a diff'runt hue.

It's quite possible to have one stock go up as the other goes down and still have a Correlation of +1.
It's also possible to have both stocks go up yet have a Correlation of -1.
NOTE: Sometimes I use a percentage between -100% and +100% to denote correlations.
Most people just use a number between -1 to +1.

However, there are other measures of "correlation" such as Spearman Correlation.

Investors often look at the square of the Pearson Correlation (calling it R-squared).
The bad thing about R-squared is that is doesn't distinguish between positive and negative correlation.
The good thing about R-squared is that is gives some measure of how far the returns are from being linearly related.
>Huh?


You plot the returns for one stock (stock Y) against the corresponding returns for the second stock (stock X).
That'd give you a so-called "Scatter Plot".
You can then generate a "best fit line" ... the "Regression Line".
If R-squared were 1 (so Corr'n = +1/-1), all the points would lie on that Regression Line.
... and there would, indeed be a linear relation between the returns.

The interesting thing about that Regression Line is that it has a SLOPE and an INTERCEPT and both have names and are of interest to many.

>INTERCEPT?
Yes. If the equation of the Regression Line is, for example: y = - 0.1 x + 0.2 then - 0.1 is the SLOPE and 0.2 is the INTERCEPT.

If you're plotting returns for some stock versus the returns for some broader market Index (like the DOW or S&P500) then you're seeing if the stock tends to follow "the Market"
... so that Regression Line is interesting and we call the two parameters:
Alpha = INTERCEPT   and   Beta = SLOPE
Alpha and Beta are also involved in the Capital Asset Pricing Model.


Volatility ... or Standard Deviation

There's this thing called Standard Deviation (or Volatility) which measures how far a set of stock returns tends to deviate from their Average or Mean.
To calculate the Standard Deviation you do this:

  1. Calculate the Mean (or Average) of the set of returns: R1, R2, ... Rn.
        M = (1/n) ( R1 + R2 + ... + Rn)
  2. Then calcuate the deviations from this Mean:
        (R1 - M) and (R2 - M) and ... (Rn - M)
  3. Then calculate the average of these squares:
        SD2 = (1/n) { (R1 - M)2 + (R2 - M)2 + ... + (Rn - M)2 }
  4. The square root of this average is the Standard Deviation, SD.
    (You might call it the Root-Mean-Square of the deviations from the Mean.)
Perhaps a simpler (but equivalent) calculation is like so:
SD2 = (1/n) ΣRk2 - M2 = (The average of the squares of the returns) - (The square of the average return)
where Σ is a shorthand notation for summing of terms

>And that's useful?
To many, it represents how far the monthly (weekly? yearly?) returns deviate from their Mean.
For something like bank interest, where the annual returns are constant, then SD = 0 since all returns are equal to their Mean.
For something like the DOW, you might have SD = 0.1 or 10%.
For something like the WMT (Walmart), you might have SD = 0.15 or 15%.
For something like the XOM (Exxon), you might have SD = 0.2 or 20%.
For something like ...

>20% of what?
Good question.
If you're calculating the Standard Deviation of a set of temperatures, then SD would be measured in degrees.
If you're calculating the Standard Deviation of a set of areas, then SD would be measured in square metres.

>So the SD for stock return percentages would be a percentage.
Exactly ... and besides being a measure of how the returns are dispersed (about their Mean), many regard the SD as a measure of Risk.

>A measure of Risk? As in losing money?
No, as in being uncertain of the expected future returns ... since you may expect them to vary greatly if the Volatility is large.
Of course, it wouldn't be MY definition of Risk. Indeed, people are still discussing what is the "best" (in some sense) measure of Risk.
These debates seem to go on ... and on.

>The distribution of returns ... that looks interesting.
Yes. We'll talk about distributions soon enough.


One thing you have to consider (before placing too much faith in what the SD is saying) is that, if you use monthly returns, the value will depend upon whether you take the return from the 1st of the month to the 1st, or the 10th to the 10th, etc.
That goes for a number of financial indicators, like Correlation or Beta ... or whatever.

If one is accustomed to seeing the Volatility of yearly returns, then one often multiplies the monthly volatility by the square-root-of-12 (because there are 12 months in a year).
Indeed, if you have the volatility for weekly returns, then multiply by the square-root-of-365 (because there are 365 days in a year).
Note, however, that some multiply by the square-root-of-250 because there are (about) 250 market days in a year.

>And that'd give the same number as you'd get by using yearly returns?
Uh ... no, but usually it's close.
However, so long as everybody uses the same prescription for "annualizing" monthly volatility then you can at least compare volatilities between assets.

One other thing about volatility: If you have two assets with the same Mean, the one with the larger volatility will make you less money.

>Huh?
Increasing Volatility will reduce your Compound Annual Growth Rate (CAGR or "annualized" return) ... but we'll talk about that later.


When to Buy & Sell ... Buy & Sell Indicators

Having settled on some fool-proof portfolio, with components that don't have a high correlation, with smallish volatility that let's you sleep at night, that's diversified, that's ...

>Your point?
Well, you have choices:

  • You can let the portfolio remain, untouched (except, perhaps, for occasional rebalancing to maintain a desired allocation and, of course, adding additional monies).
  • You can buy and sell assets when conditions seem favourable.
Many recommend the former, with a portfolio of stocks and bonds and a foreign component and dividend-paying stocks
... or maybe a collection of mutual funds that cover all the bases
... or maybe an Index Fund that involves a jllion diversified stocks.
You just rebalance from time to time and add additional money with each paycheck.

Others like to buy and sell assets when they get Buy or Sell signals.

>Huh?
There are a jillion rituals that suggest when to buy and when to sell.
For example, you look at the average stock price over the past 200 days. That'll give some sort of "baseline" price, based upon the performance over some 10 months.
Then you look at the average stock price over the past 20 days. That'll follow the current price fairly closely without being greatly influenced by random swings.
When the 20-day average crosses the 200-day from below, that's a bullish sign and you Buy, and when ...

>Why?
The implication is that the faster 20-day moving average is rising above the "baseline" and you should jump on the bandwagon as the price goes up.

On the other hand, if the 20-day average crosses the 200-day from above, that's bearish and you Sell.

>And that always works?
Nothing always works.
You can get "whiplash", with the stock going up and down, the moving averages oscillating and ...

>And I'm buying and selling like crazy!?
Yes.

Of course, you can choose any pair of days you like: 100-day and 5-day or maybe 100-day and 50-day or maybe ...

>Okay, I get it.
Another thing: those moving averages give as much weight to an old stock price (200 days ago, for example) as they do to a recent price (like today's price).
For that reason, it's nice to weight the recent prices more heavily ... and the Exponential Moving Average does that.

We first pick some number slightly less than 1, call it a (alpha), then consider the weighted Sum:
      S = Pn + a Pn-1 + a 2 Pn-2 + a 3 Pn-3 + ...
where the set of Ps are the stock prices, with Pn being the most recent.

For example, if a = 0.92 then we'd have:
      S = Pn + (0.92)Pn-1 + (0.846)Pn-2 + (0.779)Pn-3 + (0.716)Pn-4 + ...
See? The earlier prices get multiplied by smaller and smaller numbers.

>That's the EMA?
Not yet. If all the prices were the same... and equal to P, we'd get:
      S = P (1 + a + a 2 + a 3 + a 4 + ... ) = P / (1- a)
since the infinite sum of powers of a adds up to 1/(1 - a ).

For a constant price P, our EMA should equal that constant price, so we take: EMA = (1 - a ) S.
EMA = (1 - a ) [Pn + a Pn-1 + a 2 Pn-2 + a 3 Pn-3 + ...]
>And where do you stop?
You don't. You just keep calculating the EMA as the days go by ... and the sum goes back to the first price, when you started calculating.

However, there's a simpler ritual:

  • Start with EMA0 = P0 ... where P0 is the price when you start your calculations
  • Each day you calculate a new EMA, generating a sequence EMA1, EMA2, EMA3 etc., like so:
    • EMA1 = (1 - a )EMA0 + aP1
    • EMA2 = (1 - a )EMA1 + aP2
    • EMA3 = (1 - a )EMA2 + aP3
    • etc.
EMAn = (1 - a )EMAn-1 + aPn
In spite of the fact that, eventually, you'll be including prices that go back a thousand days, there are so-called 10-day EMAs and 25-day EMAs etc..

So you pick a number of days, like 24 and use a = 1 - 2/(1+24) = 0.92.
In general:   use a = 1 - 2/(1+N) to get an N-day EMA.

>Why?
That's a long story.

Anyway, now you can look for crossings of various Exponential Moving Averages
... as we did for garden variety, Simple Moving Averages.

>And that's how you decide when to Buy and Sell?
That's one method from among hundreds.

>Hundreds?
Well ... maybe thousands.

>And they all work?
Huh?


Monte Carlo

Since we can't predict the future (and gazing at the past can be misleading !!), we can do this in order to see what may happen:
1:   Gather a whole bunch of yearly returns for some asset ... or weekly or monthly or whatever.
Assume they "characterize" the stock, representing possible future returns for that particular stock.
2:   Start with some portfolio, say $1000.
3:   Pick a return at random from the collection of returns.
4:   Apply that return to your portfolio.
5:   Repeat steps 3 and 4 say 10 times and note the final portfolio value.
6:   Repeat steps 2, 3, 4 and 5 umpteen times.
7:   Look at the distribution of portfolios after 10 years ... or weeks or months or whatever.

>And that'll tell you what you might expect, after 10 years?
Well, it'll give some inkling of what may happen
... but you'll get so many possible future scenarios it ain't possible to predict what might actually happen after 10 years.

See the picture?

That's using annual returns for the S&P500 from 1928 to 2000 ... picked at random (as in step 3, above).
We start with a $1000 portfolio and, 30 times, we do steps 2 to 5 to see what "final" portfolios might look like in 10 years.

See the variability? The "average" final portolio is shown ... but don't count on it!

This procedure, simulating possible futures by selecting random returns, is called Monte Carlo simulation.

>And it'll tell you what might happen ... in the future?
Not exactly. It'll give you some idea of the variability of future portfolios.
You can change the asset from the S&P500 to, say GE or some mutual fund or whatever
... and it'll provide some insight into what could happen ... but don't count on it!

If you're retired and are withdrawing a portion of your portfolio each month, Monte Carlo simulation will give you some indication of how long your portfolio may last.
You can then see the effects of changing your withdrawal rate or the particular allocation of assets or the effect of inflation and the number of years etc. etc.
It's useful ... but don't count on it!
We'll talk more about withdrawing from your portfolio later.
>Don't count on it? Then what can I count on?
Well, let's see ... you can certainly count on this:


Return Distributions

Remember when we looked at the distribution of monthly returns for the DOW?
To get some idea of the variability of returns or future portfolios (or midday temperatures or the range of house prices ... or whatever) we can plot a distribution.

We just look at, say umpteen scenarios (like the last umpteen annual returns) and see how many are between -10% and -9%, or between -9% and -8%, or between -8% and -7%, or ...

>Okay! Then what?

Then see what percentage of those umpteen returns lie in each interval, like so:

Since the distribution will be pretty jagged, one attempts to find some congenial curve that'll mimic the ragged distrubution, like so-called Normal or Lognormal curves.

>Why?
If you have a neat mathematical description for the distribution, then you can play mathematical games.
You can discard the actual distribution and use the mathematical proxy to attempt to predict future portolios or the probability of your portfolio running dry when you withdraw too much money each month or you can try to pick out some "expected" future return or you can ...

>And that works?
It's a handy gadget to play with ... but don't count on it!
You have a variety of financial tools. You use this and that ... then stand back and ponder. Cerebral machinations are requisite.


Portfolio Returns: Average, Annualized and their friends

You sit back, stare intently at your portfolio and its gains (losses?) over the past few years and ask yourself:

  1. What's my annual return?
  2. What might I expect for next year?
  3. If I had invested that extra $1000 a month earlier, how different would my return be?
  4. What if I withdraw some money then add it back, later ... how would that affect my return?
  5. What if ... ?
>So?
So we have to talk about how one calculates portfolio returns ... and there are several different ways to do that, each meaning something different.

For example:

  • You have a $1000 portfolio and your returns over the past 5 years are 2%, 5%, 6.95%, -3% and 8% and you neither add money nor withdraw money.
  • Then your portfolio will be 1000(1.02)(1.05)(1.0695)(0.97)(1.08) = $1200.
  • That's a 5-year gain factor of 1200 / 1000 = 1.20 so every $1.00 would have grown to $1.20.
  • That's a 5-year return of 0.20 or 20%.
  • That's like putting your $1000 in a bank at an annual interest of r and getting 1000 (1 + r)5 = 1200 after 5 years.
  • That'd make the bank interest equal to: r = (1200 / 1000)1/5 - 1 = 0.0371 or 3.71% per year.
That 3.7% would be your Annualized Return (or Compound Annual Growth Rate):
If R1, R2, R3 ... Rn are the last n annual returns and you neither add nor subtract from your portfolio, then
Annualized Return = CAGR = {(1+R1)(1+R2)... (1+Rn)}1/n - 1
is your annualized return (or CAGR) over n-years.

However, if you calculate the Average Return (for the example above) you'd get:
Average (or Mean) Return = (2 + 5 + 6.95 - 3 + 8)/5 = 3.79. That is, an average annual return of 3.79%.
If R1, R2, R3 ... Rn are the last n annual returns, then
Average (or Mean) Annual Return = (1/n) {R1 + R2 + R3 + ... + Rn}

So, if you'd like to guess at what next year's return might be, that Mean (historical) return is a good bet ... but don't count on it!

However, if you'd like to guess at what your gain factor might be over the next 5 years, you would NOT want to use: (1+Mean)5.
For the example, that'd turn $1000 into 1000(1.0379)5 = $1204, not $1200.
In fact, you'd use the CAGR: 1000(1 + CAGR)5.

>And that'd tell me what to expect over the next 5 years?
No, it's just a guess ... don't count on it!
To know for sure, you'd need this:

Investing in a stock or mutual fund whose price varies dramatically from month to month (that's volatility, eh?) will reduce your CAGR.
In fact, a good approximation is:
CAGR = (Mean Return) - (1/2) (Volatility)2

Now, if you add money or withdraw money from your portfolio ... aah, that's a horse of a diff'runt hue.
Indeed, if you add or withdraw periodically (like once a month), there's IRR.
If you add or withdraw at random times, there's XIRR ... sometimes called ROI.
('course, ya gott watch our for XIRR bugs)
Both require sexy calculations which require a computer. There ain't no easy formula.

Further, some people calculate a return as:
[A]         newPrice / oldPrice - 1
Example: $53/$50 - 1 = 0.06 or 6%

Some prefer:
[B]         log(newPrice / oldPrice)
Example: log($53/$50) = 0.058 or 5.8%     (Remember to use natural logarithms, to the base e!)

>Use logs? Why?
If, over 4 years, the prices go from P1 to P2 to P3 to P4 to P5, the average return is either:
[A]         (1/4){ (P2/P1-1) + (P3/P2-1) + (P4/P3-1) + (P5/P4-1) }
or
[B]         (1/4){ log(P2/P1) + log(P3/P2) + log(P4/P3) + log(P5/P4) } = (1/4) log(P5/P1) = log[ (P5/P1)1/5] = log[1+CAGR].
Note that log(x) + log(y) = log(x*y). Clearly [B] will get math-types feeling warm all over.

Then there's Year To Date returns (YTD) and "real" Returns
(taking into consideration inflation, 'cause a 5% return in a year with 3% inflation is a "real" return of about 2%)

Then there's Time-weighted Returns and Dollar-weighted Returns and ...

>zzz
... and there's even Nepers !!

>ZZZZ


Predicting the Future ... maybe

Having gazed for some time at historical stock performance, what are the chances that you could use that info to predict the future evolution of your portfolio?

>I'd say zero. Am I right?
Yes, but you can guess ... and there are lots of way to do that:

  • Calculate the Mean and Standard Deviation of historical returns and, armed with those two numbers, construct a Normal Distribution.
  • Calculate the Mean and Standard Deviation of historical returns and, armed with those two numbers, construct a Logormal Distribution.
  • Calculate the Mean, Standard Deviation and perhaps other characteristics of historical returns and, armed with those numbers, construct some other sexy Distribution.
  • Use the actual historical returns and select them at random a la Monte Carlo (or some other sexy ritual).
  • Use Ito's Magic Formula and ...
>Ito's what?
If you assume a lognormal distribution (using historical Mean and Standard Deviation) you can try Ito's Formula:
The (lognormal) distribution of Prices P at time T years in the future is:

where
P is the price T years in the future
Po is the current price
r is Mean Return
s is Standard Deviation

Shape of the "density" distribution

>If I have that "density" distribution, how do I use it?
You'll probably want to generate the "cumulative" distribution which will give you the probablility that your stock will attain a certain price, T years from now.
It looks like this:

Of course, it'll change with T
... and r and s:

>Okay, start with Ito's Density and generate a Cumulative ... but how?

It'll give you some numbers. That should make you happy, but predicting the future? Don't count on it!

Of course, sticking a Mean and Standard Deviation into some formula will give a smooooth curve.
If you generate a Cumulative Distrubution from actual historical returns, it won't be quite as elegant.
For example, here's the cumulative distribution for monthly GE returns over a 10-year period.

It gives the probability that a future monthly return will be less than something.
In the chart, it suggests that there's a 60% probability that you'll get less than a 2% monthly return.

>And that's guaranteed?
Probabilities are always guaranteed.
If you don't get 2% I just say: "Too bad. You were in that other 40%".


Withdrawing from your Portfolio

Having accumulated a Portfolio, you retire and start withdrawing. There are a jillion question to ask:

  • What percentage should I withdraw each year?
  • Is there a Safe Withdrawal Rate? (SWR)
  • What is the influence of inflation?
  • Shall I use actual historical returns and Monte Carlo or assume some "future" distribution of returns or ...?
  • Are there studies on the subject? What are the historical precedents?
  • What if I ...
>So?
So an early study was the Trinity Study which examined various portfolio allocations (stock + bonds) to see which would have survived N years with a particular withdrawal rate.

For example, with a portfolio of 75% stocks + 25% bonds your portfolio would have lasted 30 years (with a 98% probability) had you withdrawn 5% each year.

>What stocks? What bonds? What period of time?
Good questions. I think the stock component was the S&P500 and for bonds, high grade corporate bonds were used ... and it covered the period 1926 to 1995.
However, that's not so important since there have been a jillion such studies since Trinity.
See the table below?

The usual assumption is that you withdraw x% of your initial portfolio, then increase that each year according to the Consumer Price Index. That means that, once you've started withdrawing, your withdrawals are predetermined for the next umpteen years. They ignore current market machinations.

It ignores the fact that your portfolio has grown from $500K to $10M.
You withdraw the prescribed amount, based upon that initial $500K.

It ignores the fact that your portfolio has collapsed from $500K to $100K.
You withdraw the prescribed amount, based upon that $500K.

>Huh? If my portfolio collapsed I wouldn't keep withdrawing ...
Yes ... so there have been a jillion subsequent studies on SWRs.

One thing to remember is that the order in which returns occur will greatly influence the evolution of your portfolio: