<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>StreetEYE</title>
	
	<link>http://blog.streeteye.com/blog</link>
	<description>Rants on tech, macro, and markets</description>
	<lastBuildDate>Sat, 18 May 2013 17:41:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/streeteye" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="streeteye" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">streeteye</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>“Cat Food” revisited – final thoughts – part 4</title>
		<link>http://blog.streeteye.com/blog/2013/05/cat-food-revisited-final-thoughts-part-4/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=cat-food-revisited-final-thoughts-part-4</link>
		<comments>http://blog.streeteye.com/blog/2013/05/cat-food-revisited-final-thoughts-part-4/#comments</comments>
		<pubDate>Wed, 15 May 2013 16:05:51 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=2075</guid>
		<description><![CDATA[Here is the long-awaited conclusion to the wonky 4-part discussion of safe retirement spending. We went pretty far down the rabbit hole, and I think the conclusions are useful. Attempting to finance a stable retirement from a risky portfolio is inherently fraught with risk and tradeoffs. A desirable strategy achieves High initial and lifetime spending [...]]]></description>
				<content:encoded><![CDATA[<p>Here is the long-awaited conclusion to the wonky 4-part discussion of safe retirement spending. We went pretty far down the rabbit hole, and I think the conclusions are useful.</p>
<p>Attempting to finance a stable retirement from a risky portfolio is inherently fraught with risk and tradeoffs.</p>
<p>A desirable strategy achieves</p>
<ul>
<li>High initial and lifetime spending </li>
<li>Low frequency and severity of shortfalls</li>
<li>Low variability in spending</li>
</ul>
<p>Increasing the level of spending today is desirable – but increases the risk of shortfall in the future. High variability in spending is bad – but upward adjustments let you increase spending to take advantage of better-than-expected investment performance, while downward adjustments reduce risk of even greater income shortfall when performance falls short. Finally, accepting spending variability in the future enables higher spending today, if you accept a thinner buffer against shortfall, and/or invest in higher-risk, higher-return portfolios.</p>
<p>The $64,000 question is, how risk-averse are you? How willing are you to trade current income for future income, variability and risk of shortfall?</p>
<ul>
<li>If you&#8217;re risk-neutral, you just want maximum expected lifetime spending. This leads to a highly equity-oriented, volatile portfolio, and variable spending something like a consistent percentage of the portfolio, starting low and allowing growth in the portfolio and spending over time (our test added smoothing and mortality updating, but spending is still highly variable). </li>
<li>If you&#8217;re highly risk-averse, you want a highly diversified portfolio, and you&#8217;ll tend toward a traditional fixed 4% rule (which should probably be lower for conservative retirees in current market conditions). </li>
<li>If you&#8217;re between those extremes, your portfolio, optimal lifetime spending, variability, and shortfall risk will tend to lie between those two extremes. You might consider combining a fixed amount and variable amount to achieve the best balance between variability, shortfall risk, and high initial and lifetime spending.</li>
<li>What is more important than the specific initial rate is a strategy with an appropriate degree of spending flexibility, giving you the ability to take advantage of higher long-term equity returns without imposing intolerable variability, and a clear picture of the range of potential outcomes. To the extent possible, retirees should err on the side of moderate initial spending, embrace the volatility they can tolerate as the key to unlocking maximum lifetime spending, and accept that their retirement trajectory is ultimately dependent on how the timing of their retirement intersects long-term economic and market trends.</li>
<p>Here&#8217;s a slightly more technical discussion. </p>
<p>I got a little stuck trying to write a conclusion. First of all, I realized a constant spending parameter was needed for our model to make it more general, and felt compelled to run it again. </p>
<p>The updated model is </p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture.png" alt="Capture" width="194" height="37" class="aligncenter size-full wp-image-2089" /></a></p>
<p>where: </p>
<ul>
<li><em>s<sub>i</sub></em> is spending in period <em>i</em></li>
<li><em>P<sub>i</sub></em> is the value of the portfolio for period <em>i</em></li>
<li><em>L<sub>i</sub></em> is the retiree&#8217;s remaining life expectancy in period <em>i</em></li>
<li>K is the constant spending parameter </li>
<li>n is the exponential moving average smoothing parameter</li>
<li>h is the variable spending parameter</li>
<li>b is the mortality insensitivity parameter</li>
</ul>
<p>Other than the addition of <em>K</em>, this is the model in our last post. If <em>n </em>is 1, <em>b </em>is large, and <em>K </em>is 0, this reduces to something like a fixed percentage spending model; if <em>h </em>is 0, this is a constant spending model like Bengen&#8217;s 4% rule.</p>
<p>I tested about 20 values for each parameter, and 21 allocations from 0% to 100% equity in 5% steps, ultimately about 3.7m combinations.</p>
<p>Mapping the <em>initial spending</em> &#8216;severity frontier&#8217;, we see that the highest initial spending with no shortfall is basically the Bengen solution: 3.9% spending, 50% stocks, mostly fixed spending.</p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture2.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture2.png" alt="Capture" width="533" height="343" class="aligncenter size-full wp-image-2109" /></a><br />
<small><em>Shortfall:</em> the worst observed decline below initial spending. The &#8216;frontier&#8217; is the lowest achievable shortfall for an initial spending rate.</small></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture1.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture1.png" alt="Capture" width="541" height="363" class="aligncenter size-full wp-image-2107" /></a></p>
<p>As an aside, below is a plot of probability of shortfall at various levels. Reading across, you can see that at 6%, the best you can do is about a 20% chance of some shortfall and about 4% probability of 50% shortfall (not with identical portfolios). Also, you can see that for each 1% you increase initial spending, best achievable probability of shortfall at any cutoff goes up about 10%.</p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture3.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture3.png" alt="Capture" width="504" height="358" class="aligncenter size-full wp-image-2112" /></a> </p>
<p>Mapping the <em>lifetime spending</em> &#8216;severity frontier&#8217;, we see that highest lifetime expected spending with no shortfall is 118.06% of the initial portfolio. This is notably higher than maximizing initial spending with no shortfall. But initial spending is low &#8211; 2.33% of the initial portfolio, which is all equity, like all the other solutions for maximum lifetime spending.</p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture4.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture4.png" alt="Capture" width="536" height="525" class="aligncenter size-full wp-image-2113" /></a></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture5.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture5.png" alt="Capture" width="503" height="358" class="aligncenter size-full wp-image-2115" /></a></p>
<p>This exposes the essential dilemma:: </p>
<ul>
<li>If you want maximum initial spending with no shortfall, you have a low-risk portfolio, low lifetime spending. You leave a lot on the table.</li>
<li>If you want maximum lifetime spending with no shortfall, you have low initial spending, high equity allocation in a portfolio that grows over time and gives you back-loaded spending.</li>
</ul>
<p>This doesn&#8217;t really help us pick an optimal point. We need a &#8216;Sabermetric&#8217; to combine the &#8216;holy trinity&#8217; of high spending, low variability, and low risk of shortfall.</p>
<p>There is one in the literature. It&#8217;s &#8216;certainty equivalent&#8217; (CE) spending, which takes an income stream and applies a discount according to 1) its level of variability and risk, and 2) a risk aversion parameter. If risk aversion is 0, you&#8217;re risk-neutral, no variability discount is applied. The higher your risk aversion the higher the discount. The form we use is <em>constant relative risk aversion</em> (CRRA), which means a stream that varies between $1 and $2 gets the same discount as one with similar variation between $100 and $200. </p>
<p>We calculate certainty-equivalent lifetime spending with a risk aversion parameter of 8 &#8211; the lowest that gives us reasonably diversified portfolios. Here is what the &#8216;severity frontier&#8217; looks like:</p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture6.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/05/Capture6.png" alt="Capture" width="568" height="338" class="aligncenter size-full wp-image-2118" /></a></p>
<p>This gives us a higher initial income than maximizing lifetime spending, and a higher lifetime spending than maximizing initial income. For instance, the solution in bold has initial spending of 3.83%, 1.7% probability of shortfall > 10%, lifetime spending > 110% of initial portfolio. Compared to maximizing initial spending for 0 shortfall in Table 1 (3.9% initial spending, 70.7 lifetime spending), we achieve a > 50% increase in lifetime spending at a price of a < 2% decrease in initial spending and a worst-case decline of 12.7% from initial spending. </p>
<p>What we find is:</p>
<ul>
<li>If we are completely risk neutral, our risk aversion parameter is 0 and we maximize lifetime spending&#8230;. we are all equities, low initial spending, high volatility.</li>
<li>If we are highly risk averse, we will aim for the highest sustainable fixed spending, similar to the Bengen ‘4% rule’. </li>
<li>If risk aversion is between these two extremes, we will seek a strategy with volatility and lifetime spending between these two extremes. As you increase risk aversion, the variable component of spending decreases and constant spending increases, the portfolio swings from all equities to a diversified mix, and initial spending generally decreases.</li>
</ul>
<p>If you put full faith in this model and your estimate of risk aversion, you could just maximize certainty-equivalent spending. Or you might want to look up and down the &#8216;severity frontier&#8217; and pick the best solution, one that combines high lifetime spending and CE spending with reasonable initial spending and shortfall risk.</p>
<p>In practice, maximizing certainty-equivalent spending depends on estimating risk aversion, which is not precisely knowable. We could query retirees on which potential outcomes and risk profiles they prefer, but that&#8217;s like describing two movies to them and asking which they would prefer. A portfolio outcome, like a movie, is an experience good, which can only be judged successful after experiencing the whole thing (although failures can  often be discovered more quickly, or even from the description). Risk aversion may not even be consistent over time, but may increase abruptly at market extremes. </p>
<p>Nevertheless, certainty-equivalent spending has the advantage of being a consistent, objective measure that takes into account risk and variability, and it can identify a schedule of solutions at different levels of initial and lifetime spending and worst shortfall that are locally optimal, and you can pick the ones that look most desirable. </p>
<p>I wrote this up as <a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2263998" title="Safe Withdrawal Rates, Optimal Retirement Portfolios, and Certainty-Equivalent Spending">a paper with all details</a>, in case others want to delve into it and do more work on it, and will share code and data in this space shortly, as soon as I&#8217;ve cleaned it up a little.</p>
<p>I&#8217;ll throw out one other approach, which is to use a Kahneman-Tversky behavioral economics/prospect theory utility function, which is discontinuous and heavily penalizes losses from an initial frame of reference. That means it leads to inconsistent choices depending on the initial frame of reference and it&#8217;s path-dependent. Yet, it is highly predictive of human choices. </p>
<p>You could apply it to this problem by choosing the highest initial spending such that, if you set it as the initial frame of reference, future utility gains outweigh or equal losses. If you&#8217;re highly averse to losses, you&#8217;ll set initial spending low enough that the pain from small potential declines in income is offset by very large potential future gains. If you&#8217;re less loss averse, you&#8217;ll set initial spending a little higher, so moderate losses are offset by large future gains. We still have the thorny problem of estimating the degree of loss aversion. Maybe I&#8217;ll do a detailed exploration of that idea, but it might take a while, so I&#8217;ll just leave it out there, or if anyone wants to collaborate on a study like that, drop me a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2013/05/cat-food-revisited-final-thoughts-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>‘Cat Food’ revisited – testing dynamic spending rules – Part 3</title>
		<link>http://blog.streeteye.com/blog/2013/02/%e2%80%98cat-food%e2%80%99-revisited-%e2%80%93-testing-dynamic-spending-rules-%e2%80%93-part-3/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=%25e2%2580%2598cat-food%25e2%2580%2599-revisited-%25e2%2580%2593-testing-dynamic-spending-rules-%25e2%2580%2593-part-3</link>
		<comments>http://blog.streeteye.com/blog/2013/02/%e2%80%98cat-food%e2%80%99-revisited-%e2%80%93-testing-dynamic-spending-rules-%e2%80%93-part-3/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 16:51:58 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1620</guid>
		<description><![CDATA[In the last part of our look at dynamic rules for spending in retirement, we discussed how changing the allocation between stocks and bonds affects the maximum sustainable spending rate. We can summarize this relationship by plotting the highest feasible initial spending rate for any acceptable shortfall level.1 Figure 15. Initial spending v. worst shortfall [...]]]></description>
				<content:encoded><![CDATA[<p>In the <a href="http://blog.streeteye.com/blog/2013/02/%E2%80%98cat-food%E2%80%99-revisited-%E2%80%93-testing-dynamic-spending-rules-%E2%80%93-part-2/">last part</a> of our look at dynamic rules for spending in retirement, we discussed how changing the allocation between stocks and bonds affects the maximum sustainable spending rate. We can summarize this relationship by plotting the highest feasible initial spending rate for any acceptable shortfall level.<small><sup><a href="#f1">1</a></sup></small></p>
<p><center><em>Figure 15. Initial spending v. worst shortfall<br />
equity=0-100%, s=0.05-1.2, smoothing=1.0-6.0)</em><br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot63.png"><img class="aligncenter size-full wp-image-1911" title="Initial Spending v. Worst Shortfall" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot63.png" alt="Initial Spending v. Worst Shortfall" width="480" height="320" /></a><br />
<small></p>
<table cellspacing="10">
<tbody>
<tr style="text-align: right;">
<td style="text-align: right;">Max shortfall</td>
<td style="text-align: right;">Init spend %</td>
<td style="text-align: right;"><em>s</em></td>
<td style="text-align: right;">Equity %</td>
<td style="text-align: right;">Smoothing</td>
<td style="text-align: right;">Lifetime Spend Exp.</td>
</tr>
<tr style="text-align: right;">
<td>0.0%</td>
<td>1.7%</td>
<td>0.30</td>
<td>20%</td>
<td>5</td>
<td>58.0</td>
</tr>
<tr style="text-align: right;">
<td>4.3%</td>
<td>2.0%</td>
<td>0.35</td>
<td>40%</td>
<td>4</td>
<td>66.3</td>
</tr>
<tr style="text-align: right;">
<td>12.1%</td>
<td>2.3%</td>
<td>0.40</td>
<td>50%</td>
<td>3</td>
<td>77.4</td>
</tr>
<tr style="text-align: right;">
<td>16.9%</td>
<td>2.6%</td>
<td>0.45</td>
<td>60%</td>
<td>2.5</td>
<td>89.1</td>
</tr>
<tr style="text-align: right;">
<td><strong>24.7%</strong></td>
<td><strong>2.9%</strong></td>
<td><strong>0.50</strong></td>
<td><strong>75%</strong></td>
<td><strong>2</strong></td>
<td><strong>105.9</strong></td>
</tr>
<tr style="text-align: right;">
<td>32.2%</td>
<td>3.2%</td>
<td>0.55</td>
<td>80%</td>
<td>1.5</td>
<td>113.6</td>
</tr>
<tr style="text-align: right;">
<td>43.2%</td>
<td>3.5%</td>
<td>0.60</td>
<td>95%</td>
<td>1.5</td>
<td>132.5</td>
</tr>
<tr style="text-align: right;">
<td>50.4%</td>
<td>3.8%</td>
<td>0.65</td>
<td>95%</td>
<td>1</td>
<td>133.8</td>
</tr>
<tr style="text-align: right;">
<td>63.5%</td>
<td>4.1%</td>
<td>0.70</td>
<td>100%</td>
<td>1</td>
<td>141.0</td>
</tr>
</tbody>
</table>
<p></small></center><br />
In part 3 today, we&#8217;re going to discuss 1) adding a parameter to change the way we increase the spending rate as we get older and 2) reducing equity allocation as we get older. Finally, we&#8217;re going to do a brute-force search for the highest initial spending and best parameters for each level of shortfall risk (<A href="#conclusion">skip</a> to conclusion).</p>
<p><em>Adjusting how fast spending rate increases with age</em></p>
<p>Suppose we are willing to accept the portfolio in bold and spending rate, which has never resulted in a decline greater than 24.7% below the initial spending amount. We use spending factor <em>s</em>=0.5, equity = 75%, smoothing factor = 2. We end up with a spending profile that looks like this:<br />
<center><em>Figure 16. Spending profile: s=0.5, equity=75%, smooth=2</em></center><br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot64.png"><img class="aligncenter size-full wp-image-1923" title="Spending profile: s=0.5, equity=75%, smooth=2" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot64.png" alt="Spending profile: s=0.5, equity=75%, smooth=2" width="480" height="320" /></a></p>
<p>Notice the &#8216;hump.&#8217; In the average case, spending rises steadily, then drops. Ideally, we would like a flatter spending profile, preferring less variability in spending. If we could take the hump and spread part of it earlier, without increasing shortfall risk, it would increase the safe spending rate.</p>
<p>The spending rate at age 99 is <em>s</em>/life_expectancy=0.5/2.19 = 22.8%. Spending rates at advanced ages are too high, decimating the portfolio and causing the decline in spending. If we reduce them, maybe we don&#8217;t need to build as big a war chest in middle years to support such a high spending rate in late years.</p>
<p>There are several ways we could change the model to flatten the spending profile. The one we choose is to add a parameter we&#8217;ll call &#8216;life expectancy buffer&#8217; to life expectancy, so we&#8217;ll spend at a rate of <em>s</em>/(life_expectancy+buffer). If the parameter is 2, then when our life expectancy is 3, instead of spending at a rate of <em>s</em>/3, we&#8217;ll spend at a rate of <em>s</em>/(3+2). If life expectancy buffer is 0 or low, the spending rate will rise relatively quickly as we age; if life expectancy buffer is large, the spending rate will change slowly as we age.</p>
<p>With a buffer of 2, we get a flatter spending profile later in life, without changing too much at the start of retirement.</p>
<p><center><em>Figure 17. Spending profile: s=0.5, equity=75%, smooth=2, lifespan buffer=2</em></center><br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot68.png"><img class="aligncenter size-full wp-image-1924" title="Average Spending, All Cohorts (s=0.5, eq=75%, smooth=2, lifespan buffer=2)" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot68.png" alt="Average Spending, All Cohorts (s=0.5, eq=75%, smooth=2, lifespan buffer=2)" width="480" height="320" /></a></p>
<p>Let&#8217;s compare efficient frontiers, with and without the buffer:</p>
<p><center><em>Figure 18. Efficient Frontier: Initial spending v. worst shortfall<br />
Buffer=1 v. Buffer=0</em></center><br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot70.png"><img class="aligncenter size-full wp-image-1943" title="Spend v. Worst Shortfall" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot70.png" alt="Spend v. Worst Shortfall" width="480" height="320" /></a></p>
<p>We find in all cases, the buffer gives us a higher level of <em>initial spending</em> for any level of shortfall risk. However, increasing the buffer does not always increase <em>lifetime spending</em> and sometimes worsens the tradeoff.</p>
<p><center><em>Figure 19. Efficient Frontier: Lifetime spending v. worst shortfall<br />
Buffer=1 v. Buffer=0</em></center><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot75.png"><img class="aligncenter size-full wp-image-1980" title="Efficient Frontier: Lifetime spending v. worst shortfall Buffer=1 v. Buffer=0" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot75.png" alt="Efficient Frontier: Lifetime spending v. worst shortfall Buffer=1 v. Buffer=0" width="480" height="320" /></a></p>
<p>It&#8217;s a mixed picture. The buffer may in many cases allow us to spend safely at a higher initial rate, but doesn&#8217;t always improve lifetime spending. Sometimes it reduces portfolio growth and overall lifetime spending.</p>
<p><em>Third dynamic rule: Changing equity allocation over time.</em></p>
<p>Does it make sense to reduce the equity allocation as you get older? Let&#8217;s introduce a variable to gradually reduce the amount of equity. As long as your life expectancy is &gt; 15 years, use the initial allocation. After that, we&#8217;ll reduce the equity percentage by <em>stepdown</em> percentage points per year.</p>
<p><center><em>Figure 20. Efficient frontiers: Initial spending v. worst shortfall<br />
Equity stepdowns from 0 to 3% per year when LE<15 years.</em></center><br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot80.png"><img class="aligncenter size-full wp-image-1986" title="Efficient Frontiers: Initial spending v. worst shortfall" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot80.png" alt="Efficient Frontiers: Initial spending v. worst shortfall" width="480" height="320" /></a></p>
<p><center><em>Figure 21. Efficient frontiers: Lifetime spending v. worst shortfall<br />
Equity stepdowns from 0 to 3% per year.</em></center><br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot81.png"><img class="aligncenter size-full wp-image-1987" title="Efficient frontiers: Lifetime spending v. worst shortfall" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot81.png" alt="Efficient frontiers: Lifetime spending v. worst shortfall" width="480" height="320" /></a></p>
<p><em>What I thought would happen:</em> stepping down equity over time would let you start with more equity, relying on smoothing to get you over early drawdowns and strong long-run real returns to catch up. Then with lower equity in later years you wouldn&#8217;t be exposed to big drawdowns late in life.</p>
<p><em>What actually happened:</em> stepping down equities always worsens the risk/reward tradeoff.</p>
<p>Apparently my preconception was faulty, or this is the wrong model, stepping down too early and killing returns, or there&#8217;s a mistake somewhere (although I don&#8217;t think so). Watch this space for possible future elaboration or ninja-edit. I&#8217;ll consider this a first draft and move on.</p>
<p>Discarding the stepdown, we now have 4 parameters: spending factor <em>s</em>, starting equity, smoothing factor, and lifetime buffer. We have discussed how each one impacts the spending profile and shortfall risk. Let&#8217;s put it all together, try running a full range of reasonable values, and come up with the best efficient frontier over all values.</p>
<p><center><em>Figure 22. Efficient frontiers &#8211; all parameter values<br />
(s=.05-1.2; equity=0-100%; smooth=1-6; buffer=0-5)</em></center><br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot83.png"><img class="aligncenter size-full wp-image-1992" title="Efficient frontiers: Lifetime spending v. worst shortfall - all parameter values" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot83.png" alt="Efficient frontiers: Lifetime spending v. worst shortfall - all parameter values" width="480" height="320" /></a><br />
<small></p>
<table cellspacing="10">
<tbody>
<tr style="text-align: right;">
<td style="text-align: right;">Max shortfall</td>
<td style="text-align: right;">Init spend %</td>
<td style="text-align: right;"><em>s</em></td>
<td style="text-align: right;">Equity %</td>
<td style="text-align: right;">Smoothing</td>
<td style="text-align: right;">Buffer</td>
<td style="text-align: right;">Lifetime Spend Exp.</td>
</tr>
<tr style="text-align: right;">
<td>0.0%</td>
<td>2.1%</td>
<td>0.40</td>
<td>20%</td>
<td>6.0</td>
<td>2</td>
<td>55.5</td>
</tr>
<tr style="text-align: right;">
<td>1.6%</td>
<td>2.3%</td>
<td>0.45</td>
<td>35%</td>
<td>6.0</td>
<td>2</td>
<td>64.4</td>
</tr>
<tr style="text-align: right;">
<td>4.8%</td>
<td>2.5%</td>
<td>0.50</td>
<td>40%</td>
<td>6.0</td>
<td>3</td>
<td>66.9</td>
</tr>
<tr style="text-align: right;">
<td>7.2%</td>
<td>2.6%</td>
<td>0.55</td>
<td>40%</td>
<td>6.0</td>
<td>4</td>
<td>67.18</td>
</tr>
<tr style="text-align: right;">
<td>7.4%</td>
<td>2.7%</td>
<td>0.55</td>
<td>55%</td>
<td>6.0</td>
<td>3</td>
<td>79.0</td>
</tr>
<tr style="text-align: right;">
<td>9.8%</td>
<td>2.8%</td>
<td>0.60</td>
<td>55%</td>
<td>6.0</td>
<td>4</td>
<td>78.7</td>
</tr>
<tr style="text-align: right;">
<td>11.8%</td>
<td>2.9%</td>
<td>0.65</td>
<td>55%</td>
<td>6.0</td>
<td>5</td>
<td>78.5</td>
</tr>
<tr style="text-align: right;">
<td>13.4%</td>
<td>3.1%</td>
<td>0.65</td>
<td>75%</td>
<td>6.0</td>
<td>4</td>
<td>95.3</td>
</tr>
<tr style="text-align: right;">
<td><strong>15.4%</strong></td>
<td><strong>3.2%</strong></td>
<td><strong>0.70</strong></td>
<td><strong>75%</strong></td>
<td><strong>6.0</strong></td>
<td><strong>5</strong></td>
<td><strong>94.6</strong></td>
</tr>
<tr style="text-align: right;">
<td>20.1%</td>
<td>3.4%</td>
<td>0.75</td>
<td>95%</td>
<td>6.0</td>
<td>5</td>
<td>114.1</td>
</tr>
<tr style="text-align: right;">
<td>27.3%</td>
<td>3.5%</td>
<td>0.70</td>
<td>90%</td>
<td>3.5</td>
<td>3</td>
<td>117.6</td>
</tr>
<tr style="text-align: right;">
<td>27.8%</td>
<td>3.5%</td>
<td>0.75</td>
<td>80%</td>
<td>3.5</td>
<td>4</td>
<td>106.7</td>
</tr>
<tr style="text-align: right;">
<td>28.4%</td>
<td>3.6%</td>
<td>0.80</td>
<td>85%</td>
<td>4.0</td>
<td>5</td>
<td>109.7</td>
</tr>
<tr style="text-align: right;">
<td>31.0%</td>
<td>3.7%</td>
<td>0.75</td>
<td>75%</td>
<td>2.5</td>
<td>3</td>
<td>106.2</td>
</tr>
<tr style="text-align: right;">
<td>32.3%</td>
<td>3.8%</td>
<td>0.80</td>
<td>85%</td>
<td>3.0</td>
<td>4</td>
<td>113.8</td>
</tr>
<tr style="text-align: right;">
<td>34.0%</td>
<td>3.8%</td>
<td>0.85</td>
<td>90%</td>
<td>3.5</td>
<td>5</td>
<td>117.1</td>
</tr>
<tr style="text-align: right;">
<td>35.1%</td>
<td>4.0%</td>
<td>0.80</td>
<td>95%</td>
<td>2.5</td>
<td>3</td>
<td>127.8</td>
</tr>
<tr style="text-align: right;">
<td>37.0%</td>
<td>4.0%</td>
<td>0.85</td>
<td>90%</td>
<td>2.5</td>
<td>4</td>
<td>120.8</td>
</tr>
<tr style="text-align: right;">
<td>38.6%</td>
<td>4.1%</td>
<td>0.90</td>
<td>90%</td>
<td>3.0</td>
<td>5</td>
<td>119.4</td>
</tr>
<tr style="text-align: right;">
<td>39.0%</td>
<td>4.2%</td>
<td>0.85</td>
<td>95%</td>
<td>2.0</td>
<td>3</td>
<td>129.3</td>
</tr>
<tr style="text-align: right;">
<td>40.7%</td>
<td>4.2%</td>
<td>0.90</td>
<td>95%</td>
<td>2.0</td>
<td>4</td>
<td>127.6</td>
</tr>
<tr style="text-align: right;">
<td>42.3%</td>
<td>4.3%</td>
<td>0.95</td>
<td>90%</td>
<td>2.5</td>
<td>5</td>
<td>121.2</td>
</tr>
<tr style="text-align: right;">
<td>44.0%</td>
<td>4.5%</td>
<td>0.95</td>
<td>100%</td>
<td>2.0</td>
<td>4</td>
<td>134.5</td>
</tr>
<tr style="text-align: right;">
<td>45.5%</td>
<td>4.5%</td>
<td>1.00</td>
<td>100%</td>
<td>2.0</td>
<td>5</td>
<td>132.9</td>
</tr>
<tr style="text-align: right;">
<td>48.1%</td>
<td>4.7%</td>
<td>1.05</td>
<td>95%</td>
<td>1.5</td>
<td>5</td>
<td>128.6</td>
</tr>
<tr style="text-align: right;">
<td>50.6%</td>
<td>5.0%</td>
<td>1.10</td>
<td>100%</td>
<td>1.5</td>
<td>5</td>
<td>134.8</td>
</tr>
</tbody>
</table>
<p></small></p>
<p>Let&#8217;s look at the rule in bold. (<em>s</em>=0.70, equity=75%, smooth=6.0, buffer=5)</p>
<p><center><em>Figure 23. Average Spending, All Cohorts (s=0.7, eq=75%, smooth=6, buffer=5)</em></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot86.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot86.png" alt="Average Spending, All Cohorts (s=0.7, eq=75%, smooth=6, buffer=5)" title="Average Spending, All Cohorts (s=0.7, eq=75%, smooth=6, buffer=5)" width="480" height="320" class="aligncenter size-full wp-image-2012" /></a><br />
</center><br />
<a name="conclusion"></a><br />
<em>What have we learned?</em></p>
<ul>
<li>When you retire matters. A lot.</li>
<li>The 4% rule doesn&#8217;t really work with a restrictive large cap/long term bond portfolio. The best solution is 95% equity and you still get a worst case 35% shortfall.</li>
<li>&lt; 3.5% has generally had a tolerable worst-case, and on average lets your spending grow over time to &gt; 4% of the initial portfolio.</li>
<li>Even at 3.2-3.5%, a dynamic rule gives you higher lifetime spending than a fixed 4% rule, and the failure scenarios are gradual, not sudden and catastrophic.</li>
<li>A large equity allocation is desirable for real long-term growth, and stepping down the amount of equity as you get older doesn&#8217;t seem to improve risk-reward (at least, not a fixed annual stepdown when life expectancy is < 15 years).</li>
<li>Taxes and investment expenses aren&#8217;t included and must be taken into account, reducing returns and the level of safe spending.</li>
<li>On the other hand, including higher-risk, higher-return investments, like small caps, international equities, higher-yielding bonds should improve risk-reward and allow higher returns and spending.</li>
<li>Of course, this analysis assumes the future will not be very different from the past.</li>
<li>Finally, I would add that life annuities, in theory, could be a free lunch. In the analysis above, you put aside 100% of the money you may need in the 25% chance you live to be 90; alternatively, you could join an annuity pool which only needs to put aside money for the survivors, which also has tax advantages. However, fixed annuities are subject to inflation and credit risk, and the market for insurance products for the elderly is a jungle teeming with predators.</li>
</ul>
<p>These dynamic rules are chosen for analytical simplicity, to be easy to understand and calculate. There&#8217;s no reason to believe that they are the best, ie spending a constant/(life expectancy+buffer) is the ideal model to get the highest spending rate at each point in time for the lowest shortfall risk.</p>
<p>In the last part of this series, we&#8217;ll think about what an ideal model would look, and how to maximize spending while keeping shortfall risk at an acceptable level.</p>
<p><small><br />
<a name="f1"></a><sup>1</sup>On further review, the table in Part 2 isn&#8217;t the best way to look at it. No one thinks about the best spending factor they can achieve, they think about the initial spending %. And people don&#8217;t think about &#8216;lowest probability of 10% shortfall.&#8217; Maximum acceptable shortfall is simpler and more informative.<br />
</small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2013/02/%e2%80%98cat-food%e2%80%99-revisited-%e2%80%93-testing-dynamic-spending-rules-%e2%80%93-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>‘Cat Food’ revisited – testing dynamic spending rules – Part 2</title>
		<link>http://blog.streeteye.com/blog/2013/02/%e2%80%98cat-food%e2%80%99-revisited-%e2%80%93-testing-dynamic-spending-rules-%e2%80%93-part-2/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=%25e2%2580%2598cat-food%25e2%2580%2599-revisited-%25e2%2580%2593-testing-dynamic-spending-rules-%25e2%2580%2593-part-2</link>
		<comments>http://blog.streeteye.com/blog/2013/02/%e2%80%98cat-food%e2%80%99-revisited-%e2%80%93-testing-dynamic-spending-rules-%e2%80%93-part-2/#comments</comments>
		<pubDate>Sun, 03 Feb 2013 21:08:57 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1618</guid>
		<description><![CDATA[The last post discussed a framework for evaluating simple dynamic spending rules. We defined a spending factor s as spending each year at a rate of s/(remaining life expectancy); and lifetime spending expectancy as the total amount you could expect to spend over your lifetime. We showed how, as you increase the spending factor, lifetime [...]]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://blog.streeteye.com/blog/2013/01/cat-food-revisited-testing-dynamic-spending-rules/" title="‘Cat Food’ revisited – testing dynamic spending rules – Part 1">last post</a> discussed a framework for evaluating simple dynamic spending rules. </p>
<ul>
<li>We defined a spending factor <em>s</em> as spending each year at a rate of <em>s</em>/(remaining life expectancy); and <em>lifetime spending expectancy</em> as the total amount you could expect to spend over your lifetime.</li>
<li>We showed how, as you increase the spending factor, <em>lifetime spend expectancy initially increases rapidly</em>, but the curve <em>flattens out</em> as spending rate increases.</li>
<li>We showed how, as you increase the spending factor, <em>shortfall risk initially increases slowly</em>, but the curve <em>steepens</em> as spending rate increases.</li>
</ul>
<p>We found a simple dynamic spending rule could increase lifetime spending vs. a traditional fixed 4% rule, while keeping shortfall risk relatively low (arguably reducing risk by making the worst case more benign, at the cost of increased volatility, lowered starting spending, higher probability of modest shortfalls).</p>
<p>In this post we&#8217;ll look at how smoothing spending can improve outcomes, and how changing the equity/bond mix over time affects outcomes.<br />
<span id="more-1618"></span><br />
<em>Second dynamic rule: Smoothing.</em></p>
<p>One oddity in <a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot15.png">Figure 5</a>: even at ultra-low spending rates, you still have a measurable risk of a 25% shortfall from your starting income. At any spending rate, spending is going to vary more or less in line with the market<small><sup>1</sup></small>. So years like 1973 and 1974 might yield big spending drops, even for a 60/40 portfolio at spending rates where you are not at much risk of running out of funds in your lifetime. </p>
<p>If you&#8217;re already spending at a low rate, based on a safe long run return expectation, it doesn&#8217;t make sense to vary spending exactly in line with a short term change in the markets. And it&#8217;s clearly a significant disadvantage over a 4% rule to have that much variation in spending, even when there&#8217;s no shortfall.</p>
<p>Let&#8217;s introduce smoothing. We&#8217;ll still spend at a rate of <em>s</em>/life_expectancy, but instead of multiplying the rate by the latest portfolio value to get spending, we&#8217;ll multiply the rate by <a href="http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages" title="Exponential Moving Average (stockcharts.com)">an exponential moving average</a><small><sup>2</sup></small> of the value of previous years&#8217; portfolios.</p>
<p><em>Figure 8. Lifetime spending expectancy (% of initial portfolio) v. spending factor  (exponential MA, multiplier 1/3).</em></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot47.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot47.png" alt="Lifetime Spend Expectancy v. Spending Factor" title="Lifetime Spend Expectancy v. Spending Factor" width="480" height="320" class="aligncenter size-full wp-image-1835" /></a></p>
<p><em>Figure 9. Probability of spending shortfall v. spending factor (exponential MA, multiplier 1/3)</em></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot48.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot48.png" alt="Probability of Spending Shortfall v. Spending factor (smoothed spending)" title="Probability of Spending Shortfall v. Spending factor (smoothed spending)" width="480" height="320" class="aligncenter size-full wp-image-1837" /></a></p>
<p>We see a notable improvement &#8211; near 0 shortfall risk out to <em>s</em> of 0.5. As the next chart shows, at <em>s</em> of 0.5, we have slightly higher lifetime spending, smoother overall spending and a better-looking worst case. But, even though overall shortfall probability is much lower, in the worst case you can go broke, if you keep overall spending smooth in the face of a market shortfall very late in life.</p>
<p><em>Figure 10. Average Spending, All Cohorts (s=0.5, smoothed w/multiplier=1/3)</em></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot51.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot51.png" alt="Average Spending, All Cohorts (s=0.5, smoothed)" title="Average Spending, All Cohorts (s=0.5, smoothed)" width="480" height="320" class="aligncenter size-full wp-image-1841" /></a></p>
<p><em>Efficient frontier<small><sup>3</sup></small>.</em> To better visualize the tradeoff, we can combine these 2 graphs into one, which shows the best lifetime spend expectancy we can achieve for any level of shortfall risk:</p>
<p><center><em>Figure 11. Lifetime spend expectancy v. probability of 10% shortfall<br />(&#8216;Efficient frontier&#8217;)</em></center></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot52.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot52.png" alt="Lifetime spending expectancy v. Shortfall probability" title="Lifetime spending expectancy v. Shortfall probability" width="480" height="320" class="aligncenter size-full wp-image-1845" /></a></p>
<p>For low shortfall rates (the left side), the smoothed spending results in higher lifetime spending expectancy with lower shortfall risk. Smoothing improves the tradeoff, and represents a flexible middle ground between varying spending in line with the market, and setting a fixed spending amount at retirement like the 4% rule.</p>
<p><em>Portfolio composition</em></p>
<p>So far, we have looked only at a 60/40 portfolio. Let&#8217;s keep the smoothing multiplier at 1/3 and create efficient frontiers for a range of allocations from 0% to 100% stocks. </p>
<p><center><em>Figure 12. Lifetime spend expectancy v. probability of 10% shortfall<br />(&#8216;Efficient frontier&#8217;), by % of equities, smoothing multiplier=1/3</em></center></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot55.png" ><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot55.png" alt="Lifetime Spend Expectancy v. Shortfall Probability" title="Lifetime Spend Expectancy v. Shortfall Probability" width="480" height="320" class="aligncenter size-full wp-image-1848" /></a></p>
<p>We can do this as a big panel (easier to read, esp. the legend): <a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot56.png" title="Efficient frontier, by equity %">Figure 13</a>. What does this tell us? For this particular smoothing multiplier 1/3, the 50/50 portfolio dominates others (the black line), giving greater lifetime spending at low shortfall probabilities.</p>
<p>Let&#8217;s cut to the chase and find for each spending factor, the highest spending expectancy we can achieve with zero shortfall risk, or if zero risk is not feasible, the lowest feasible risk:</p>
<p><center><small></p>
<table cellspacing="10">
<tbody>
<tr style="text-align: right;">
<td><em>&nbsp;<br />s</em></td>
<td>Life spend&nbsp;<br />expect.</td>
<td>Prob 10%&nbsp;<br />shortfall</td>
<td>Prob 25%&nbsp;<br />shortfall</td>
<td>Prob 50%&nbsp;<br />shortfall</td>
<td>Equity&nbsp;<br />%</td>
<td>&nbsp;<br />Smoothing</td>
</tr>
<tr style="text-align: right;">
<td>0.30</td>
<td>104.27</td>
<td>0.0%</td>
<td>0.0%</td>
<td>0.0%</td>
<td>100%</td>
<td>5.0</td>
</tr>
<tr style="text-align: right;">
<td>0.35</td>
<td>90.71</td>
<td>0.0%</td>
<td>0.0%</td>
<td>0.0%</td>
<td>75%</td>
<td>4.0</td>
</tr>
<tr style="text-align: right;">
<td>0.40</td>
<td>77.62</td>
<td>0.1%</td>
<td>0.1%</td>
<td>0.1%</td>
<td>50%</td>
<td>3.5</td>
</tr>
<tr style="text-align: right;">
<td>0.45</td>
<td>89.74</td>
<td>0.9%</td>
<td>0.9%</td>
<td>0.9%</td>
<td>60%</td>
<td>4.0</td>
</tr>
<tr style="text-align: right;">
<td>0.50</td>
<td>97.99</td>
<td>2.6%</td>
<td>2.6%</td>
<td>2.4%</td>
<td>65%</td>
<td>4.5</td>
</tr>
<tr style="text-align: right;">
<td>0.55</td>
<td>110.23</td>
<td>5.4%</td>
<td>3.3%</td>
<td>2.9%</td>
<td>75%</td>
<td>4.0</td>
</tr>
<tr style="text-align: right;">
<td>0.60</td>
<td>122.56</td>
<td>8.8%</td>
<td>8.4%</td>
<td>8.1%</td>
<td>85%</td>
<td>6.0</td>
</tr>
<tr style="text-align: right;">
<td>0.70</td>
<td>126.98</td>
<td>19.3%</td>
<td>13.5%</td>
<td>11.9%</td>
<td>85%</td>
<td>5.0</td>
</tr>
<tr style="text-align: right;">
<td>0.80</td>
<td>124.34</td>
<td>28.5%</td>
<td>23.9%</td>
<td>22.1%</td>
<td>80%</td>
<td>6.0</td>
</tr>
<tr style="text-align: right;">
<td>0.90</td>
<td>134.70</td>
<td>36.9%</td>
<td>32.6%</td>
<td>29.0%</td>
<td>90%</td>
<td>6.0</td>
</tr>
<tr style="text-align: right;">
<td>1.00</td>
<td>139.22</td>
<td>43.3%</td>
<td>39.6%</td>
<td>36.0%</td>
<td>95%</td>
<td>6.0</td>
</tr>
</tbody>
</table>
<p></small></center></p>
<p>That&#8217;s pretty much all we have time for this week. But before we go, let&#8217;s look at the spending profiles for 4 solutions.</p>
<p><center><em>Figure 14. Spending profiles for selected spending factors </em></center></p>
<p>Spending factor 0.35; Shortfall risk 0%; Lifetime spend expectancy 90.7; Initial spend 2.0%<br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S35_75_4.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S35_75_4.png" alt="Spend factor .35 Equity 75 Smooth 4" title="Spend factor .35 Equity 75 Smooth 4" width="480" height="320" class="aligncenter size-full wp-image-1879" /></a></p>
<p>Spending factor 0.45; Shortfall risk 0.9%; Lifetime spend expectancy 89.7; Initial spend 2.6%<br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S45_60_4.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S45_60_4.png" alt="Spend factor .45 Equity 60 Smooth 4" title="Spend factor .45 Equity 60 Smooth 4" width="480" height="320" class="aligncenter size-full wp-image-1880" /></a></p>
<p>Spending factor 0.5; Shortfall risk 2.6%; Lifetime spend expectancy 98.0; Initial spend 2.9%<br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S50_65_45.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S50_65_45.png" alt="Spend factor .50 Equity 65 Smooth 4.5" title="Spend factor .50 Equity 65 Smooth 4.5" width="480" height="320" class="aligncenter size-full wp-image-1881" /></a></p>
<p>Spending factor 0.55; Shortfall risk 5.4%; Lifetime spend expectancy 110.2; Initial spend 3.2%<br />
<a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S55_75_4.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/02/Rplot57_S55_75_4.png" alt="Spend factor .55 Equity 75 Smooth 4" title="Spend factor .55 Equity 75 Smooth 4" width="480" height="320" class="aligncenter size-full wp-image-1882" /></a></p>
<p>To be 100% safe, we need an initial spending rate below 4% &ndash; keeping in mind that the portfolio and spending usually rises over time at safe withdrawal rates. With this restrictive investment universe, the 4% rule is not 100% safe either, and the last chart is <a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot50.png" title="4% profile">a less undesirable spending profile than the 4% fixed spending profile</a> from the last post. On average, total spending is significantly higher, and the worst case is more desirable since it falls short later.</p>
<p>Next time, we&#8217;ll look at varying the equity percentage dynamically as you get older, other dynamic rules that might reduce late in life shortfall risk (and the undesirable hump in these curves), and we&#8217;ll talk about what the best possible optimal rule would look like. </p>
<p><small><br />
<sup>1</sup>modulo the increase in spending rate as you age, from our <em>s</em>/life_expectancy rule. The <em>s</em> spending rate stays the same, but the denominator decreases. </p>
<p><sup>2</sup>The exponential moving average has a good combination of sensitivity to the underlying series, and smoothing. A simple n-period  moving average, which weights all n periods equally, has undesirable properties. In particular, it&#8217;s possible for a simple moving average to move up, when the underlying series is moving below the moving average. Consider this series: 100, 110, 120, 109. A 3-period moving average is after the 3rd element is 110, after the fourth is 113, because the trailing element which left the series (100) is lower than the new element (109).</p>
<p><sup>3</sup>This is not exactly the same as the CAPM efficient frontier. For one thing, instead of return, we plot lifetime spending in inflation-adjusted dollars. For another, instead of volatility, it&#8217;s the probability of a 25% shortfall from the starting spending. It&#8217;s a similar risk v. return plot, but can&#8217;t be interpreted quite the same way (eg adding risk-free cash to find additional feasible/optimal portfolios).</p>
<p></small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2013/02/%e2%80%98cat-food%e2%80%99-revisited-%e2%80%93-testing-dynamic-spending-rules-%e2%80%93-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>‘Cat Food’ revisited – testing dynamic spending rules – Part 1</title>
		<link>http://blog.streeteye.com/blog/2013/01/cat-food-revisited-testing-dynamic-spending-rules/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=cat-food-revisited-testing-dynamic-spending-rules</link>
		<comments>http://blog.streeteye.com/blog/2013/01/cat-food-revisited-testing-dynamic-spending-rules/#comments</comments>
		<pubDate>Sat, 26 Jan 2013 01:08:34 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1429</guid>
		<description><![CDATA[How much can you safely spend out of a portfolio in retirement? Spend conservatively and you may be unnecessarily curbing the lifestyle and aspirations of you and your loved ones. Overspend and risk a shortfall and painful adjustment &#8211; in the extreme, the (hopefully apocryphal) &#8220;cat food&#8221; diet. A traditional rule of thumb is a [...]]]></description>
				<content:encoded><![CDATA[<p>How much can you safely spend out of a portfolio in retirement? Spend conservatively and you may be unnecessarily curbing the lifestyle and aspirations of you and your loved ones. Overspend and risk a shortfall and painful adjustment &#8211; in the extreme, the (hopefully apocryphal) &#8220;cat food&#8221; diet.</p>
<p>A traditional rule of thumb is <a href="http://online.wsj.com/article/SB10001424052970203960804577241143142670660.html" title="WSJ: Testing the 4%-a-Year Retirement Rule">a fixed 4% per year</a> of your starting portfolio, adjusted each year for inflation. <a href="http://blog.streeteye.com/blog/2011/08/cat-food-in-an-age-of-diminished-expectations/">A previous post</a> discussed why this rule may not be safe:</p>
<ul>
<li><a title="Federal Reserve H. 15" href="http://www.federalreserve.gov/releases/h15/update/">Low bond yields</a> &#8211; 1.8% for 10-year Treasurys and negative TIPS out to 10 years &#8211; mean historical bond returns are mathematically unobtainable.<sup>1</sup></li>
<li>2.2% real returns since 2000 on a 60/40 blended portfolio suggest that long-run return expectations need to be revisited. Low long-term interest rates are a forecast of low future returns, ie low growth and inflation expectations. To the extent equity risk premiums haven&#8217;t widened, they forecast lower than normal equity returns.</li>
<li>Taxes and investment expenses must be included. Work supporting 4% tends to ignore them.</li>
<li>US demographics are not very positive for growth, inflation, tax rates, and hence, real after-tax investment returns (which is reflected in the US fiscal position). <a title="Census population projections" href="http://www.census.gov/prod/2010pubs/p25-1138.pdf">The US dependency ratio</a> is forecast to rise by 15 points over the next 20 years.</li>
</ul>
<p>If the 4% rule hasn&#8217;t been decisively breached, forward-looking indicators are a bit worrisome. Could a more flexible rule not only be safer, but in favorable circumstances allow a higher level of spending? In this 3-part post, we test dynamic rules that vary withdrawal rates based on age and the size of the portfolio, and vary the composition of the portfolio over time.<br />
<span id="more-1429"></span><br />
<em>Dynamic rule 1: Vary spending by age.</em></p>
<p>The first rule we&#8217;ll test is to spend a percentage of the <em>actual </em>portfolio each year (not a fixed percentage of the <em>initial </em>portfolio) and vary the percentage by age.</p>
<p>Suppose you are a 65 year old male. You have a life expectancy of 17.19 years per <a href="http://www.ssa.gov/oact/STATS/table4c6.html" title="Social Security life table">US government actuarial tables</a>. It would make sense to vary spending as a percentage of your assets inversely with your life expectancy. As a base case you could spend 1/17.19=5.82% of your portfolio this year. Next year your life expectancy would be 16.48% You would spend 1/16.48=6.07%. This is higher than 4% for life expectancy &lt; 25 years, but it&#8217;s an arbitrary base case &#8211; just a starting point to test a rule based on the size of the portfolio and life expectancy.</p>
<p>Let&#8217;s apply this rule to a 60/40 stock/bond portfolio for someone who retired in 1928 to and see what spending it would have supported.</p>
<p><em>Figure 1. Inflation-adjusted spending for a 65-year-old single male who retires in 1928, with dynamic spending rule of 1/life_expectancy (spending factor=1) v. survival rate</em></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot08.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot08.png" alt="Income v. Survival, 1928 males, 60/40 portfolio, spending factor 1" title="Income v. Survival, 1928 males, 60/40 portfolio, spending factor 1" width="480" height="320" class="aligncenter size-full wp-image-1648" /></a></p>
<p>This retiree would have experienced volatility, but he would really have started to go broke after around 1947, aged 85, shortly after his original life expectancy at retirement. From the blue survival line (from <a title="SSA.gov Actuarial Life Table" href="http://www.ssa.gov/oact/STATS/table4c6.html">current life expectancy tables</a>), over 40% would still have been alive for that drop. If he lived to be 100 after 35 years in 1963, he would have been penniless.</p>
<p>Is this rule too spendthrift, or was 1928 a particularly bad year to start retirement? Let&#8217;s try the same rule in all available 35-year retirement cohorts 1928-1977, and plot their average spending.</p>
<p><center><em>Figure 2. Average spending, 60/40 portfolio, spending factor 1, retirement age 65, all cohorts</em></center></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot09.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot09.png" alt="Average spending, 60/40 portfolio, spending factor 1, retirement age 65, all cohorts" title="Average spending, 60/40 portfolio, spending factor 1, retirement age 65, all cohorts" width="480" height="320" class="aligncenter size-full wp-image-1658" /></a></p>
<p>The middle blue line is the average income by retirement year. The green and red are the best and worst cases. The middle 2 lines represent the +/- 1 standard deviation confidence interval.</p>
<p>Even in the best case, you eventually go broke. Your life expectancy is 17.2 years at retirement, and on average your spending goes below the starting amount around year 19. This spending rule may not conservative enough.</p>
<p>Let&#8217;s call <em>s</em> spending factor, and try different spending rates <em>s</em>/life_expectancy. We can run spending factors between 0.05 and 1.2: <em><a title="Average spending, all cohorts, by spending factor" href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot10.png" target="_blank">Figure 3. Big chart panel (opens in new window)</a></em>. As we move toward the top of the page, we see safer profiles, and even the worst case scenarios start to seem fairly acceptable.</p>
<p>This exercise demonstrates the tradeoff between spending, and the risk of the average or worst-case income path exhibiting a major shortfall from the starting income.</p>
<p>To better visualize this big panel, we can estimate &#8216;lifetime spend expectancy&#8217; and shortfall probability for each spending factor.</p>
<p><center><em>Figure 4. Lifetime spending expectancy (% of initial portfolio) v. spending factor</em></center></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot13.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot13.png" alt="Lifetime spend expectancy v. spending factor" title="Lifetime spend expectancy v. spending factor" width="480" height="320" class="aligncenter size-full wp-image-1667" /></a></p>
<p>In Figure 4, for each year, we multiply the spending outcome by the probability of a cohort retiree surviving to that year, and sum up the years, to get the lifetime spend expectancy for a given spending factor. This summarizes each line in the Figure 3 panel as a single point, the expected lifetime spending as a percentage of starting portfolio.</p>
<p><center><em>Figure 5. Probability of spending shortfall v. spending factor.</em></center></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot15.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot15.png" alt="Probability of spending shortfall v. spending factor" title="Probability of spending shortfall v. spending factor" width="480" height="320" class="aligncenter size-full wp-image-1727" /></a></p>
<p>In Figure 5, for each <em>s</em>, we calculate the percentage of retirees in all cohorts who survived to a year where the spending falls to 25% below the initial spending.</p>
<p>These last 2 charts illustrate that as you increase the spending factor past 0.6, increasing lifetime spend expectancy flattens out, and the probability of 25% shortfall accelerates sharply. </p>
<p>Finally, how does the fixed 4% rule compare? For a 65-year-old with a 60/40 portfolio, the 4% rule yields 70.4 expected lifetime spending with a 2% lifetime shortfall probability. </p>
<p>By comparison, a 0.5 spending factor, which starts at about 3% spending, yields expected spending of 91.2 with a 9.7% probability of a 25% drop from the initial spend amount, and a worst case drop of 37% (for 1973 retirees &#8211; they eventually recovered). </p>
<p>But you do start at a lower rate, and spending is variable.</p>
<p><center><em>Figure 6. Average spending by retirement year, all cohorts, spending factor 0.5.</em></center></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot45.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot45.png" alt="Average spending, all cohorts, spending factor 0.5" title="Average spending, all cohorts, spending factor 0.5" width="480" height="320" class="aligncenter size-full wp-image-1828" /></a></p>
<p><center><em>Figure 7. Average spending by retirement year, all cohorts, fixed 4% rule</em></center></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot50.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Rplot50.png" alt="Average spending by retirement year, all cohorts, Fixed 4% rule" title="Average spending by retirement year, all cohorts, Fixed 4% rule" width="480" height="320" class="aligncenter size-full wp-image-1838" /></a><br />
In the next post, we&#8217;ll test additional rules, to vary the composition of the portfolio by age, and to try smooth spending.</p>
<p><small><br />
<sup>1</sup>The objection has been made that today&#8217;s rates can go lower and bond returns can be higher in the short run. True, but a 10-year bond bought at a yield of 1.8% will return, best case, 1.8% nominal over its lifetime (less in the event of default). If the yield goes to zero this year, it will return 18% this year, and zero over the rest of its lifetime. It&#8217;s called &#8220;fixed&#8221; income for a reason. When interest rates are below inflation, thinking bonds can be a real total return instrument in the base case is setting up for disappointment. It hasn&#8217;t been true historically, and it&#8217;s not what the market is pricing in. Bonds still have an important role as a liquidity and deflation hedge.<br />
</small></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1429code2'); return false;">View Code</a> RSPLUS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14292"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
</pre></td><td class="code" id="p1429code2"><pre class="rsplus" style="font-family:monospace;">ageframe <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a> <span style="color: #080;">&#40;</span>lifetable, age, maxage<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    <span style="color: #0000FF; font-weight: bold;">start</span> <span style="color: #080;">=</span> age<span style="color: #080;">+</span><span style="color: #ff0000;">1</span>
    <span style="color: #0000FF; font-weight: bold;">end</span><span style="color: #080;">=</span>maxage<span style="color: #080;">+</span><span style="color: #ff0000;">1</span>
    keep <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Age&quot;</span>,<span style="color: #ff0000;">&quot;Mmort&quot;</span>,<span style="color: #ff0000;">&quot;Mlives&quot;</span>,<span style="color: #ff0000;">&quot;MLE&quot;</span><span style="color: #080;">&#41;</span>
    retframe <span style="color: #080;">=</span> lifetable<span style="color: #080;">&#91;</span><span style="color: #0000FF; font-weight: bold;">start</span><span style="color: #080;">:</span><span style="color: #0000FF; font-weight: bold;">end</span>,keep<span style="color: #080;">&#93;</span>
    retframe$survivepct<span style="color: #080;">=</span>retframe$Mlives<span style="color: #080;">/</span>retframe<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span>,<span style="color: #ff0000;">&quot;Mlives&quot;</span><span style="color: #080;">&#93;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>retframe<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
cohortframe <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a> <span style="color: #080;">&#40;</span>ageframe, portframe, startyear<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    retframe <span style="color: #080;">&lt;-</span>ageframe
    retireyears<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>ageframe<span style="color: #080;">&#41;</span>
    endyear <span style="color: #080;">=</span> startyear<span style="color: #080;">+</span>retireyears<span style="color: #080;">-</span><span style="color: #ff0000;">1</span>
    retframe$portreturn <span style="color: #080;">=</span> portframe<span style="color: #080;">&#91;</span>startyear<span style="color: #080;">:</span>endyear,<span style="color: #ff0000;">&quot;portreturn&quot;</span><span style="color: #080;">&#93;</span>
    retframe$year <span style="color: #080;">=</span> portframe<span style="color: #080;">&#91;</span>startyear<span style="color: #080;">:</span>endyear,<span style="color: #ff0000;">&quot;Year&quot;</span><span style="color: #080;">&#93;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>retframe<span style="color: #080;">&#41;</span>
&nbsp;
<span style="color: #080;">&#125;</span>
&nbsp;
calcspending <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>cohortframe, spendingfactor<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    retframe <span style="color: #080;">&lt;-</span> cohortframe
    retframe$spend<span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
    retframe$startportval<span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
    retframe$endportval<span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
    portval<span style="color: #080;">=</span><span style="color: #ff0000;">100</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>retframe<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
        myrow <span style="color: #080;">=</span> retframe<span style="color: #080;">&#91;</span>index,<span style="color: #080;">&#93;</span>
        myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;startportval&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span>portval
        spendrate <span style="color: #080;">=</span> spendingfactor<span style="color: #080;">/</span>myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;MLE&quot;</span><span style="color: #080;">&#93;</span>
        spend <span style="color: #080;">=</span> spendrate <span style="color: #080;">*</span> portval
        myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;spend&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span>spend
        portval <span style="color: #080;">=</span> portval <span style="color: #080;">-</span> spend
        portval <span style="color: #080;">=</span> portval <span style="color: #080;">*</span> <span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span> <span style="color: #080;">+</span> myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;portreturn&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
        myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;endportval&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span>portval
        retframe<span style="color: #080;">&#91;</span>index,<span style="color: #080;">&#93;</span><span style="color: #080;">=</span>myrow
    <span style="color: #080;">&#125;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>retframe<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
calcspendingfixed <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>cohortframe, spendingfactor<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    retframe <span style="color: #080;">&lt;-</span> cohortframe
    retframe$spend<span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
    retframe$startportval<span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
    retframe$endportval<span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
    portval<span style="color: #080;">=</span><span style="color: #ff0000;">100</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>retframe<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
        myrow <span style="color: #080;">=</span> retframe<span style="color: #080;">&#91;</span>index,<span style="color: #080;">&#93;</span>
        myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;startportval&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span>portval
        <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/if.html"><span style="color: #0000FF; font-weight: bold;">if</span></a> <span style="color: #080;">&#40;</span> portval <span style="color: #080;">&gt;</span> <span style="color: #ff0000;">4</span><span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
            spend <span style="color: #080;">=</span> <span style="color: #ff0000;">4</span>
        <span style="color: #080;">&#125;</span> <span style="color: #0000FF; font-weight: bold;">else</span> <span style="color: #080;">&#123;</span>
            spend <span style="color: #080;">&lt;-</span> portval
        <span style="color: #080;">&#125;</span>
        myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;spend&quot;</span><span style="color: #080;">&#93;</span> <span style="color: #080;">&lt;-</span> spend
&nbsp;
        portval <span style="color: #080;">=</span> portval <span style="color: #080;">-</span> spend
        portval <span style="color: #080;">=</span> portval <span style="color: #080;">*</span> <span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span> <span style="color: #080;">+</span> myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;portreturn&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
        myrow<span style="color: #080;">&#91;</span><span style="color: #ff0000;">&quot;endportval&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span>portval
        retframe<span style="color: #080;">&#91;</span>index,<span style="color: #080;">&#93;</span><span style="color: #080;">=</span>myrow
    <span style="color: #080;">&#125;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>retframe<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
testspendingfactor <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>realreturns, spendingfactor, minage, maxage<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    tempageframe <span style="color: #080;">&lt;-</span> ageframe<span style="color: #080;">&#40;</span>lifetable, minage, maxage<span style="color: #080;">&#41;</span>
    ntrials <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>realreturns<span style="color: #080;">&#41;</span><span style="color: #080;">-</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>tempageframe<span style="color: #080;">&#41;</span> <span style="color: #080;">+</span><span style="color: #ff0000;">1</span>
    nyears <span style="color: #080;">&lt;-</span> maxage<span style="color: #080;">-</span>minage<span style="color: #080;">+</span><span style="color: #ff0000;">1</span>
    trials <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/data.frame.html"><span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">:</span>nyears<span style="color: #080;">&#41;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/colnames.html"><span style="color: #0000FF; font-weight: bold;">colnames</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;age&quot;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span>ntrials<span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
        tempframe1 <span style="color: #080;">=</span> cohortframe<span style="color: #080;">&#40;</span>tempageframe,realreturns,index<span style="color: #080;">&#41;</span>
        tempframe2 <span style="color: #080;">=</span> calcspending<span style="color: #080;">&#40;</span>tempframe1,spendingfactor<span style="color: #080;">&#41;</span>
        colname <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/paste.html"><span style="color: #0000FF; font-weight: bold;">paste</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;trial&quot;</span>,index, sep<span style="color: #080;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #080;">&#41;</span>
        trials<span style="color: #080;">&#91;</span>colname<span style="color: #080;">&#93;</span> <span style="color: #080;">&lt;-</span> tempframe2$spend
    <span style="color: #080;">&#125;</span>
&nbsp;
    trials <span style="color: #080;">&lt;-</span> trials<span style="color: #080;">&#91;</span><span style="color: #ff0000;">2</span><span style="color: #080;">:</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/ncol.html"><span style="color: #0000FF; font-weight: bold;">ncol</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span>
&nbsp;
<span style="color: #080;">&#125;</span>
&nbsp;
testspendingfactorfixed <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>realreturns, spendingfactor, minage, maxage<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    tempageframe <span style="color: #080;">&lt;-</span> ageframe<span style="color: #080;">&#40;</span>lifetable, minage, maxage<span style="color: #080;">&#41;</span>
    ntrials <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>realreturns<span style="color: #080;">&#41;</span><span style="color: #080;">-</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>tempageframe<span style="color: #080;">&#41;</span> <span style="color: #080;">+</span><span style="color: #ff0000;">1</span>
    nyears <span style="color: #080;">&lt;-</span> maxage<span style="color: #080;">-</span>minage<span style="color: #080;">+</span><span style="color: #ff0000;">1</span>
    trials <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/data.frame.html"><span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">:</span>nyears<span style="color: #080;">&#41;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/colnames.html"><span style="color: #0000FF; font-weight: bold;">colnames</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;age&quot;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span>ntrials<span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
        tempframe1 <span style="color: #080;">=</span> cohortframe<span style="color: #080;">&#40;</span>tempageframe,realreturns,index<span style="color: #080;">&#41;</span>
        tempframe2 <span style="color: #080;">=</span> calcspendingfixed<span style="color: #080;">&#40;</span>tempframe1,spendingfactor<span style="color: #080;">&#41;</span>
        colname <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/paste.html"><span style="color: #0000FF; font-weight: bold;">paste</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;trial&quot;</span>,index, sep<span style="color: #080;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #080;">&#41;</span>
        trials<span style="color: #080;">&#91;</span>colname<span style="color: #080;">&#93;</span> <span style="color: #080;">&lt;-</span> tempframe2$spend
    <span style="color: #080;">&#125;</span>
&nbsp;
    trials <span style="color: #080;">&lt;-</span> trials<span style="color: #080;">&#91;</span><span style="color: #ff0000;">2</span><span style="color: #080;">:</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/ncol.html"><span style="color: #0000FF; font-weight: bold;">ncol</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
calctrialssummary <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    trialssummary <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/data.frame.html"><span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">:</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/colnames.html"><span style="color: #0000FF; font-weight: bold;">colnames</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#41;</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;year&quot;</span>
    trialssummary$mean<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/mean.html"><span style="color: #0000FF; font-weight: bold;">mean</span></a><span style="color: #080;">&#41;</span>
&nbsp;
    trialssummary$max<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/max.html"><span style="color: #0000FF; font-weight: bold;">max</span></a><span style="color: #080;">&#41;</span>
    trialssummary$min<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/min.html"><span style="color: #0000FF; font-weight: bold;">min</span></a><span style="color: #080;">&#41;</span>
    trialssummary$sd<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<span style="color: #0000FF; font-weight: bold;">sd</span><span style="color: #080;">&#41;</span>
    trialssummary$plus1sd<span style="color: #080;">=</span>trialssummary$mean <span style="color: #080;">+</span> trialssummary$sd
    trialssummary$minus1sd<span style="color: #080;">=</span>trialssummary$mean <span style="color: #080;">-</span> trialssummary$sd
    keep <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;year&quot;</span>, <span style="color: #ff0000;">&quot;mean&quot;</span>,<span style="color: #ff0000;">&quot;min&quot;</span>,<span style="color: #ff0000;">&quot;max&quot;</span>,<span style="color: #ff0000;">&quot;minus1sd&quot;</span>,<span style="color: #ff0000;">&quot;plus1sd&quot;</span><span style="color: #080;">&#41;</span>
    trialssummary <span style="color: #080;">&lt;-</span> trialssummary<span style="color: #080;">&#91;</span>,keep<span style="color: #080;">&#93;</span>
&nbsp;
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
&nbsp;
calcexpectedspending<span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>trials, survival<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    trialssummary <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/data.frame.html"><span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">:</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/nrow.html"><span style="color: #0000FF; font-weight: bold;">nrow</span></a><span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/colnames.html"><span style="color: #0000FF; font-weight: bold;">colnames</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#41;</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;year&quot;</span>
&nbsp;
    trialssummary$survivepct<span style="color: #080;">=</span>survival$survivepct
    trialssummary$mean<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/mean.html"><span style="color: #0000FF; font-weight: bold;">mean</span></a><span style="color: #080;">&#41;</span>
    trialssummary$expmean<span style="color: #080;">=</span> trialssummary$mean <span style="color: #080;">*</span> trialssummary$survivepct
    trialssummary$max<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/max.html"><span style="color: #0000FF; font-weight: bold;">max</span></a><span style="color: #080;">&#41;</span>
    trialssummary$expmax<span style="color: #080;">=</span> trialssummary$max <span style="color: #080;">*</span> trialssummary$survivepct
    trialssummary$min<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/min.html"><span style="color: #0000FF; font-weight: bold;">min</span></a><span style="color: #080;">&#41;</span>
    trialssummary$expmin<span style="color: #080;">=</span> trialssummary$min <span style="color: #080;">*</span> trialssummary$survivepct
    trialssummary$sd<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">1</span>,<span style="color: #0000FF; font-weight: bold;">sd</span><span style="color: #080;">&#41;</span>
    trialssummary$plus1sd<span style="color: #080;">=</span>trialssummary$mean <span style="color: #080;">+</span> trialssummary$sd
    trialssummary$expplus1sd<span style="color: #080;">=</span> trialssummary$plus1sd <span style="color: #080;">*</span> trialssummary$survivepct
    trialssummary$minus1sd<span style="color: #080;">=</span>trialssummary$mean <span style="color: #080;">-</span> trialssummary$sd
    trialssummary$expminus1sd<span style="color: #080;">=</span> trialssummary$minus1sd <span style="color: #080;">*</span> trialssummary$survivepct
&nbsp;
    keep <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;year&quot;</span>, <span style="color: #ff0000;">&quot;expmean&quot;</span>,<span style="color: #ff0000;">&quot;expmin&quot;</span>,<span style="color: #ff0000;">&quot;expmax&quot;</span>, <span style="color: #ff0000;">&quot;expplus1sd&quot;</span>, <span style="color: #ff0000;">&quot;expminus1sd&quot;</span><span style="color: #080;">&#41;</span>
    trialssummary <span style="color: #080;">&lt;-</span> trialssummary<span style="color: #080;">&#91;</span>,keep<span style="color: #080;">&#93;</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/return.html"><span style="color: #0000FF; font-weight: bold;">return</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
chartsummary <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>trialssummary, mytitle<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#123;</span>
    meltframe <span style="color: #080;">&lt;-</span> melt<span style="color: #080;">&#40;</span>trialssummary, id <span style="color: #080;">=</span> <span style="color: #ff0000;">'year'</span><span style="color: #080;">&#41;</span>
    ggplot<span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">data</span><span style="color: #080;">=</span>meltframe, aes<span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>year, y<span style="color: #080;">=</span>value, colour<span style="color: #080;">=</span>variable<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     scale_x_continuous<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     ylab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Annual spending (% of initial portfolio)&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     xlab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Retirement year&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     theme_bw<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     geom_line<span style="color: #080;">&#40;</span>size<span style="color: #080;">=</span><span style="color: #ff0000;">1.4</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     opts<span style="color: #080;">&#40;</span>legend.<span style="">position</span><span style="color: #080;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>,
          legend.<span style="">direction</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">'horizontal'</span>,
          plot.<span style="">background</span> <span style="color: #080;">=</span> theme_rect<span style="color: #080;">&#40;</span>colour <span style="color: #080;">=</span> <span style="color: #ff0000;">'black'</span>, fill <span style="color: #080;">=</span> <span style="color: #ff0000;">'#CCCCEE'</span>, size <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span>, linetype<span style="color: #080;">=</span><span style="color: #ff0000;">'solid'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     scale_colour_manual<span style="color: #080;">&#40;</span>mytitle, breaks <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'mean'</span>, <span style="color: #ff0000;">'min'</span>,<span style="color: #ff0000;">'max'</span>,<span style="color: #ff0000;">'minus1sd'</span>,<span style="color: #ff0000;">'plus1sd'</span><span style="color: #080;">&#41;</span>,
                         values <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;#000099&quot;</span>, <span style="color: #ff0000;">&quot;#CC0000&quot;</span>,<span style="color: #ff0000;">&quot;#009900&quot;</span>,<span style="color: #ff0000;">&quot;#999999&quot;</span>,<span style="color: #ff0000;">&quot;#999999&quot;</span><span style="color: #080;">&#41;</span>,
                        <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/labels.html"><span style="color: #0000FF; font-weight: bold;">labels</span></a> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'Average Spend'</span>, <span style="color: #ff0000;">'Minimum'</span>, <span style="color: #ff0000;">'Maximum'</span>, <span style="color: #ff0000;">'-1 SD'</span>, <span style="color: #ff0000;">'+1SD'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/library.html"><span style="color: #0000FF; font-weight: bold;">library</span></a><span style="color: #080;">&#40;</span>ggplot2<span style="color: #080;">&#41;</span>
&nbsp;
returns <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">read.<span style="">csv</span></span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;~/Documents/returns.csv&quot;</span><span style="color: #080;">&#41;</span>  <span style="color: #228B22;"># http://blog.streeteye.com/blog/wp-content/uploads/2013/01/returns.csv</span>
lifetable <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">read.<span style="">csv</span></span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;~/Documents/Lifetable.csv&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #228B22;"># http://blog.streeteye.com/blog/wp-content/uploads/2013/01/Lifetable.csv</span>
&nbsp;
returns$realstocks<span style="color: #080;">=</span>returns$Stocks<span style="color: #080;">-</span>returns$CPI
returns$realbonds<span style="color: #080;">=</span>returns$Bonds<span style="color: #080;">-</span>returns$CPI
returns$realbills<span style="color: #080;">=</span>returns$Bills<span style="color: #080;">-</span>returns$CPI
&nbsp;
drops <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Stocks&quot;</span>,<span style="color: #ff0000;">&quot;Bonds&quot;</span>,<span style="color: #ff0000;">&quot;Bills&quot;</span>,<span style="color: #ff0000;">&quot;CPI&quot;</span><span style="color: #080;">&#41;</span>
realreturns <span style="color: #080;">&lt;-</span> returns<span style="color: #080;">&#91;</span>,<span style="color: #080;">!</span><span style="color: #080;">&#40;</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/names.html"><span style="color: #0000FF; font-weight: bold;">names</span></a><span style="color: #080;">&#40;</span>returns<span style="color: #080;">&#41;</span> <span style="color: #080;">%</span>in<span style="color: #080;">%</span> drops<span style="color: #080;">&#41;</span><span style="color: #080;">&#93;</span>
realreturns$portreturn <span style="color: #080;">=</span> <span style="color: #ff0000;">0.6</span><span style="color: #080;">*</span>realreturns$realstocks <span style="color: #080;">+</span> <span style="color: #ff0000;">0.4</span> <span style="color: #080;">*</span>realreturns$realbonds
&nbsp;
<span style="color: #228B22;">#Figure 1</span>
&nbsp;
tempageframe <span style="color: #080;">&lt;-</span> ageframe<span style="color: #080;">&#40;</span>lifetable, <span style="color: #ff0000;">65</span>, <span style="color: #ff0000;">100</span><span style="color: #080;">&#41;</span>
tempframe1 <span style="color: #080;">=</span> cohortframe<span style="color: #080;">&#40;</span>tempageframe,realreturns,<span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span>
tempframe2 <span style="color: #080;">=</span> calcspending<span style="color: #080;">&#40;</span>tempframe1,<span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span>
tempframe2$survival65 <span style="color: #080;">=</span> tempframe2$survivepct <span style="color: #080;">*</span> <span style="color: #ff0000;">10000</span>
tempframe2$spend <span style="color: #080;">=</span> tempframe2$spend <span style="color: #080;">*</span> <span style="color: #ff0000;">1000</span>
keep <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;year&quot;</span>,<span style="color: #ff0000;">&quot;spend&quot;</span>,<span style="color: #ff0000;">&quot;survival65&quot;</span> <span style="color: #080;">&#41;</span>
tempframe2 <span style="color: #080;">&lt;-</span> tempframe2<span style="color: #080;">&#91;</span>,keep<span style="color: #080;">&#93;</span>
meltframe <span style="color: #080;">&lt;-</span> melt<span style="color: #080;">&#40;</span>tempframe2, id <span style="color: #080;">=</span> <span style="color: #ff0000;">'year'</span><span style="color: #080;">&#41;</span>
&nbsp;
ggplot<span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">data</span><span style="color: #080;">=</span>meltframe, aes<span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>year, y<span style="color: #080;">=</span>value, colour<span style="color: #080;">=</span>variable<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     scale_x_continuous<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     ylab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Spend&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     xlab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Year&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     theme_bw<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     geom_line<span style="color: #080;">&#40;</span>size<span style="color: #080;">=</span><span style="color: #ff0000;">1.4</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     opts<span style="color: #080;">&#40;</span>legend.<span style="">position</span><span style="color: #080;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>,
          legend.<span style="">direction</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">'horizontal'</span>,
          plot.<span style="">background</span> <span style="color: #080;">=</span> theme_rect<span style="color: #080;">&#40;</span>colour <span style="color: #080;">=</span> <span style="color: #ff0000;">'black'</span>, fill <span style="color: #080;">=</span> <span style="color: #ff0000;">'#CCCCEE'</span>, size <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span>, linetype<span style="color: #080;">=</span><span style="color: #ff0000;">'solid'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
     scale_colour_manual<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Annual spending, retirement age 65, 60/40 portfolio, spending factor 1, 1928 cohort&quot;</span>, breaks <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'spend'</span>, <span style="color: #ff0000;">'survival65'</span><span style="color: #080;">&#41;</span>,
                         values <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;#CC0000&quot;</span>, <span style="color: #ff0000;">&quot;#000099&quot;</span><span style="color: #080;">&#41;</span>,
                        <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/labels.html"><span style="color: #0000FF; font-weight: bold;">labels</span></a> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'Annual Spend'</span>, <span style="color: #ff0000;">'Survivors from starting 10,000'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #228B22;">#Figure 2</span>
trials <span style="color: #080;">=</span> testspendingfactor<span style="color: #080;">&#40;</span>realreturns, <span style="color: #ff0000;">1</span>, <span style="color: #ff0000;">65</span>, <span style="color: #ff0000;">100</span><span style="color: #080;">&#41;</span>
trialssummary <span style="color: #080;">=</span> calctrialssummary<span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span>
trialssummary$survival <span style="color: #080;">=</span> ageframe65$survivepct<span style="color: #080;">*</span><span style="color: #ff0000;">10000</span>
keep <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;year&quot;</span>, <span style="color: #ff0000;">&quot;mean&quot;</span>,<span style="color: #ff0000;">&quot;min&quot;</span>,<span style="color: #ff0000;">&quot;max&quot;</span>,<span style="color: #ff0000;">&quot;minus1sd&quot;</span>,<span style="color: #ff0000;">&quot;plus1sd&quot;</span><span style="color: #080;">&#41;</span>
trialssummary <span style="color: #080;">&lt;-</span> trialssummary<span style="color: #080;">&#91;</span>,keep<span style="color: #080;">&#93;</span>
chartsummary<span style="color: #080;">&#40;</span>trialssummary, <span style="color: #ff0000;">&quot;Average Spending, All Cohorts&quot;</span><span style="color: #080;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #228B22;"># Figure 3</span>
facetframe <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/data.frame.html"><span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span></a> <span style="color: #080;">&#40;</span>year <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/integer.html"><span style="color: #0000FF; font-weight: bold;">integer</span></a><span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span>, variable<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/character.html"><span style="color: #0000FF; font-weight: bold;">character</span></a><span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span>, value<span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/double.html"><span style="color: #0000FF; font-weight: bold;">double</span></a><span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span><span style="color: #ff0000;">24</span><span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
    spendingfactor <span style="color: #080;">=</span> index<span style="color: #080;">/</span><span style="color: #ff0000;">20</span>
    trials <span style="color: #080;">=</span> testspendingfactor<span style="color: #080;">&#40;</span>realreturns, spendingfactor, <span style="color: #ff0000;">65</span>, <span style="color: #ff0000;">100</span><span style="color: #080;">&#41;</span>
    trialssummary <span style="color: #080;">=</span> calctrialssummary<span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span>
    trialssummary$spendingfactor <span style="color: #080;">=</span> spendingfactor
    meltframe <span style="color: #080;">&lt;-</span> melt<span style="color: #080;">&#40;</span>trialssummary, id <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'year'</span>,<span style="color: #ff0000;">'spendingfactor'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    facetframe <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/merge.html"><span style="color: #0000FF; font-weight: bold;">merge</span></a><span style="color: #080;">&#40;</span>meltframe, facetframe, <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/all.html"><span style="color: #0000FF; font-weight: bold;">all</span></a><span style="color: #080;">=</span>TRUE<span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
ggplot<span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">data</span><span style="color: #080;">=</span>facetframe, aes<span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>year, y<span style="color: #080;">=</span>value, colour<span style="color: #080;">=</span>variable<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    scale_x_continuous<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    ylab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Annual spending (% of initial portfolio)&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    xlab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Retirement year&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    theme_bw<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    facet_wrap<span style="color: #080;">&#40;</span>~ spendingfactor, <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/ncol.html"><span style="color: #0000FF; font-weight: bold;">ncol</span></a> <span style="color: #080;">=</span> <span style="color: #ff0000;">4</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    geom_line<span style="color: #080;">&#40;</span>size<span style="color: #080;">=</span><span style="color: #ff0000;">1</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    opts<span style="color: #080;">&#40;</span>legend.<span style="">position</span><span style="color: #080;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>,
         legend.<span style="">direction</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">'horizontal'</span>,
         plot.<span style="">background</span> <span style="color: #080;">=</span> theme_rect<span style="color: #080;">&#40;</span>colour <span style="color: #080;">=</span> <span style="color: #ff0000;">'black'</span>, fill <span style="color: #080;">=</span> <span style="color: #ff0000;">'#CCCCEE'</span>, size <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span>, linetype<span style="color: #080;">=</span><span style="color: #ff0000;">'solid'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
scale_colour_manual<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Average Spending, All Cohorts, Spending Factors 0.05 to 1.2&quot;</span>, breaks <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'mean'</span>, <span style="color: #ff0000;">'min'</span>,<span style="color: #ff0000;">'max'</span>,<span style="color: #ff0000;">'minus1sd'</span>,<span style="color: #ff0000;">'plus1sd'</span><span style="color: #080;">&#41;</span>,
                    values <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;#000099&quot;</span>, <span style="color: #ff0000;">&quot;#CC0000&quot;</span>,<span style="color: #ff0000;">&quot;#009900&quot;</span>,<span style="color: #ff0000;">&quot;#999999&quot;</span>,<span style="color: #ff0000;">&quot;#999999&quot;</span><span style="color: #080;">&#41;</span>,
                    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/labels.html"><span style="color: #0000FF; font-weight: bold;">labels</span></a> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'Average Spend'</span>, <span style="color: #ff0000;">'Minimum'</span>, <span style="color: #ff0000;">'Maximum'</span>, <span style="color: #ff0000;">'-1 SD'</span>, <span style="color: #ff0000;">'+1SD'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
<span style="color: #228B22;">############################################################</span>
&nbsp;
&nbsp;
ageframe65 <span style="color: #080;">=</span> ageframe<span style="color: #080;">&#40;</span>lifetable,<span style="color: #ff0000;">65</span>,<span style="color: #ff0000;">100</span><span style="color: #080;">&#41;</span>
nsfactors <span style="color: #080;">=</span> <span style="color: #ff0000;">40</span>
sfactorsummary <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/data.frame.html"><span style="color: #0000FF; font-weight: bold;">data.<span style="">frame</span></span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">1</span><span style="color: #080;">:</span>nsfactors<span style="color: #080;">&#41;</span>
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/colnames.html"><span style="color: #0000FF; font-weight: bold;">colnames</span></a><span style="color: #080;">&#40;</span>sfactorsummary<span style="color: #080;">&#41;</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;year&quot;</span>
sfactorsummary$sfactor <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
sfactorsummary$expspend <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
sfactorsummary$minspend <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
sfactorsummary$maxspend <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
sfactorsummary$plus1sd <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
sfactorsummary$minus1sd <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
sfactorsummary$sdspend <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
sfactorsummary$shortfall <span style="color: #080;">&lt;-</span> <span style="color: #ff0000;">0</span>
&nbsp;
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span>nsfactors<span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
    spendingfactor <span style="color: #080;">=</span> index<span style="color: #080;">/</span><span style="color: #ff0000;">20</span>
    trials <span style="color: #080;">=</span> testspendingfactor<span style="color: #080;">&#40;</span>realreturns, spendingfactor, <span style="color: #ff0000;">65</span>, <span style="color: #ff0000;">100</span><span style="color: #080;">&#41;</span>
    trialssummary <span style="color: #080;">=</span> calcexpectedspending<span style="color: #080;">&#40;</span>trials, ageframe65<span style="color: #080;">&#41;</span>
&nbsp;
    sfactorsummary$sfactor<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span> <span style="color: #080;">=</span> spendingfactor
    sfactorsummary$expspend<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/sum.html"><span style="color: #0000FF; font-weight: bold;">sum</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#91;</span>,<span style="color: #ff0000;">&quot;expmean&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
    sfactorsummary$minspend<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/sum.html"><span style="color: #0000FF; font-weight: bold;">sum</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#91;</span>,<span style="color: #ff0000;">&quot;expmin&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
    sfactorsummary$maxspend<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/sum.html"><span style="color: #0000FF; font-weight: bold;">sum</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#91;</span>,<span style="color: #ff0000;">&quot;expmax&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
    sfactorsummary$plus1sd<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/sum.html"><span style="color: #0000FF; font-weight: bold;">sum</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#91;</span>,<span style="color: #ff0000;">&quot;expplus1sd&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
    sfactorsummary$minus1sd<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/sum.html"><span style="color: #0000FF; font-weight: bold;">sum</span></a><span style="color: #080;">&#40;</span>trialssummary<span style="color: #080;">&#91;</span>,<span style="color: #ff0000;">&quot;expminus1sd&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
    sfactorsummary$sdspend<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span><span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/rowMeans.html"><span style="color: #0000FF; font-weight: bold;">rowMeans</span></a><span style="color: #080;">&#40;</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials, <span style="color: #ff0000;">2</span>, <span style="color: #0000FF; font-weight: bold;">sd</span><span style="color: #080;">&#41;</span><span style="color: #080;">/</span>trials<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span>,<span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
&nbsp;
    trialstmp<span style="color: #080;">=</span>trials
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index2 <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/ncol.html"><span style="color: #0000FF; font-weight: bold;">ncol</span></a><span style="color: #080;">&#40;</span>trialstmp<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
        trialstmp<span style="color: #080;">&#91;</span>index2<span style="color: #080;">&#93;</span><span style="color: #080;">=</span>trialstmp<span style="color: #080;">&#91;</span>index2<span style="color: #080;">&#93;</span><span style="color: #080;">/</span>trialstmp<span style="color: #080;">&#91;</span><span style="color: #ff0000;">1</span>,index2<span style="color: #080;">&#93;</span>
    trialstmp<span style="color: #080;">&#91;</span>trialstmp<span style="color: #080;">&lt;</span><span style="color: #ff0000;">0.75</span><span style="color: #080;">&#93;</span><span style="color: #080;">=-</span><span style="color: #ff0000;">1</span>
    trialstmp<span style="color: #080;">&#91;</span>trialstmp<span style="color: #080;">&gt;</span><span style="color: #ff0000;">0</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
    trialstmp<span style="color: #080;">&#91;</span>trialstmp<span style="color: #080;">&lt;</span><span style="color: #ff0000;">0</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span><span style="color: #ff0000;">1</span>
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/for.html"><span style="color: #0000FF; font-weight: bold;">for</span></a> <span style="color: #080;">&#40;</span>index2 <span style="color: #0000FF; font-weight: bold;">in</span> <span style="color: #ff0000;">1</span><span style="color: #080;">:</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/ncol.html"><span style="color: #0000FF; font-weight: bold;">ncol</span></a><span style="color: #080;">&#40;</span>trialstmp<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
        trialstmp<span style="color: #080;">&#91;</span>index2<span style="color: #080;">&#93;</span><span style="color: #080;">=</span>trialstmp<span style="color: #080;">&#91;</span>index2<span style="color: #080;">&#93;</span> <span style="color: #080;">*</span> ageframe65$survivepct
    sfactorsummary$shortfall<span style="color: #080;">&#91;</span>index<span style="color: #080;">&#93;</span><span style="color: #080;">=</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/mean.html"><span style="color: #0000FF; font-weight: bold;">mean</span></a><span style="color: #080;">&#40;</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trialstmp,<span style="color: #ff0000;">2</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/max.html"><span style="color: #0000FF; font-weight: bold;">max</span></a><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
&nbsp;
&nbsp;
chart1<span style="color: #080;">=</span>sfactorsummary
keep <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;sfactor&quot;</span>,<span style="color: #ff0000;">&quot;expspend&quot;</span>,<span style="color: #ff0000;">&quot;minspend&quot;</span>,<span style="color: #ff0000;">&quot;maxspend&quot;</span>,<span style="color: #ff0000;">&quot;plus1sd&quot;</span>,<span style="color: #ff0000;">&quot;minus1sd&quot;</span><span style="color: #080;">&#41;</span>
chart1 <span style="color: #080;">&lt;-</span> chart1<span style="color: #080;">&#91;</span>keep<span style="color: #080;">&#93;</span>
&nbsp;
meltframe <span style="color: #080;">&lt;-</span> melt<span style="color: #080;">&#40;</span>chart1, id <span style="color: #080;">=</span> <span style="color: #ff0000;">'sfactor'</span><span style="color: #080;">&#41;</span>
&nbsp;
ggplot<span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">data</span><span style="color: #080;">=</span>meltframe, aes<span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>sfactor, y<span style="color: #080;">=</span>value, colour<span style="color: #080;">=</span>variable<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    scale_x_continuous<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    ylab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Lifetime spend expectancy (% of initial portfolio)&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    xlab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Spending factor&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    theme_bw<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    geom_line<span style="color: #080;">&#40;</span>size<span style="color: #080;">=</span><span style="color: #ff0000;">1.4</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    opts<span style="color: #080;">&#40;</span>legend.<span style="">position</span><span style="color: #080;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>,
         legend.<span style="">direction</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">'horizontal'</span>,
         plot.<span style="">background</span> <span style="color: #080;">=</span> theme_rect<span style="color: #080;">&#40;</span>colour <span style="color: #080;">=</span> <span style="color: #ff0000;">'black'</span>, fill <span style="color: #080;">=</span> <span style="color: #ff0000;">'#CCCCEE'</span>, size <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span>, linetype<span style="color: #080;">=</span><span style="color: #ff0000;">'solid'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
scale_colour_manual<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Lifetime Spend Expectancy v. Spending Factor&quot;</span>, breaks <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'expspend'</span>, <span style="color: #ff0000;">'minspend'</span>,<span style="color: #ff0000;">'maxspend'</span>,<span style="color: #ff0000;">'plus1sd'</span>,<span style="color: #ff0000;">'minus1sd'</span><span style="color: #080;">&#41;</span>,
                    values <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;#000099&quot;</span>, <span style="color: #ff0000;">&quot;#CC0000&quot;</span>, <span style="color: #ff0000;">&quot;#009900&quot;</span>,<span style="color: #ff0000;">&quot;#999999&quot;</span>,<span style="color: #ff0000;">&quot;#999999&quot;</span><span style="color: #080;">&#41;</span>,
                    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/labels.html"><span style="color: #0000FF; font-weight: bold;">labels</span></a> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'Mean'</span>, <span style="color: #ff0000;">'Worst investment outcome'</span>, <span style="color: #ff0000;">'Best investment outcome'</span>,<span style="color: #ff0000;">'+1SD'</span>,<span style="color: #ff0000;">'-1SD'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
chart2<span style="color: #080;">=</span>sfactorsummary
keep <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;sfactor&quot;</span>,<span style="color: #ff0000;">&quot;shortfall&quot;</span><span style="color: #080;">&#41;</span>
chart2 <span style="color: #080;">&lt;-</span> chart2<span style="color: #080;">&#91;</span>keep<span style="color: #080;">&#93;</span>
meltframe <span style="color: #080;">&lt;-</span> melt<span style="color: #080;">&#40;</span>chart2, id <span style="color: #080;">=</span> <span style="color: #ff0000;">'sfactor'</span><span style="color: #080;">&#41;</span>
&nbsp;
ggplot<span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">data</span><span style="color: #080;">=</span>meltframe, aes<span style="color: #080;">&#40;</span>x<span style="color: #080;">=</span>sfactor, y<span style="color: #080;">=</span>value, colour<span style="color: #080;">=</span>variable<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    scale_x_continuous<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    ylab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Shortfall probability&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    xlab<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Spending factor&quot;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    theme_bw<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    geom_line<span style="color: #080;">&#40;</span>size<span style="color: #080;">=</span><span style="color: #ff0000;">1.4</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
    opts<span style="color: #080;">&#40;</span>legend.<span style="">position</span><span style="color: #080;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>,
         legend.<span style="">direction</span> <span style="color: #080;">=</span> <span style="color: #ff0000;">'horizontal'</span>,
         plot.<span style="">background</span> <span style="color: #080;">=</span> theme_rect<span style="color: #080;">&#40;</span>colour <span style="color: #080;">=</span> <span style="color: #ff0000;">'black'</span>, fill <span style="color: #080;">=</span> <span style="color: #ff0000;">'#CCCCEE'</span>, size <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span>, linetype<span style="color: #080;">=</span><span style="color: #ff0000;">'solid'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span> <span style="color: #080;">+</span>
scale_colour_manual<span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;Probability of 25% Spending Shortfall v. Spending Factor&quot;</span>, breaks <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'shortfall'</span><span style="color: #080;">&#41;</span>,
                    values <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;#000099&quot;</span><span style="color: #080;">&#41;</span>,
                    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/labels.html"><span style="color: #0000FF; font-weight: bold;">labels</span></a> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">'Shortfall probability'</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #228B22;"># fixed 4% rule</span>
trials <span style="color: #080;">=</span> testspendingfactorfixed<span style="color: #080;">&#40;</span>realreturns, <span style="color: #ff0000;">1</span>, <span style="color: #ff0000;">65</span>, <span style="color: #ff0000;">100</span><span style="color: #080;">&#41;</span>
trialssummary <span style="color: #080;">=</span> calctrialssummary<span style="color: #080;">&#40;</span>trials<span style="color: #080;">&#41;</span>
ageframe65 <span style="color: #080;">=</span> ageframe<span style="color: #080;">&#40;</span>lifetable,<span style="color: #ff0000;">65</span>,<span style="color: #ff0000;">100</span><span style="color: #080;">&#41;</span>
trialssummary$survivepct<span style="color: #080;">=</span>ageframe65$survivepct
trialssummary$expmean <span style="color: #080;">=</span> trialssummary$mean <span style="color: #080;">*</span> trialssummary$survivepct
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/sum.html"><span style="color: #0000FF; font-weight: bold;">sum</span></a><span style="color: #080;">&#40;</span>trialssummary$expmean<span style="color: #080;">&#41;</span>
&nbsp;
trials<span style="color: #080;">&#91;</span>trials<span style="color: #080;">&lt;</span><span style="color: #ff0000;">4</span><span style="color: #080;">&#93;</span><span style="color: #080;">=-</span><span style="color: #ff0000;">1</span>
trials<span style="color: #080;">&#91;</span>trials<span style="color: #080;">&gt;</span><span style="color: #ff0000;">0</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span><span style="color: #ff0000;">0</span>
trials<span style="color: #080;">&#91;</span>trials<span style="color: #080;">&lt;</span><span style="color: #ff0000;">0</span><span style="color: #080;">&#93;</span><span style="color: #080;">=</span><span style="color: #ff0000;">1</span>
trials<span style="color: #080;">&#91;</span>,<span style="color: #080;">&#93;</span><span style="color: #080;">=</span>trials<span style="color: #080;">&#91;</span>,<span style="color: #080;">&#93;</span> <span style="color: #080;">*</span> ageframe65$survivepct
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/mean.html"><span style="color: #0000FF; font-weight: bold;">mean</span></a><span style="color: #080;">&#40;</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/apply.html"><span style="color: #0000FF; font-weight: bold;">apply</span></a><span style="color: #080;">&#40;</span>trials,<span style="color: #ff0000;">2</span>,<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/max.html"><span style="color: #0000FF; font-weight: bold;">max</span></a><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
&nbsp;
<span style="color: #228B22;"># 0.5 spending factor -&gt; look up from sfactorsummary</span></pre></td></tr></table></div>

<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2013/01/cat-food-revisited-testing-dynamic-spending-rules/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What’s the worst that could happen?</title>
		<link>http://blog.streeteye.com/blog/2013/01/whats-the-worst-that-could-happen/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=whats-the-worst-that-could-happen</link>
		<comments>http://blog.streeteye.com/blog/2013/01/whats-the-worst-that-could-happen/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 04:45:29 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1478</guid>
		<description><![CDATA[It&#8217;s not whether you get knocked down, it&#8217;s whether you get up. &#8211; Vince Lombardi Playing around with DataNitro, an add-in that lets you run Python in Excel1. What is the worst that could happen to someone who owns stocks, bonds, bills, over a 1-, 5-, 10-year time-frame? Here are the worst rolling periods for [...]]]></description>
				<content:encoded><![CDATA[<p><em>It&#8217;s not whether you get knocked down, it&#8217;s whether you get up. &#8211; Vince Lombardi</em></p>
<p>Playing around with <a title="DataNitro" href="https://datanitro.com/">DataNitro</a>, an add-in that lets you run Python in Excel<sup>1</sup>.</p>
<p>What is the worst that could happen to someone who owns stocks, bonds, bills, over a 1-, 5-, 10-year time-frame? Here are the <span style="text-decoration: underline;">worst</span> rolling periods for each asset class for 1928-2010, adjusted for inflation.</p>
<table class="aligncenter" cellspacing="10">
<tbody>
<tr>
<td></td>
<td style="text-align: right;"><strong>Stocks</strong></td>
<td></td>
<td style="text-align: right;"><strong>Bonds</strong></td>
<td></td>
<td style="text-align: right;"><strong>Bills</strong></td>
<td></td>
</tr>
<tr>
<td style="text-align: left;">1-year</td>
<td style="text-align: right;">-38.2%</td>
<td style="text-align: left;"><small><em>1937, 1974</em></small></td>
<td style="text-align: right;">-15.5%</td>
<td style="text-align: left;"><small><em>1980</em></small></td>
<td style="text-align: right;">-17.8%</td>
<td style="text-align: left;"><small><em>1946</em></small></td>
</tr>
<tr>
<td style="text-align: left;">2-year</td>
<td style="text-align: right;">-52.5%</td>
<td><small><em>1972-1974</em></small></td>
<td style="text-align: right;">-26.2%</td>
<td><small><em>1978-1980</em></small></td>
<td style="text-align: right;">-24.6%</td>
<td><small><em>1945-1947</em></small></td>
</tr>
<tr>
<td style="text-align: left;">5-year</td>
<td style="text-align: right;">-44.7%</td>
<td><small><em>1936-1941</em></small></td>
<td style="text-align: right;">-37.5%</td>
<td><small><em>1976-1981</em></small></td>
<td style="text-align: right;">-27.3%</td>
<td><small><em>1945-1950</em></small></td>
</tr>
<tr>
<td style="text-align: left;">10-year</td>
<td style="text-align: right;">-37.5%</td>
<td><small><em>1964-1974</em></small></td>
<td style="text-align: right;">-43.2%</td>
<td><small><em>1971-1981</em></small></td>
<td style="text-align: right;">-43.9%</td>
<td><small><em>1940-1950</em></small></td>
</tr>
<tr>
<td style="text-align: left;">20-year</td>
<td style="text-align: right;">10.7%</td>
<td><small><em>1961-1981</em></small></td>
<td style="text-align: right;">-40.8%</td>
<td><small><em>1961-1981</em></small></td>
<td style="text-align: right;">-48.9%</td>
<td><small><em>1932-1952</em></small></td>
</tr>
<tr>
<td style="text-align: left;">30-year</td>
<td style="text-align: right;">243.5%</td>
<td><small><em>1964-1994</em></small></td>
<td style="text-align: right;">-39.3%</td>
<td><small><em>1950-1980</em></small></td>
<td style="text-align: right;">-43.4%</td>
<td><small><em>1932-1962</em></small></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><em>Worst case real returns for rolling periods from 1 to 30 years, 1928-2010</em></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/worstcase.png"><img class="size-full wp-image-1494 alignnone" title="Worst rolling returns" src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/worstcase.png" alt="Worst rolling returns" width="475" height="281" /></a></p>
<p>Over short timeframes, stocks can do quite a bit worse. The worst 2-year period is -52.5% for stocks, v. -26% for bonds and -25% for bills. Around year 8, stocks cross over. The worst 20-year period for stocks sees you up 10.7%, and the <span style="text-decoration: underline;">worst</span> 30-year period sees you <span style="text-decoration: underline;">up</span> 243%! When bonds and bills get hurt by inflation, they stay down for very long periods.</p>
<p>Rerunning the analysis for the post-war era doesn&#8217;t change much. Most of the worst-case periods for stocks and bonds were after 1946, but bills did worst around the war and better afterwards.</p>
<p><em>Worst case real returns for rolling periods from 1 to 30 years, 1946-2010</em></p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/worstcase46.png"><img src="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/worstcase46.png" alt="Worst Case real returns, 1946-2010" title="Worst Case real returns, 1946-2010" width="475" height="282" class="alignnone size-full wp-image-1530" /></a></p>
<p><a title="Rolling returns spreadsheet" href="http://blog.streeteye.com/blog/wp-content/uploads/2013/01/rolling.xlsx">Spreadsheet here</a>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1478code4'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14784"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</pre></td><td class="code" id="p1478code4"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> numpy <span style="color: #ff7700;font-weight:bold;">as</span> np <span style="color: #808080; font-style: italic;"># not used in this example, but works!</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> rolling_return<span style="color: black;">&#40;</span>series, n<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;given a series of m returns, compute m-n rolling n-period returns&quot;</span>
    m = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>series<span style="color: black;">&#41;</span>
    retarray = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>m-n<span style="color: black;">&#41;</span>:
        rr = <span style="color: #ff4500;">1.0</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> j <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>n<span style="color: black;">&#41;</span>:
            rr = rr <span style="color: #66cc66;">*</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>+ series<span style="color: black;">&#91;</span>i+j<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        retarray.<span style="color: black;">append</span><span style="color: black;">&#40;</span>rr-<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> retarray
&nbsp;
active_sheet<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Returns&quot;</span><span style="color: black;">&#41;</span>
stocks = CellRange<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Equities&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span>
bonds = CellRange<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Bonds&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span>
bills = CellRange<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Bills&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span>
cpi = CellRange<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;CPI&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span>
&nbsp;
realbonds = <span style="color: black;">&#91;</span>bonds<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>-cpi<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>cpi<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
realbills = <span style="color: black;">&#91;</span>bills<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>-cpi<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>cpi<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
realstocks = <span style="color: black;">&#91;</span>stocks<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>-cpi<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>cpi<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
&nbsp;
active_sheet<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Data_1928&quot;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">31</span><span style="color: black;">&#41;</span>:
    tempbonds = rolling_return<span style="color: black;">&#40;</span>realbonds,i<span style="color: black;">&#41;</span>
    tempbills = rolling_return<span style="color: black;">&#40;</span>realbills,i<span style="color: black;">&#41;</span>
    tempstocks = rolling_return<span style="color: black;">&#40;</span>realstocks,i<span style="color: black;">&#41;</span>
    Cell<span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span> = <span style="color: #008000;">min</span><span style="color: black;">&#40;</span>tempstocks<span style="color: black;">&#41;</span>
    Cell<span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span> = <span style="color: #008000;">min</span><span style="color: black;">&#40;</span>tempbonds<span style="color: black;">&#41;</span>
    Cell<span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span> = <span style="color: #008000;">min</span><span style="color: black;">&#40;</span>tempbills<span style="color: black;">&#41;</span>
&nbsp;
active_sheet<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Data_1946&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
realbonds46=realbonds<span style="color: black;">&#91;</span><span style="color: #ff4500;">18</span>:<span style="color: black;">&#93;</span>
realbills46=realbills<span style="color: black;">&#91;</span><span style="color: #ff4500;">18</span>:<span style="color: black;">&#93;</span>
realstocks46=realstocks<span style="color: black;">&#91;</span><span style="color: #ff4500;">18</span>:<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">31</span><span style="color: black;">&#41;</span>:
    tempbonds = rolling_return<span style="color: black;">&#40;</span>realbonds46,i<span style="color: black;">&#41;</span>
    tempbills = rolling_return<span style="color: black;">&#40;</span>realbills46,i<span style="color: black;">&#41;</span>
    tempstocks = rolling_return<span style="color: black;">&#40;</span>realstocks46,i<span style="color: black;">&#41;</span>
    Cell<span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span> = <span style="color: #008000;">min</span><span style="color: black;">&#40;</span>tempstocks<span style="color: black;">&#41;</span>
    Cell<span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span> = <span style="color: #008000;">min</span><span style="color: black;">&#40;</span>tempbonds<span style="color: black;">&#41;</span>
    Cell<span style="color: black;">&#40;</span>i+<span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>.<span style="color: black;">value</span> = <span style="color: #008000;">min</span><span style="color: black;">&#40;</span>tempbills<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p><small><sup>1</sup>Why is Python a good thing? Lots of very powerful packages for data manipulation, optimization, statistical analysis, machine learning are available in Python. Also, Python is a powerful, expressive, readable language that makes it easy to manipulate complex data structures.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2013/01/whats-the-worst-that-could-happen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>‘Big Data’</title>
		<link>http://blog.streeteye.com/blog/2013/01/big-data/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=big-data</link>
		<comments>http://blog.streeteye.com/blog/2013/01/big-data/#comments</comments>
		<pubDate>Sat, 05 Jan 2013 12:24:47 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1353</guid>
		<description><![CDATA[If &#8216;The Graduate&#8217; were made today, Benjamin Braddock might hear a well-meaning uncle stage-whisper &#8216;Big Data&#8217; instead of &#8216;Plastics.&#8217; (Runners-up: &#8216;The Cloud&#8217;, &#8216;Social Discovery&#8217;, &#8216;Gamification&#8217;, the list goes on.) &#8216;Big data&#8217; is a buzzword that people throw around a lot. What does it mean? Large data sets are not new. The IRS, the Census, Walmart, [...]]]></description>
				<content:encoded><![CDATA[<p>If &#8216;The Graduate&#8217; were made today, Benjamin Braddock might hear a well-meaning uncle stage-whisper &#8216;Big Data&#8217; instead of &#8216;Plastics.&#8217; (Runners-up: &#8216;The Cloud&#8217;, &#8216;Social Discovery&#8217;, &#8216;Gamification&#8217;, the <a href="http://www.languagemonitor.com/high-tech-buzzwords/top-tech-buzzwords-everyone-uses-but-dont-quite-understand-2012/">list goes on</a>.) &#8216;Big data&#8217; is a buzzword that people throw around a lot. What does it mean? Large data sets are not new. The IRS, the Census, Walmart, money center banks have always had big data sets.</p>
<p>What&#8217;s changed?<br />
<span id="more-1353"></span><br />
Look at Google. You type &#8216;Justin,&#8217; and within milliseconds it offers &#8216;Bieber&#8217; as a completion. You hit enter, and it fires off a query to a bunch of computers (guessing low hundreds) that each have part of the Google index in RAM. They return answers, and the results are ranked. Then the page ids are fired off to a different set of computers that has the entire text of the relevant Web pages in RAM, and the relevant excerpts are retrieved. Finally, a Search Engine Results Page (SERP) gets built, with personalized ads etc. <a href="http://www.googleguide.com/google_works.html">All this happens in milliseconds</a>.</p>
<p>This was a revolutionary approach to working with large datasets. What&#8217;s changed is not just that there are more large datasets, but also, the tools Google pioneered have gone mainstream, and new computing stacks let you apply powerful algorithms in real time.</p>
<p>Near the bottom of the stack is the database. Oracle databases can handle any amount of data. Could Google have been built on top of Oracle? Probably. Should they have? No. First, Oracle&#8217;s business model isn&#8217;t designed for it, licensing for millions of servers would cost a fortune! Second, Oracle is poorly adapted to the problem. It can do complex queries across massive disks pretty efficiently. But if you want to split data across hundreds of servers and keep it in memory, you have to give up much of the functionality Oracle provides, and it would still have complexity and features that would take up resources, driving up the cost and degrading performance.</p>
<p>A traditional SQL database is built on <a href="http://en.wikipedia.org/wiki/ACID">ACID</a> principles: (Atomicity, Consistency, Isolation, Durability), that make databases reliable for banks and accounting systems. A transaction either works or it doesn&#8217;t. It can&#8217;t be half-completed, where money is debited from one account and not credited to another. Database activity can be viewed as a single series of transactions and queries &#8211; any query will see the database in a consistent state in the chain. Each transaction is isolated from every other, even if they happen concurrently, they don&#8217;t affect each other, as if they happened sequentially. And once a transaction is committed, it stays committed, regardless of power loss, network failure, etc.</p>
<p>ACID imposes a cost in complexity and performance. There&#8217;s a computer science result called <a href="http://www.julianbrowne.com/article/viewer/brewers-cap-theorem">Brewer&#8217;s CAP theorem</a> (<a href="http://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed">longer version, by Brewer</a>). Pick any two: <em>Consistency</em>, knowing a single up-to-date state of the data; high <em>Availability </em>for writes; and <em>Partition </em>tolerance, no impact from network failure. The CAP theorem means that when you have a distributed system that communicates over a network, you have to make tradeoffs.  If you have a master database and a few slaves mirroring the master for reporting, web queries, there will always be an instant where the master has been updated and the slaves are still out of date. There is no perfect disaster recovery (DR) system, where two systems are 100% in sync and if one fails, you can immediately fail over to the other with a guarantee of no data loss. There is always that instant where if the network fails, things are not 100% in sync. ACID and distributed systems don&#8217;t mix perfectly.</p>
<p>But Google doesn&#8217;t need ACID. Nobody cares much if two similar queries at the same time yield slightly different Google results, or Facebook walls. They do care if they don&#8217;t get it back in milliseconds.</p>
<p>And networks have grown incredibly fast, large and reliable. Meanwhile, CPUs are still getting cheaper, but individual CPU cores are not gaining performance as quickly, and speeding them up is less energy-efficient than buying more low-power CPUs. So companies like Google, Facebook, etc., use a different set of non-ACID tools in big server farms that let lots of cheap servers connected over fast networks work together.</p>
<p>Wags sometimes refer to the new databases, in contrast to ACID, as &#8216;BASE&#8217;: <em>Basic Availability, Soft state, Eventually consistent</em>. &#8216;NoSQL&#8217; is more commonly used. Different NoSQL database systems are optimized for different use cases: key-value stores, document databases, graph databases. There has been an explosion of new database systems &#8211; the growing <a href="http://gigaom.com/cloud/confused-by-the-glut-of-new-databases-heres-a-map-for-you/">blue area in this chart</a>.</p>
<p>What does the Big Data stack look like?</p>
<ul>
<li>Clusters of virtual machines on <a href="http://aws.amazon.com/">Amazon Web Services</a>, <a href="http://www.heroku.com/">Heroku</a>, Rackspace, etc.: PaaS (platform as a service)</li>
<li>NoSQL databases for non-ACID applications: MongoDB, Cassandra, CouchDB, Redis, Riak (a <a href="http://architects.dzone.com/articles/graph-nosql-database-linkedin">popularity chart</a>, <a href="http://www.google.com/trends/explore#q=mongodb,couchdb,redis,hbase,nosql">Google Trends</a>).</li>
<li>Platforms to distribute algorithms over those clusters &#8211; <a href="http://hadoop.apache.org/">Hadoop</a>, <a href="http://research.google.com/archive/mapreduce.html">MapReduce</a>.</li>
<li>Analytical software to run complex machine learning algorithms on those platforms.</li>
</ul>
<p><em>The last bullet point is what people most commonly associate with &#8216;Big Data&#8217;.</em> Not only can Google return the most frequent completion as you type, it can update the most frequent searches in real time. More critically for the Google business model, it can predict which ad link you are most likely to click on, based on your recent activity, current location, everything it knows about your demographics and psychographics from your searches, your clicks on all the web sites in Google&#8217;s ad network, your emails in Gmail. Powerful machine learning algorithms like <a href="http://en.wikipedia.org/wiki/Support_vector_machine">support vector machines (SVM)</a> can run on clusters in a highly parallel manner to model behavior using hundreds of features and make predictions in real time.</p>
<p>If you have all the parameters to make a decision, given enough data and training, machine learning will generally find a good model and make useful predictions. Nevertheless, ad networks still present Christian singles ads to old married non-Christians. If you don&#8217;t collect the right parameters and feed them in the right form, you get garbage in, garbage out. If the data you have isn&#8217;t predictive, or you have the wrong model, <a href="http://www.linkedin.com/today/post/article/20130103045241-25760-are-we-all-being-fooled-by-big-data">having a lot of data isn&#8217;t going to help you</a><a href="#1"><sup>1</sup></a>.</p>
<p>Bottom line: A new computing stack, pioneered 15 years ago by Google, has gone mainstream. It consists of ultra-cheap small computers connected by fast networks, plus distributed algorithms, for new applications that run at web scale and don&#8217;t have strong consistency requirements, and can make sophisticated predictions and decisions in real-time.</p>
<p>People call it &#8216;Big Data&#8217;, but what&#8217;s new and big is the computing power that can be directed at data in real-time. The distinguishing feature of this paradigm is dealing with more data than can fit in a computer&#8217;s memory by splitting up the task over many computers working in parallel in real-time, instead of doing them sequentially on a disk in batch mode.</p>
<p>In that sense, a traditional SQL data warehouse with petabytes of transaction data, batch processing business intelligence for online analytic processing and data mining, is not in the new Big Data paradigm, in the same sense as a real-time machine learning ad-serving engine that may have a smaller database.</p>
<p>It&#8217;s not the data that got big, it&#8217;s the computers that got small, fast, very numerous, and very very clever.</p>
<p><iframe src="http://www.youtube.com/embed/PSxihhBzCjk" frameborder="0" width="560" height="315"></iframe><br />
&#8220;One word: Cat pictures. Wait, that&#8217;s two words.&#8221;</p>
<p><a name="1"></a><sup>1</sup><small> It&#8217;s undeniable that bad models were a signficant cause of the financial crisis. But it&#8217;s an error to say that <a href="http://blog.streeteye.com/blog/2011/07/fannie-freddie-and-the-financial-crisis/">the financial crisis</a> was caused by big data gone awry. First of all, the bad models just so happened to be <a href="http://mathbabe.org/2012/12/20/nate-silver-confuses-cause-and-effect-ends-up-defending-corruption/">the ones that made the bankers the most money in the short run</a>. It wasn&#8217;t so much bad big data as it was misaligned incentives, agent-principal problems, in some cases outright looting. Second, to my knowledge, there was exactly one firm that had a big data system that gave an integrated real-time picture of firm risks: Goldman Sachs, which averted life-threatening losses (although they were at risk if AIG or the whole system went down). Goldman&#8217;s system priced every instrument, however exotic, in real-time using the same curves, forward rates, volatilities, and correlation matrices, and allowed them to compute risk and test shocks against the whole firm. They were the only ones who said, we&#8217;re losing money every day on this when our model says we shouldn&#8217;t, let&#8217;s take a close look at this&#8230; and then cut losses and go short. Unlike Goldman Sachs, which grew organically, every other firm was cobbled together with mergers, and had different groups which did their own analytics in disparate systems which someone then struggled to integrate at the top level. They lost billions because, <em>unlike Goldman, they didn&#8217;t use a big data paradigm.</em> And also because <a href="http://nymag.com/news/business/46476/index6.html">“At Goldman, &#8230;when they say get out, they get out. At [competitor], when [the president] says get out, people start negotiating.”</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2013/01/big-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I Learned</title>
		<link>http://blog.streeteye.com/blog/2012/12/what-i-learned/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=what-i-learned</link>
		<comments>http://blog.streeteye.com/blog/2012/12/what-i-learned/#comments</comments>
		<pubDate>Sun, 30 Dec 2012 22:55:50 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1299</guid>
		<description><![CDATA[I didn&#8217;t really post as much as I would have liked this year. I envy people whose thoughts come out in a more or less coherent, finished form. When I post something, I always think of what I really wanted to say after hitting &#8216;publish&#8217;. Today, I&#8217;m going to just try to write for an [...]]]></description>
				<content:encoded><![CDATA[<p>I didn&#8217;t really post as much as I would have liked this year. I envy people whose thoughts come out in a more or less coherent, finished form. When I post something, I always think of what I really wanted to say after hitting &#8216;publish&#8217;.</p>
<p>Today, I&#8217;m going to just try to write for an hour and post what comes out, hopefully resisting the temptation to ninja-edit.</p>
<p>My buddy <a href="http://www.thereformedbroker.com/">Josh</a> does a post with quotes where a bunch of people say what they learned over the last year. So what did I learn?<br />
<span id="more-1299"></span><br />
<em>Startups are hard.</em> Saw VC <a href="http://bhorowitz.com/">Ben Horowitz</a> talk a couple of times. <a href="http://www.youtube.com/watch?v=1GTbAI_2yh4">This</a> was the gist of one of his talks, I recommend it for anyone in startup land. What stuck with me was what he said about meeting Michael Jackson and mentioning how outrageous one of his moves in The Wiz was. MJ replied, it was harder than it looked, he had to do that going uphill! The point is, whenever you see someone excelling on stage, at the World Series, in Olympic gymnastics, they make it look easier than it is. When you have to do something new and worthwhile, however hard it looked before you started, you discover new layers of difficulty you didn&#8217;t know existed. Doing what your teacher showed you how to do is a linear or maybe polynomial problem. Doing something new and figuring it out as you go along is highly nonlinear, or non-polynomial. Until you figure it out, and it&#8217;s old hat and you wonder why it seemed so hard.</p>
<p>At the start of the year I launched this little mad science experiment, <a href="http://www.linkfest.com/">Linkfest.com</a>. The basic idea is that everyone goes to the &#8216;most read&#8217; page at Bloomberg, Wall Street Journal, Financial Times etc. But today, where everyone shares everything socially, and everyone is a curator, it should be possible to create a &#8216;most read&#8217; page across all financial media by finding what the best &#8216;power curators&#8217; are sharing. And ideally, ultimately create an ecosystem like <a href="http://www.reddit.com/">reddit</a>, where the best rises to the top, and the spam gets trashed, the best content creators and the best curators all get the following they deserve.</p>
<p>I learned that community filtering and crowdsourcing work pretty darn well. Linkfest.com got a pretty regular following of a couple of hundred visitors, thanks particularly to <a href="http://www.thereformedbroker.com/2012/01/11/introducing-streeteye-my-new-secret-link-weapon/">Josh</a>, <a href="http://www.avc.com/a_vc/2012/04/fun-friday-where-do-you-get-your-news.html">Fred</a>, <a href="http://blogs.cfainstitute.org/insideinvesting/">Will</a>. But it&#8217;s sitting pretty solidly in the <a href="http://www.avc.com/a_vc/2012/03/the-startup-curve.html">&#8216;trough of sorrow&#8217;</a> phase. Not totally sure if I haven&#8217;t quite got the features right&#8230;or maybe the design needs to be sharper&#8230;or maybe I just need to make it more viral and market it better. I don&#8217;t know. It&#8217;s also possible it&#8217;s overfitted to what I want, and it&#8217;s not the 10x improvement users need to alter their habits, and the real power users build their own custom news feeds with Twitter, Google Reader, Flipboard.</p>
<p>So I also learned a lot about startups, news aggregation, etc., but not nearly enough. So as a next step I&#8217;ll do a survey to find out what people want from Linkfest.com, and what could be better. Watch this space. Or, just let me know what sucks and what could be better.</p>
<p><em>From <a href="http://www.urbandictionary.com/define.php?term=mook">mook</a> to MOOC</em>. I went through the Coursera<a href="https://www.coursera.org/course/ml"> Machine Learning</a> course and learned more than I expected. The massively open online course (MOOC) education revolution <a href="http://www.nytimes.com/2012/11/04/education/edlife/massive-open-online-courses-are-multiplying-at-a-rapid-pace.html?pagewanted=all">is real</a>, education is going to be disrupted as badly as music, news, finance, the post office, etc. (There&#8217;s a Shirky law that, if it is traditionally housed in a building with a Greco-Roman pediment, it&#8217;s going to get disrupted, because it&#8217;s a fat business model dependent on a trust heuristic that the Internet will tend to invalidate)  If you haven&#8217;t already, check out some online courses and <a href="http://blog.ted.com/2012/08/21/the-20-most-watched-ted-talks-to-date/">TED</a> talks in 2013.</p>
<ul>
<li>Online education startups: <a href="https://www.coursera.org/courses">Coursera</a>, <a href="http://www.udacity.com/">Udacity</a></li>
<li>Universities and consortia: <a href="http://ocw.mit.edu/courses/find-by-department/">MIT Open Courseware</a>, <a href="https://www.edx.org/courses">Harvard/EdX</a>, <a href="http://oyc.yale.edu/courses">Yale</a>, <a href="http://online.stanford.edu/courses/">Stanford</a></li>
<li>MOOC aggregators: <a href="http://www.class-central.com/">Class Central</a>, <a href="http://www.openculture.com/freeonlinecourses">Open Culture</a></li>
</ul>
<p>Next, will take the <a href="https://class2go.stanford.edu/db/Winter2013/preview/">Stanford databases course</a>, since everything I know about databases I learned myself, badly; and <a href="http://v1.lore.com/b40.3331.damodaran/calendar/cal_item/55622">Damodaran&#8217;s valuation class</a>.</p>
<p><em>Rise of the Machines.</em> The other thing I learned is that, given decent data, with <a href="http://scikit-learn.org/stable/">tools</a> within the reach of a bright high schooler, machines can make decent decisions. We&#8217;ve reached the age of the smart machine. Any kid in high school today who grows up to be any kind of knowledge worker, is going to be primarily managing and assisting machines to do the work of <a href="http://www.nytimes.com/2012/12/04/health/quest-to-eliminate-diagnostic-lapses.html?_r=2&amp;">diagnosing</a>, solving problems, navigating, etc. Automation has hit the skilled manual worker pretty hard, but now it&#8217;s hitting the most skilled, and the consequences are going to be far-reaching. The future of jobs and wealth distribution is one aspect. We&#8217;re all going to have amazing <a href="http://www.youtube.com/watch?v=_lQSvhe2Se4">robot assistants</a>, <a href="http://www.youtube.com/watch?v=4ErEBkj_3PY">autonomous drones</a>, <a href="http://www.wired.com/autopia/2012/12/mercedes-benz-s-class-tech/?pid=2527&amp;viewall=true">self-driving cars</a>, <a href="http://www.youtube.com/watch?v=chPanW0QWhA">robot cheetahs</a>. </p>
<p>But we also have a surveillance state where everything you do is stored, and through some strange interpretation of the Fourth Amendment, there is no expectation of privacy or protection against the government <a href="http://www.wired.com/threatlevel/2012/08/administrative-subpoenas/all/">capturing all manner of information</a> (possibly including <a href="http://www.guardian.co.uk/technology/2012/sep/15/data-whistleblower-constitutional-rights">all domestic communications</a> &#8211; they won&#8217;t tell us, and possibly interpret a search as taking place only when it&#8217;s investigated, not when it&#8217;s intercepted), <a href="http://www.wired.com/threatlevel/2012/03/ff_nsadatacenter/">storing it forever</a>, as long as they get some kind of rubber stamp before using it against you.</p>
<p>And we&#8217;re literally one step away from machines that can repair, design and build themselves.</p>
<p>We learned <em>easy money cures all</em>, at least in financial markets, in the short run. It remains to be seen what it cures in the real economy. The problem is the trade and investment and financial imbalances, and financial incentives, that led up to 2008 haven&#8217;t really been rectified. The US is in better shape because it had a more aggressive fiscal policy (initially) and monetary policy, and the fact that everyone wants to own US bonds. Super hard landing in China and euro zone breakup seem off the table for now. So the most likely scenario is continuing gradual pickup in growth, until one day everyone realizes the boat is leaving the station to get cheap loans, houses, and stocks, and a real boom in growth and inflation picks up. The Fed wants a little inflation to make people less underwater on houses, and debt easier to pay back. But once the inflation genie is out of the bottle, it&#8217;s awfully hard to put back. At some point downward pressure on inflation from globalization becomes a spent force. Demographics reduce supply without a corresponding reduction in demand. Unclear whether energy and commodities will remain as benign as global demand increases and long-term sustainability of US oil boom is questionable. And once foreigners realize the Fed wants to inflate and make them lose money on their bonds, the dollar drops, and rates go up, and then the long-awaited global trade/investment/financial sector rebalance is on. Helicopter Ben is living up to his name, but <a href="http://www.youtube.com/watch?v=bPXVGQnJm0w">some day this war&#8217;s gonna end</a>.</p>
<p><em>If voting changed anything, they would make it illegal.</em> In politics, we went through a dysfunctional election full of sound and fury that doesn&#8217;t seem to have signified or resolved anything. Despite failing to get a majority of votes for Congress, Republicans are still in the majority of districts due to gerrymandering and an urban-rural cultural divide. They are in safe seats and impervious to threats from the left, but highly vulnerable to primary challenges from the right, and don&#8217;t pay any cost for stonewalling and <a href="http://www.washingtonpost.com/blogs/wonkblog/wp/2012/12/30/the-republican-party-in-one-tweet/">prevaricating</a>. So that&#8217;s what we get.</p>
<p>We learned that despite living mostly in the immaculate cyber-world of our mobile devices, <em>Mother Nature always wins</em>. The South Ferry station, just built with massive 9/11 rescue funds (thanks America) is still closed and needs to be completely rebuilt after Sandy. And the A train causeway to Far Rockaway is also a total loss. After an unbroken string of major storms, one can only hope this will not be an annual occurrence.</p>
<p>What ties all these threads together? We really need to design structures that align the interests of the individual with the interests of the whole, and allow both to adapt to meet new challenges. The world is changing too fast to keep up. And we&#8217;re failing badly. <em>It&#8217;s all about <a href="http://www.forbes.com/fdc/welcome_mjx.shtml">market design</a>, and our systems suck</em>.</p>
<p><a href="http://blog.streeteye.com/blog/wp-content/uploads/2012/12/Capture.png"><img title="QuickMeme.com" src="http://blog.streeteye.com/blog/wp-content/uploads/2012/12/Capture.png" alt="If the world is changing faster than your ability to adapt, you're gonna have a bad time" width="482" height="362" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2012/12/what-i-learned/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Social capital – or, the lost art of not taking a dump in the community pool</title>
		<link>http://blog.streeteye.com/blog/2012/11/social-capital/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=social-capital</link>
		<comments>http://blog.streeteye.com/blog/2012/11/social-capital/#comments</comments>
		<pubDate>Mon, 05 Nov 2012 01:16:56 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1176</guid>
		<description><![CDATA[The first casualty when war comes is truth. &#8211; Hiram Johnson Everybody talkin&#8217; to their pockets Everybody wants a box of chocolates And a long-stemmed rose - Leonard Cohen Let&#8217;s talk a little about social capital. According to studies, Greeks work the longest hours in Europe, and their retirement age is in the middle of [...]]]></description>
				<content:encoded><![CDATA[<p><em>The first casualty when war comes is truth. &#8211; Hiram Johnson</em></p>
<p><em>Everybody talkin&#8217; to their pockets<br />
Everybody wants a box of chocolates<br />
And a long-stemmed rose<br />
- Leonard Cohen<br />
</em><br />
Let&#8217;s talk a little about social capital.</p>
<p>According to studies, Greeks <a href="http://www.newstatesman.com/blogs/world-affairs/2012/05/exploding-myth-feckless-lazy-greeks">work the longest hours in Europe, and their retirement age is in the middle of the pack</a>. Same goes for a lot of developing countries, and even some US inner cities. People work themselves to the bone, and they don&#8217;t get ahead.</p>
<p>Why are those countries in such a mess?<br />
<span id="more-1176"></span><br />
One reason is physical capital. Most of the difference between the productivity of an Indian coolie carrying bricks on his head and a US truck-driver is the truck.</p>
<p>Another reason is human capital. Poorly performing countries don&#8217;t have as many literate, well educated, highly trained workers who can handle complex, productive tasks with advanced tools and techniques. Not to pick on India, but the literacy rate is 74%.</p>
<p>The last reason is difficult to quantify and therefore not as much discussed in economics, but it&#8217;s absolutely critical: social capital.</p>
<p>Social capital is the set of social values, norms, and behaviors that improve the productivity of economic and social interactions. In the poor countries and communities, examples of dysfunctional norms and values abound. Girls shouldn&#8217;t be educated, or school isn&#8217;t cool. Certain jobs and places for university students should be reserved for certain races/castes (goes both ways). Cheating and bribery are endemic. Little things like people don&#8217;t show up on time, don&#8217;t wait on line, don&#8217;t observe traffic rules, literally dump waste in the drinking water, get away with murder. People don&#8217;t have incentives to be productive. And antisocial behaviors are not punished, but held in high regard, and reap rewards.</p>
<p>In advanced countries, social networks and hierarchies allow people to cooperate and pursue shared goals. Good behavior is rewarded and bad behavior punished, not just in courts where rule of law applies to all, but in the court of public opinion. Trust evolves &#8211; you don&#8217;t have to count your change, you can give your credit card to the waiter and not worry about them stealing. You don&#8217;t need to double-lock your door and put bars on your window and worry about rushing home before dark. Status accrues to people based on their abilities, achievements and character, not based on connections.</p>
<p>There were a lot of <a href="http://blog.streeteye.com/blog/2011/07/fannie-freddie-and-the-financial-crisis/">reasons for the financial crisis</a>. But one was &#8220;I&#8217;ll be gone, you&#8217;ll be gone&#8221; when the losses turn up. In many cases the people in a position to know <em>knew</em> loans were bad, deals were bad, ratings were bad. But the incentive was to get the deal done, book the profit, cash the bonus. Clients turned into counterparties, it was OK to blow them up. Market makers were replaced by HFT programs with no responsibility for orderly markets. A looter mentality replaced building for the long term.</p>
<p>Division destroys social capital. You can have social capital with a left and a right. But you can&#8217;t have it when one section of society demonizes the other, assumes that the other side only cares about itself and not the country or broader good. You can&#8217;t have it without a basic consensus on the character of society, without the ability to develop institutions because the rules are changing. And bad behavior drives out good, when you assume one side is going to gain an advantage from lying, cheating, or stealing, it becomes an excuse to do it yourself.</p>
<p>We&#8217;re having an election Tuesday. Each side accuses the other side of lying &#8211; in all too many cases justifiably (<a href="http://maddowblog.msnbc.com/mendacity">1</a> &#8211; <a href="http://www.politico.com/news/stories/0912/81212.html">2</a>). If it&#8217;s close, one side will accuse the other of stealing it. If a poll or even <a href="http://online.wsj.com/article/SB10000872396390444897304578046260406091012.html">an economic number (!)</a> is seen to favor one side, it&#8217;s proof that the other side is cheating. There&#8217;s a war on facts, with <a href="http://directorsblog.blogs.census.gov/2012/05/11/a-future-without-key-social-and-economic-statistics-for-the-country/">economic data collection</a> and reports de-funded if it&#8217;s believed they provide evidence for the other side.</p>
<p>We&#8217;re not going to turn into Greece because of the debt. We just won&#8217;t grow as fast if we spend on the wrong things. We <em>will</em> turn into Greece if we become a society of looters and moochers. <em>And once we see each other that way, that&#8217;s how we behave.</em></p>
<p>You can&#8217;t have progress or a civilized society with people literally, or figuratively, taking a dump in the community pool. As a society, we need to call people out and exact a price when they do it.</p>
<p><iframe src="http://www.youtube.com/embed/yG5e1oaen-M" frameborder="0" width="420" height="315"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2012/11/social-capital/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Broken Windows</title>
		<link>http://blog.streeteye.com/blog/2012/11/broken-windows/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=broken-windows</link>
		<comments>http://blog.streeteye.com/blog/2012/11/broken-windows/#comments</comments>
		<pubDate>Fri, 02 Nov 2012 02:05:50 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1263</guid>
		<description><![CDATA[So, some people are talking about Hurricane Sandy putting people back to work, and others are pointing out that this is the &#8216;broken windows fallacy.&#8217; True, a massive superstorm is usually not a good thing. Nevertheless, three quick points. 1) The recovery spending is not a deadweight loss. You jump into the pool and forget [...]]]></description>
				<content:encoded><![CDATA[<p>So, some people are talking about Hurricane Sandy putting people back to work, and others are pointing out that this is the <a title="Google search" href="https://www.google.com/search?q=broken+windows+fallacy+hurricane+sandy">&#8216;broken windows fallacy.&#8217;</a> True, a massive superstorm is usually not a good thing. Nevertheless, three quick points.</p>
<p><div class="wp-caption alignright" style="width: 310px"><a href="http://commons.wikipedia.org/wiki/File:Bay_Bridge_collapse_2.jpg" target="_blank"><img class="zemanta-img-inserted zemanta-img-configured" title="English: Aerial view of roadbed collapse near ..." src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/Bay_Bridge_collapse_2.jpg/300px-Bay_Bridge_collapse_2.jpg" alt="English: Aerial view of roadbed collapse near ..." width="300" height="243" /></a><p class="wp-caption-text">English: Aerial view of roadbed collapse near the interface of the cantilevered truss sections of the San Francisco-Oakland Bay Bridge. View northwestward. Cropped from original version to better fit San Francisco–Oakland Bay Bridge article. (Photo credit: Wikipedia)</p></div><br />
<span id="more-1263"></span><br />
1) <em>The recovery spending is not a deadweight loss.</em> You jump into the pool and forget to take your telephone out of your pocket. Rats! this is not a good thing, it&#8217;s going to cost to replace it. But then you say to yourself, well, I was due for a new one anyway. The loss is the <em>remaining useful value, not the amount you have to spend on the new phone</em>. An earthquake damages the Bay Bridge, and $6B is spent on a new bridge. But the existing bridge was obsolete and prone to collapse, and the new one is better. The loss is not the $6B cost of the new bridge, just the remaining value of the old one, which may not have been worth much at all. The impact may just be to bring forward necessary spending a little earlier.</p>
<p>2) <em>The recovery spending is not all lost opportunity cost.</em> Suppose you&#8217;re a farmer harvesting the crops, and your truck breaks down, and you have to fix it, while the crops rot in the field. That&#8217;s a bad break. Now, suppose you&#8217;re unemployed and watching TV, feeling sorry for yourself, and your car breaks down. You spend some time fixing it, feel a lot better for yourself, and decide to get a job as a mechanic. That&#8217;s not such a bad break. When there&#8217;s high unemployment and low interest rates, the situation is more like the latter. Borrowing is not going to raise interest rates and crowd out other useful investment, and hiring recovery workers is not going to have to bid up wages to get them from productive work in other industries. To some extent, <em>we&#8217;re just taking idle resources and putting them to work</em>. And an unemployed worker is a wasting asset, you&#8217;re never getting back his or her productive years, and the longer they stay unemployed, the more rusty their skills get, the more potential employers question their value, and the less likely they are to return to a similar job. In the sense of forcing people to spend cash on something productive, Sandy is doing what Ben Bernanke is trying to do. </p>
<p>3) <em>The world is a complicated dynamic system.</em> You never know the outcome of the alternative history that could have been. Only simple models give clear answers, and the world does not oblige by acting like one. The hurricane could be pulling a finger out of a dike, Wall Street will feel obliged to move some people away, the tax base will diminish, and New York will go back to the 70s or turn into Detroit. (Unlikely, we survived 9/11, but eventually all shining cities enter a cycle of decay.) Alternatively, the infrastructure could get fixed up, and it could result in surviving an even more massive disaster unscathed that otherwise would have destroyed us.</p>
<p>A natural disaster is not something to be wished for, but we&#8217;ve been through worse, it could have come at a worse time, and what doesn&#8217;t kill us makes us stronger.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/?px"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=514273cf-566f-46ee-8c3e-5f59233d1e51" alt="Enhanced by Zemanta" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2012/11/broken-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Paul Ryan plan</title>
		<link>http://blog.streeteye.com/blog/2012/08/the-paul-ryan-plan/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-paul-ryan-plan</link>
		<comments>http://blog.streeteye.com/blog/2012/08/the-paul-ryan-plan/#comments</comments>
		<pubDate>Sun, 12 Aug 2012 15:25:56 +0000</pubDate>
		<dc:creator>StreetEYE</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.streeteye.com/blog/?p=1255</guid>
		<description><![CDATA[The Paul Ryan plan ‘Promotes saving by eliminating taxes on interest, capital gains, and dividends; also eliminates the death tax.’ So people like Mitt Romney, and all his heirs in perpetuity, would never pay another dime in income tax. How sweet is that? How fair is that? It’s shocking that in this day and age, [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://roadmap.republicans.budget.house.gov/issues/issue/?IssueID=8514" title="house.gov">The Paul Ryan plan</a> <em>‘Promotes saving by eliminating taxes on interest, capital gains, and dividends; also eliminates the death tax.’</em> </p>
<p>So people like Mitt Romney, and all his heirs in perpetuity, would never pay another dime in income tax. How sweet is that? How fair is that?</p>
<p>It’s shocking that in this day and age, someone could make such a proposal, and be considered a serious person and politician.</p>
<p>The GOP has come an awful long way from its founder, who said, <em>“Capital is only the fruit of labor, and could never have existed if labor had not first existed. Labor is the superior of capital, and deserves much the higher consideration.”</em> &#8211; Abraham Lincoln</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.streeteye.com/blog/2012/08/the-paul-ryan-plan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
