<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>John Myles White &#187; Economics</title>
	<atom:link href="http://www.johnmyleswhite.com/notebook/category/economics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnmyleswhite.com</link>
	<description>&#34;He who refuses to do arithmetic is doomed to talk nonsense.&#34;</description>
	<lastBuildDate>Wed, 26 Oct 2011 11:36:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Speeding Up MLE Code in R</title>
		<link>http://www.johnmyleswhite.com/notebook/2011/06/18/speeding-up-mle-code-in-r/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2011/06/18/speeding-up-mle-code-in-r/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 00:02:29 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Psychology]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=4264</guid>
		<description><![CDATA[Recently, I&#8217;ve been fitting some models from the behavioral economics literature to choice data. Most of these models amount to non-linear variants of logistic regression in which I want to infer the parameters of a utility function. Because several of these models aren&#8217;t widely used, I&#8217;ve had to write my own maximum likelihood code to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve been fitting some models from the behavioral economics literature to choice data. Most of these models amount to non-linear variants of logistic regression in which I want to infer the parameters of a utility function. Because several of these models aren&#8217;t widely used, I&#8217;ve had to write my own maximum likelihood code to estimate the parameters of these models.</p>
<p>In the process, I&#8217;ve started to learn something about how to write code that runs quickly in R. In this post, I&#8217;ll try to share some of that knowledge by describing three ways of performing maximum likelihood estimation in R whose runtimes differ by two orders of magnitude. The differences seem to depend upon two factors: (1) how I access the entries of a data frame and (2) whether I use loops or vectorized operations to perform basic arithmetic.</p>
<p>To simplify things, I&#8217;ll present a model that should be familiar to people with a background in economics: the exponentially discounted utility model. To implement it in R, we define the discounted value of <code>x</code> dollars at time <code>t</code> as:</p>

<div class="wp_codebox"><table><tr id="p42648"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p4264code8"><pre class="c" style="font-family:monospace;">discounted.<span style="color: #202020;">value</span> <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> t<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">*</span> delta <span style="color: #339933;">^</span> t<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In addition to the discounted utility model, we assume that choices originate from a stochastic choice model with logistic noise. To invert this noise during inference, we&#8217;ll use the inverse logit transform:</p>

<div class="wp_codebox"><table><tr id="p42649"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p4264code9"><pre class="c" style="font-family:monospace;">invlogit <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>z<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">+</span> exp<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>z<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>To test my inference routine, I need to generate &#8220;stochastic&#8221; data of the sort you would expect to see from an exponentially discounting agent that&#8217;s indifferent between having $1 at time t = 0 and $3 at time t = 1. I&#8217;ll refer to the first good as (X1, T1) and the second good as (X2, T2). If the agent chooses (X2, T2), I&#8217;ll write that as <code>C == 1</code>; if they choose (X1, T1), I&#8217;ll write that as <code>C == 0</code>. With those conventions, the sample data is generated as:</p>

<div class="wp_codebox"><table><tr id="p426410"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p4264code10"><pre class="c" style="font-family:monospace;">n <span style="color: #339933;">&lt;-</span> <span style="color: #0000dd;">100</span>
&nbsp;
choices <span style="color: #339933;">&lt;-</span> data.<span style="color: #202020;">frame</span><span style="color: #009900;">&#40;</span>X1 <span style="color: #339933;">=</span> rep<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> each <span style="color: #339933;">=</span> n<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                      T1 <span style="color: #339933;">=</span> rep<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> each <span style="color: #339933;">=</span> n<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                      X2 <span style="color: #339933;">=</span> rep<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">3</span><span style="color: #339933;">,</span> each <span style="color: #339933;">=</span> n<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                      T2 <span style="color: #339933;">=</span> rep<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> each <span style="color: #339933;">=</span> n<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                      C <span style="color: #339933;">=</span> rep<span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> by <span style="color: #339933;">=</span> n <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>To fit the exponential model to this data set, we&#8217;ll use the <code>optim</code> function to minimize the negative log likelihood of the data by setting two parameters: <code>a</code>, the variance of the noise in the utility function; and <code>delta</code>, the discount factor in the discounted utility model. The three implementations of this model that I&#8217;ll show only differ in the definition of the log likelihood function, so the final call to <code>optim</code> to perform maximum likelihood estimation is constant across all examples:</p>

<div class="wp_codebox"><table><tr id="p426411"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p4264code11"><pre class="c" style="font-family:monospace;">logit.<span style="color: #202020;">estimator</span> <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>choices<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span> 
  wrapper <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">-</span>log.<span style="color: #202020;">likelihood</span><span style="color: #009900;">&#40;</span>choices<span style="color: #339933;">,</span> x<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> x<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>
  optimization.<span style="color: #202020;">results</span> <span style="color: #339933;">&lt;-</span> optim<span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> wrapper<span style="color: #339933;">,</span> method <span style="color: #339933;">=</span> <span style="color: #ff0000;">'L-BFGS-B'</span><span style="color: #339933;">,</span> lower <span style="color: #339933;">=</span> c<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> upper <span style="color: #339933;">=</span> c<span style="color: #009900;">&#40;</span>Inf<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>optimization.<span style="color: #202020;">results</span>$par<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Here, I had to specify bounds for the parameters, <code>a</code> and <code>delta</code>, because it&#8217;s assumed that <code>a</code> must be positive and that <code>delta</code> must lie in the interval [0, 1]. To deal with these bounds, one has to use the L-BFGS-B method in <code>optim</code>.</p>
<p>The first implementation I&#8217;ll show is the one I find most natural to write, even though it turns out to be the least efficient by far:</p>

<div class="wp_codebox"><table><tr id="p426412"><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
</pre></td><td class="code" id="p4264code12"><pre class="c" style="font-family:monospace;">log.<span style="color: #202020;">likelihood</span> <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>choices<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  ll <span style="color: #339933;">&lt;-</span> <span style="color: #0000dd;">0</span>
&nbsp;
  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i in <span style="color: #0000dd;">1</span><span style="color: #339933;">:</span>nrow<span style="color: #009900;">&#40;</span>choices<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    u2 <span style="color: #339933;">&lt;-</span> discounted.<span style="color: #202020;">value</span><span style="color: #009900;">&#40;</span>choices<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">,</span> <span style="color: #ff0000;">'X2'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> choices<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">,</span> <span style="color: #ff0000;">'T2'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
    u1 <span style="color: #339933;">&lt;-</span> discounted.<span style="color: #202020;">value</span><span style="color: #009900;">&#40;</span>choices<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">,</span> <span style="color: #ff0000;">'X1'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> choices<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">,</span> <span style="color: #ff0000;">'T1'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
&nbsp;
    p <span style="color: #339933;">&lt;-</span> invlogit<span style="color: #009900;">&#40;</span>a <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span>u2 <span style="color: #339933;">-</span> u1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>choices<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">,</span> <span style="color: #ff0000;">'C'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      ll <span style="color: #339933;">&lt;-</span> ll <span style="color: #339933;">+</span> log<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
      ll <span style="color: #339933;">&lt;-</span> ll <span style="color: #339933;">+</span> log<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span> <span style="color: #339933;">-</span> p<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>ll<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In the second implementation, I define a row level likelihood function, so that the summing and logarithmic transform are vectorized.</p>

<div class="wp_codebox"><table><tr id="p426413"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p4264code13"><pre class="c" style="font-family:monospace;">rowwise.<span style="color: #202020;">likelihood</span> <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>row<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  u2 <span style="color: #339933;">&lt;-</span> discounted.<span style="color: #202020;">value</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">'X2'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> row<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">'T2'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
  u1 <span style="color: #339933;">&lt;-</span> discounted.<span style="color: #202020;">value</span><span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">'X1'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> row<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">'T1'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
  p <span style="color: #339933;">&lt;-</span> invlogit<span style="color: #009900;">&#40;</span>a <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span>u2 <span style="color: #339933;">-</span> u1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>ifelse<span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#91;</span><span style="color: #ff0000;">'C'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> p<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span> <span style="color: #339933;">-</span> p<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
log.<span style="color: #202020;">likelihood</span> <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>choices<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  likelihoods <span style="color: #339933;">&lt;-</span> apply<span style="color: #009900;">&#40;</span>choices<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>rowwise.<span style="color: #202020;">likelihood</span><span style="color: #009900;">&#40;</span>row<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>sum<span style="color: #009900;">&#40;</span>log<span style="color: #009900;">&#40;</span>likelihoods<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In the third implementation, I define a fully vectorized log likelihood function that avoids any explicit iteration and therefore removes most of the data frame indexing operations:</p>

<div class="wp_codebox"><table><tr id="p426414"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p4264code14"><pre class="c" style="font-family:monospace;">log.<span style="color: #202020;">likelihood</span> <span style="color: #339933;">&lt;-</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>choices<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  u2 <span style="color: #339933;">&lt;-</span> discounted.<span style="color: #202020;">value</span><span style="color: #009900;">&#40;</span>choices$X2<span style="color: #339933;">,</span> choices$T2<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
  u1 <span style="color: #339933;">&lt;-</span> discounted.<span style="color: #202020;">value</span><span style="color: #009900;">&#40;</span>choices$X1<span style="color: #339933;">,</span> choices$T1<span style="color: #339933;">,</span> delta<span style="color: #009900;">&#41;</span>
  p <span style="color: #339933;">&lt;-</span> invlogit<span style="color: #009900;">&#40;</span>a <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span>u2 <span style="color: #339933;">-</span> u1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  likelihoods <span style="color: #339933;">&lt;-</span> ifelse<span style="color: #009900;">&#40;</span>choices$C <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> p<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span> <span style="color: #339933;">-</span> p<span style="color: #009900;">&#41;</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span>sum<span style="color: #009900;">&#40;</span>log<span style="color: #009900;">&#40;</span>likelihoods<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The code I used to call all of these implementations and compare them is up on <a href="https://github.com/johnmyleswhite/fastR">GitHub</a> for those interested. The results, which strike me as remarkable, are below:</p>
<ol>
<li>On my laptop, implementation 1 takes ~1.0 second to run.</li>
<li>On my laptop, implementation 2 takes ~0.25 seconds to run.</li>
<li>On my laptop, implementation 3 takes ~0.01 seconds to run.</li>
</ol>
<p>In short, the third implementation is 100x faster than the first implementation with only minor changes to the code I originally wrote. Hopefully this example will help inspire others who have R code they&#8217;d like to speed up, but aren&#8217;t sure where to start.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2011/06/18/speeding-up-mle-code-in-r/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The Post-Lehman Era</title>
		<link>http://www.johnmyleswhite.com/notebook/2011/06/17/the-post-lehman-era/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2011/06/17/the-post-lehman-era/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 13:46:49 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Aphorisms]]></category>
		<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=4262</guid>
		<description><![CDATA[The existence of recessions no more invalidates economic theory than the existence of AIDS invalidates molecular biology.]]></description>
			<content:encoded><![CDATA[<p>The existence of recessions no more invalidates economic theory than the existence of AIDS invalidates molecular biology.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2011/06/17/the-post-lehman-era/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inconsistencies in Bayesian Models of Decision-Making</title>
		<link>http://www.johnmyleswhite.com/notebook/2011/01/20/inconsistencies-in-bayesian-models-of-decision-making/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2011/01/20/inconsistencies-in-bayesian-models-of-decision-making/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 03:48:04 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>
		<category><![CDATA[Psychology]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=4199</guid>
		<description><![CDATA[But modeling devices that make sense for an unbiased decisionmaker may not make sense for a biased one. For example, why would individuals have priors and posteriors if they are destined to apply Bayes&#8217; law incorrectly?1 A question I often ask myself. Wolfgang Pesendorfer : Behavioral Economics Comes of Age: A Review Essay on Advances [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
But modeling devices that make sense for an unbiased decisionmaker may not make sense for a biased one. For example, why would individuals have priors and posteriors if they are destined to apply Bayes&#8217; law incorrectly?<sup><a href="http://www.johnmyleswhite.com/notebook/2011/01/20/inconsistencies-in-bayesian-models-of-decision-making/#footnote_0_4199" id="identifier_0_4199" class="footnote-link footnote-identifier-link" title="Wolfgang Pesendorfer : Behavioral Economics Comes of Age: A Review Essay on Advances in Behavioral Economics">1</a></sup>
</p></blockquote>
<p>A question I often ask myself.</p>
<ol class="footnotes"><li id="footnote_0_4199" class="footnote"><a href="http://www.princeton.edu/~pesendor/">Wolfgang Pesendorfer</a> : <a href="http://www.jstor.org/stable/30032350">Behavioral Economics Comes of Age: A Review Essay on Advances in Behavioral Economics</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2011/01/20/inconsistencies-in-bayesian-models-of-decision-making/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Academic Jargon: Field-Specific Insults</title>
		<link>http://www.johnmyleswhite.com/notebook/2010/12/12/academic-jargon-field-specific-insults/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2010/12/12/academic-jargon-field-specific-insults/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 23:22:49 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Academia]]></category>
		<category><![CDATA[Economics]]></category>
		<category><![CDATA[Psychology]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=4191</guid>
		<description><![CDATA[Every academic field seems to develop a set of generic insults based on their intellectual toolkit. Here are two examples I hear often: Probabilists and Statisticians: &#8220;I think that&#8217;s an interesting case, but it&#8217;s in a set with measure zero.&#8221; Economists: &#8220;X group&#8217;s behavior is clearly rent-seeking.&#8221; Do any readers have good examples from other [...]]]></description>
			<content:encoded><![CDATA[<p>Every academic field seems to develop a set of generic insults based on their intellectual toolkit. Here are two examples I hear often:</p>
<ol>
<li><b>Probabilists and Statisticians</b>: &#8220;I think that&#8217;s an interesting case, but it&#8217;s in a set with measure zero.&#8221;</li>
<li><b>Economists</b>: &#8220;X group&#8217;s behavior is clearly rent-seeking.&#8221;</li>
</ol>
<p>Do any readers have good examples from other fields?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2010/12/12/academic-jargon-field-specific-insults/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Escher and Redemption: Using Cyclical Preferences to Overcome Hedonic Treadmills</title>
		<link>http://www.johnmyleswhite.com/notebook/2010/09/12/escher-and-redemption-using-cyclical-preferences-to-overcome-hedonic-treadmills/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2010/09/12/escher-and-redemption-using-cyclical-preferences-to-overcome-hedonic-treadmills/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 16:28:37 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>
		<category><![CDATA[Psychology]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=4055</guid>
		<description><![CDATA[This morning I started thinking about using violations of classical economic theory to increase well-being. The main idea is probably obvious to anyone familiar with the relevant literature on cyclical preferences and the hedonic treadmill, but I think it&#8217;s still worth articulating cleanly. Please let me know if you have a reference to existing literature [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I started thinking about using violations of classical economic theory to increase well-being. The main idea is probably obvious to anyone familiar with the relevant literature on cyclical preferences and the hedonic treadmill, but I think it&#8217;s still worth articulating cleanly. Please let me know if you have a reference to existing literature on this approach.</p>
<p>First, let&#8217;s assume the following things about our idealized human being:</p>
<ol>
<li>They possess cyclical preferences where A > B, B > C and C > A.</li>
<li>Their derived pleasure from experiencing A, B or C is based on an adaptive scale, i.e. they derive pleasure from having something better than their local average consumption.</li>
</ol>
<p>Under these assumptions, the best possible consumption stream is an ordered walk through the cycle of their preferences, such as (A, B, C, A, B, C, &#8230;). Assuming that their adaption is sufficiently local, they will able to continually derive pleasure from moving along the preference chain, despite the hedonic treadmill slowly eroding the gains made from any single movement along the preference graph.</p>
<p>The big idea here is that cyclical preferences, which are generally assumed to lower welfare, can be exploited to increase welfare for agents that suffer from a hedonic treadmill. Since there is some reason to believe in both violations of classical theory, this is potentially one trick for improving one&#8217;s own well-being.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2010/09/12/escher-and-redemption-using-cyclical-preferences-to-overcome-hedonic-treadmills/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Failures of Self-Control: More Data</title>
		<link>http://www.johnmyleswhite.com/notebook/2010/09/07/failures-of-self-control-more-data/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2010/09/07/failures-of-self-control-more-data/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 23:55:56 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>
		<category><![CDATA[Psychology]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=4049</guid>
		<description><![CDATA[Just when you worried that preference reversals weren&#8217;t real: Professional bookmakers rarely accept bets from individuals who directly control the outcome of the bet. We analyse a unique exception to this rule and a potential policy innovation in the battle against obesity: a weight loss betting market. If obese individuals have time-inconsistent preferences then commitment [...]]]></description>
			<content:encoded><![CDATA[<p>Just when you worried that <a href="http://www.google.com/url?sa=t&#038;source=web&#038;cd=1&#038;ved=0CBcQFjAA&#038;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.63.2938%26rep%3Drep1%26type%3Dpdf&#038;rct=j&#038;q=preference%20reversal%20intertemporal&#038;ei=uNOGTIqbNsSAlAfT6eXUDw&#038;usg=AFQjCNF6TXwgh2eJ3y1MXFQU0xBGqp9csA">preference reversals</a> weren&#8217;t real:</p>
<blockquote><p>
Professional bookmakers rarely accept bets from individuals who directly control the outcome of the bet. We analyse a unique exception to this rule and a potential policy innovation in the battle against obesity: a weight loss betting market. If obese individuals have time-inconsistent preferences then commitment mechanisms, such as personal gambles, should help them restrain their short-term impulses and lose weight. Correspondence with the bettors confirms that this is their primary motivation. However, it appears that the bettors in our sample are not particularly skilled at choosing effective commitment mechanisms. Despite payoffs of as high as $7350, approximately 80% of people who spend money to bet on their own behaviour end up losing their bets.<sup><a href="http://www.johnmyleswhite.com/notebook/2010/09/07/failures-of-self-control-more-data/#footnote_0_4049" id="identifier_0_4049" class="footnote-link footnote-identifier-link" title="Nicholas Burger and John Lynham : Betting on weight loss . . . and losing: personal gambles as commitment mechanisms">1</a></sup>
</p></blockquote>
<p>HT <a href="http://cheeptalk.wordpress.com/2010/09/07/bad-news-for-commitment-mechanisms/">Cheap Talk</a>. Reading this makes me glad to have finished my last Master&#8217;s degree requirement today by turning in a review of the literature on intertemporal choice.</p>
<ol class="footnotes"><li id="footnote_0_4049" class="footnote">Nicholas Burger and John Lynham : <a href="http://www2.hawaii.edu/~lynham/Welcome_files/913267828-2.pdf">Betting on weight loss . . . and losing: personal gambles as commitment mechanisms</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2010/09/07/failures-of-self-control-more-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Price of Calculation</title>
		<link>http://www.johnmyleswhite.com/notebook/2010/03/15/the-price-of-calculation/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2010/03/15/the-price-of-calculation/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 15:13:20 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3820</guid>
		<description><![CDATA[In a world in which the price of calculation continues to decrease rapidly, but the price of theorem proving continues to hold steady or increase, elementary economics indicates that we ought to spend a larger and larger fraction of our time on calculation.1 Over the next ten years, I hope that more and more mathematically [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
In a world in which the price of calculation continues to decrease rapidly, but the price of theorem proving continues to hold steady or increase, elementary economics indicates that we ought to spend a larger and larger fraction of our time on calculation.<sup><a href="http://www.johnmyleswhite.com/notebook/2010/03/15/the-price-of-calculation/#footnote_0_3820" id="identifier_0_3820" class="footnote-link footnote-identifier-link" title="J. W. Tukey : The American Statistician : Sunset Salvo">1</a></sup>
</p></blockquote>
<p>Over the next ten years, I hope that more and more mathematically minded hackers, empowered by open source tools like the R programming language and emboldened by the popularization of statistical analyses by people like Steve Levitt, will follow Tukey&#8217;s suggestion.</p>
<ol class="footnotes"><li id="footnote_0_3820" class="footnote">J. W. Tukey : The American Statistician : Sunset Salvo</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2010/03/15/the-price-of-calculation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Big Businesses Work to Conserve Resources</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/12/06/how-big-businesses-work-to-conserve-resources/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2009/12/06/how-big-businesses-work-to-conserve-resources/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 15:53:57 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3630</guid>
		<description><![CDATA[This NYT piece by Jared Diamond is remarkable for its clear real-world examples of the ways in which businesses will independently discover ways to conserve resources, simply because minimizing wastefulness is profitable. HT: Marginal Revolution]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nytimes.com/2009/12/06/opinion/06diamond.html?_r=2&#038;hp">This NYT piece by Jared Diamond</a> is remarkable for its clear real-world examples of the ways in which businesses will independently discover ways to conserve resources, simply because minimizing wastefulness is profitable.</p>
<p>HT: <a href="http://www.marginalrevolution.com/marginalrevolution/2009/12/assorted-links-3.html">Marginal Revolution</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2009/12/06/how-big-businesses-work-to-conserve-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Risk Aversion in Action</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/09/25/risk-aversion-in-action/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2009/09/25/risk-aversion-in-action/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 13:46:50 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3589</guid>
		<description><![CDATA[From Pew Research, here&#8217;s a gem for those interested in real world examples of risk aversion:there are two people who prefer a secure job that pays less well for every one person who prefers a higher salary with the risk of job loss. Of course, you&#8217;d want to know what all of these people assume [...]]]></description>
			<content:encoded><![CDATA[<p>From Pew Research, here&#8217;s a gem for those interested in real world examples of risk aversion:<a href="http://pewresearch.org/databank/dailynumber/?NumberID=854">there are two people who prefer a secure job that pays less well for every one person who prefers a higher salary with the risk of job loss.</a> Of course, you&#8217;d want to know what all of these people assume the ratio of risk of job less to salary increase is to really use this, but it&#8217;s promising.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2009/09/25/risk-aversion-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chess Players versus The Beauty Contest Game</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/07/31/chess-players-versus-the-beauty-contest-game/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2009/07/31/chess-players-versus-the-beauty-contest-game/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 15:20:44 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3571</guid>
		<description><![CDATA[Here is a fascinating piece on the Beauty Contest game being played by chess players.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.chessbase.com/newsdetail.asp?newsid=5621">Here</a> is a fascinating piece on the Beauty Contest game being played by chess players.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2009/07/31/chess-players-versus-the-beauty-contest-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance Pay and Wage Inequality</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/03/23/performance-pay-and-wage-inequality/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2009/03/23/performance-pay-and-wage-inequality/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 00:39:56 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3468</guid>
		<description><![CDATA[There is a very interesting paper in the February 2009 issue of the Quarterly Journal of Economics on &#8220;Performance Pay and Wage Inequality&#8221;. It&#8217;s fascinating to think that 21% of the rise in wage inequality since 1980 might be attributable to increased use of performance pay schemes.]]></description>
			<content:encoded><![CDATA[<p>There is a very interesting paper in <a href="http://www.mitpressjournals.org/toc/qjec/124/1">the February 2009 issue of the Quarterly Journal of Economics</a> on <a href="http://www.mitpressjournals.org/doi/abs/10.1162/qjec.2009.124.1.1">&#8220;Performance Pay and Wage Inequality&#8221;</a>. It&#8217;s fascinating to think that 21% of the rise in wage inequality since 1980 might be attributable to increased use of performance pay schemes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2009/03/23/performance-pay-and-wage-inequality/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Paul Graham and Friedrich Hayek</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/02/08/paul-graham-and-friedrich-hayek/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2009/02/08/paul-graham-and-friedrich-hayek/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 04:57:08 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3352</guid>
		<description><![CDATA[It may be difficult to say why the old method fails, but that it does fail, anyone can see. When is software delivered on time? Experienced programmers know that no matter how carefully you plan a program, when you write it the plans will turn out to be imperfect in some way. Sometimes the plans [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
It may be difficult to say why the old method fails, but that it does fail, anyone can see. When is software delivered on time? Experienced programmers know that no matter how carefully you plan a program, when you write it the plans will turn out to be imperfect in some way. Sometimes the plans will be hopelessly wrong. Yet few of the victims of the plan-and-implement method question its basic soundness. Instead they blame human failings: if only the plans had been made with more foresight, all this trouble could have been avoided. Since even the very best programmers run into problems when they turn to implementation, perhaps it’s too much to hope that people will ever have that much foresight. Perhaps the plan-and-implement method could be replaced with another approach which better suits our limitations.<sup><a href="http://www.johnmyleswhite.com/notebook/2009/02/08/paul-graham-and-friedrich-hayek/#footnote_0_3352" id="identifier_0_3352" class="footnote-link footnote-identifier-link" title="Paul Graham : On Lisp : Chapter 1">1</a></sup>
</p></blockquote>
<p>The passage above is from Paul Graham&#8217;s wonderful book on advanced Lisp programming, <i>On Lisp</i>, but very few changes would be required to transform it into a passage you might find in one of Friedrich Hayek&#8217;s books on command-and-control economies. Hayek&#8217;s views on economics and Graham&#8217;s views on programming both give central place to their realization that we humans are simply not smart enough to grasp all of the details of the complex systems we are called upon to build. Most of the complex systems that function in our world exist because it was possible for trial-and-error work to produce them evolutionarily over time. As far as I can see, the level of complexity of a system that we can produce using pure theory is at about the level of complexity of an atomic bomb, which seems far less complex than the task of producing a system of wages and prices that optimally allocates resources in a population of heterogeneous agents.</p>
<ol class="footnotes"><li id="footnote_0_3352" class="footnote">Paul Graham : On Lisp : Chapter 1</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2009/02/08/paul-graham-and-friedrich-hayek/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fear is Your Only God</title>
		<link>http://www.johnmyleswhite.com/notebook/2008/10/22/fear-is-your-only-god/</link>
		<comments>http://www.johnmyleswhite.com/notebook/2008/10/22/fear-is-your-only-god/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 18:54:01 +0000</pubDate>
		<dc:creator>John Myles White</dc:creator>
				<category><![CDATA[Economics]]></category>

		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3163</guid>
		<description><![CDATA[Are you unsure if depressions are at least partly caused by a self-propagating group fear response? Maybe this piece of spam I just got will help to change your mind: WACHOVIA CORPORATION NOTICE. Citigroup announced a buyout of Wachovia brokered by the FDIC. All Wachovia bank locations will be in the Citigroup merger to prevent [...]]]></description>
			<content:encoded><![CDATA[<p>Are you unsure if depressions are at least partly caused by a self-propagating group fear response? Maybe this piece of spam I just got will help to change your mind:</p>
<blockquote>
<pre>
WACHOVIA CORPORATION NOTICE.

Citigroup announced a buyout of Wachovia brokered by the FDIC.
All Wachovia bank locations will be in the Citigroup merger to prevent failure of Wachovia.
The Citigroup/Wachovia would focus on upgrading banks' security certificates.
All Wachovia customers must fill the forms and complete installation of new Citigroup Standard digital signatures during 48 hours.
Please follow the installation steps below:

Read more>>

Sincerely, Cecile Bowling.
2008 Wachovia Corporation.
All rights reserved.
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.johnmyleswhite.com/notebook/2008/10/22/fear-is-your-only-god/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.378 seconds -->

