Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrall committed Feb 26, 2021
1 parent 37f1fe6 commit 13d62c3
Show file tree
Hide file tree
Showing 32 changed files with 3,405 additions and 2,829 deletions.
10 changes: 5 additions & 5 deletions docs/DDP/Bellman.ox.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h2><span class="icon"><img class="icon" src="icons/class.png">&nbsp;</span><spa
<td class="modifiers"></td>
<td class="description">TransStore x &eta;-Array of feasible endogenous state
indices and transitions
$P(\theta^\prime;\alpha,\eta,\theta).</td>
<span class="expressions">\(P(\theta^\prime;\alpha,\eta,\theta)\)</span>.</td>
</tr>
<tr class="odd">
<td class="declaration"><img class="icon" src="icons/field_s.png">&nbsp;<a href="Bellman.ox.html#Bellman___pandv">pandv</a></td>
Expand Down Expand Up @@ -1203,7 +1203,7 @@ <h3><span class="icon"><img class="icon" src="icons/field.png">&nbsp;</span><spa
<dl><dd>
TransStore x &eta;-Array of feasible endogenous state
indices and transitions
$P(\theta^\prime;\alpha,\eta,\theta).
<span class="expressions">\(P(\theta^\prime;\alpha,\eta,\theta)\)</span>.

</dd></dl>

Expand Down Expand Up @@ -1460,15 +1460,15 @@ <h3><span class="icon"><img class="icon" src="icons/method.png">&nbsp;</span><sp
<dl><dd>
Update dynamically changing components of the program at the time chosen by the user.
<P/>
<DT>Things to do before spanning the <span class="expressions">\(\Eta\)</span> and <span class="expressions">\(\Theta\)</span> state spaces
<DT>Things to do before spanning the <span class="expressions">\(\eta\)</span> and <span class="expressions">\(\Theta\)</span> state spaces
<OL>
<LI>Call <code>PreUpdate</code> hooks (see <a href="DDPShared.ox.html#Hooks">Hooks</a>).
<LI>Loop over all States: call its Update() method and <code>Distribution()</code> of random effects.</LI>
<LI>Loop over actions to update <code>Update()</code> them and set the actual values.</LI>
<LI>Compute the exogenous transitions, <span class="expressions">\(P(\epsilon^\prime)\)</span> and <span class="expressions">\(P(\eta^\prime)\)</span>.</LI>
</OL>
<P/>
Then span the <span class="expressions">\(\Eta\)</span> and <span class="expressions">\(|Theta\)</span> spaces to compute and store endogenous transitions at each point.
Then span the <span class="expressions">\(\eta\)</span> and <span class="expressions">\(\Theta\)</span> spaces to compute and store endogenous transitions at each point.

<dl><dt class="seealso">See also:</dt><dd class="seealso"><a href="DP.ox.html#DP___SetUpdateTime">SetUpdateTime</a>, <a href="DDPShared.ox.html#UpdateTimes">UpdateTimes</a></dd>
</dl>
Expand Down Expand Up @@ -1532,7 +1532,7 @@ <h3><span class="icon"><img class="icon" src="icons/method.png">&nbsp;</span><sp
Extreme Value Ex Post Choice Probability Smoothing.
<P/>
Sets <a href="Bellman.ox.html#Bellman___pandv">pandv</a> equal to
<span class="equation">$$P^{\star}\left(\alpha;\theta\r) = {e^{\rho(\vv-V)}\over {\sum}_{a\in A(\theta)} e^{\rho( v(a;\th)-V) }}.$$</span>
<span class="equation">$$P^{\star}\left(\alpha;\theta\right) = {e^{\rho(\vv-V)}\over {\sum}_{a\in A(\theta)} e^{\rho( v(a;\th)-V) }}.$$</span>

<dl><dt class="seealso">See also:</dt><dd class="seealso"><a href="Shared.ox.html#RowLogit">RowLogit</a></dd>
</dl>
Expand Down
759 changes: 46 additions & 713 deletions docs/DDP/DDP.ox.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/DDP/GetStarted.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1><span class="icon"><img class="icon" src="icons/file.png">&nbsp;</span><span
<P/>
<OL class="body">
<P/>
<a name="GS0"><LI>A simple DDP model of <em>searching for a low purchase price</em>.</LI></a>
<LI id=""GS0"">A simple DDP model of <em>searching for a low purchase price</em>.</LI>
<P/>
Here we set up a very simple sequential choice problem. Then we translate the elements of the model into the terms used in <span class="n">DDP</span>. Then code that implements the model and solves for optimal decision rules is presented. The output generated by <span class="n">DDP</span> is shown.
<P/>
Expand All @@ -51,7 +51,7 @@ <h1><span class="icon"><img class="icon" src="icons/file.png">&nbsp;</span><span
<P/>
<OL class="chapter">
<P/>
<a name="A"><LI>Define The Model</LI></a>
<LI id="A">Define The Model</LI>
A person must purchase an item. They search, <em>potentially forever</em>, for an acceptably low price.<details class="aside"><summary><em>What does N&oline; mean?</em></summary>N&oline; &equiv; N-1. So, 5&oline; = 4. Since counting starts at 0 the larges value is always the number of values minus 1. But putting <q>N-1</q> everywhere is not elegant.<br> For more on notation see <a href="DDP.ox.html#NC">Notation and Conventions</a>. <p></details>
Each period a price <span class="expressions">\(p\)</span> is drawn from a discrete set <span class="expressions">\(\{0,1,2,...,N-1\}\)</span>.</p>
Over time, price offers are IID and, for simplicity, each value is equally likely:
Expand All @@ -68,7 +68,7 @@ <h1><span class="icon"><img class="icon" src="icons/file.png">&nbsp;</span><span
<DD><img src="GetStarted.png"></img></DD>
The red lines indicate discrete price offers. There is a reservation price but it will generically fall between possible offers. </p>
<P/>
<a name="AB"><LI>Translate the model into <span class="n">DDP</span> terms</LI></a>
<LI id="AB">Translate the model into <span class="n">DDP</span> terms</LI>
<P/>
The notation used here uses <span class="n">DDP</span>'s notation for describing a model. Presuming you are starting with this example this notation is shown here to demonstrate how all aspects of DP problems are part of <span class="n">DDP</span>.</p>
<P/>
Expand All @@ -83,7 +83,7 @@ <h1><span class="icon"><img class="icon" src="icons/file.png">&nbsp;</span><span
<DD><span class="expressions">\(U(\alpha,\epsilon,\theta) = U( (a), (p), (d) ) \)</span> <code>= -(1-d)*[ lam + a*p ]</code></DD>
Because Ox does not recognize Greek letters, <code>lam</code> &equiv; &lambda;. Further, multiplication uses <code>*</code>. However, since p, a, and d are <em>objects</em>, the Ox code to implement <var>U()</var> will require more than just referring to the variable in the expression.</p>
<P/>
<a name="B"><LI>Code the model in <span class="n">DDP</span></LI></a>
<LI id="B">Code the model in <span class="n">DDP</span></LI>
<P/>
<DT>The full DDP source code is in <a href="javascript:popoxcode('../../examples/DDP/GetStarted.ox');">examples/DDP/GetStarted.ox</a>.</DT>
<DT>Declare a class derived from <a href="Bellman.ox.html#Bellman">Bellman</a> to represent the problem.</DT>
Expand Down Expand Up @@ -204,7 +204,7 @@ <h1><span class="icon"><img class="icon" src="icons/file.png">&nbsp;</span><span
<LI>The model is solved by creating an solution object and calling its <a href="Methods.ox.html#Method___Solve">Solve</a>() function. The <a href="Methods.ox.html#VISolve">VISolve</a>() routine will do all this for you when more control of options and repeated solutions is not needed.</LI>
</UL>
<P/>
<a name="C"><LI>Run the code and see the output</LI></a>
<LI id="C">Run the code and see the output</LI>
<P/>
<DT>The program that implements the simple search model:</DT>
<DD><details><summary><a href="javascript:popoxcode('../../examples/DDP/GetStarted.ox');">examples/DDP/GetStarted.ox</a>.</summary>
Expand Down Expand Up @@ -233,7 +233,7 @@ <h1><span class="icon"><img class="icon" src="icons/file.png">&nbsp;</span><span
<P/>
</OL>
<P/>
<a name="GS1"><LI>Simulate Data and Compute the likelihood for the search problem</LI></a>
<LI id="GS1">Simulate Data and Compute the likelihood for the search problem</LI>
<P/>
<span class="n">DDP</span> knows about data, and it integrates data with solutions of the DP model in different ways. This an example is shown that discusses some of these elements.</p>
<P/>
Expand Down Expand Up @@ -357,7 +357,7 @@ <H3>A small example based on simulated data from the simple search model above</
<P/>
</OL>
<P/>
<a name="#GS2"><LI>Re-design the search model with continuous offers and reservation prices.</LI></a>
<LI id="GS2">Re-design the search model with continuous offers and reservation prices.</LI>
<P/>
<OL class="chapter">
<LI> The model is a continuous version of the <a href="#GS1">model above</a>.</LI>
Expand Down Expand Up @@ -399,7 +399,7 @@ <h4>4 functions of <code>z*</code></h4>
<object width="100%" height="200" type="application/pdf" data="../../examples/WstarTestb.pdf" border="1" >PDF</object></pre></dd>
</OL>
<P/>
<a name="#GS3"><LI>Where to go next</LI></a>
<LI id="GS3">Where to go next</LI>
<DD><a href="../../examples/replications/RustEmet1987mle.ox.html">Rust Emet 1987 mle</a> is an example of using external data.</DD>
<P/>
<dd>The program <code>/niqlow/examples/main.ox</code> is an interactive program to run examples, test code, and replications. One of the options is to run <code>GetStarted</code>, <code>GetStartedData</code> and <code>GetStartedRValues</code>. To get started with optimization of non-linear objectives, see <a href="../FiveO/GetStarted.html">FiveO/GetStarted</a>.</dd>
Expand Down
17 changes: 10 additions & 7 deletions docs/DDP/Methods.ox.html
Original file line number Diff line number Diff line change
Expand Up @@ -716,17 +716,20 @@ <h3>Details</h3>
<DD>Follow these steps at each <span class="expressions">\(t.\)</span></DD>
<OL class="steps">
<LI>For all <span class="expressions">\(\theta \in \Theta_t\)</span>:
<DD>Store the vector of action values at a single <span class="expressions">\(\epsilon_0\)</span> (e.g. the median or mean vector), <span class="expressions">\(v_0(\al,\th) = v(\al;\epsilon_0,\th)\)</span> and <span class="expressions">\(V_0(\th)=\max v_0(\al,\th).\)</span> (This is "maxE" in Keane and Wolpin 1994.)</DD>
<DD>if <span class="expressions">\(\th \in \Theta_t^S\)</span>, compute <span class="expressions">\(V\)</span> (or Emax), averaging over all values of the IID state vector <span class="expressions">\(\epsilon\)</span>:
<span class="equation">$$V(\th) = {\sum}_{\epsilon} \ \l[ {\max}_{\ \al\in A(\th)\ }\ U\l(\al;\epsilon,\th\r) + \delta E_{\al,\th\,}V\l(\thp\r)\r]\ f\l(\epsilon\r).\nonumber$$</span></DD>
<DD>Store the vector of action values at a single
<span class="expressions">\(\epsilon_0\)</span> (e.g. the median or mean vector),
<span class="expressions">\(v_0(\alpha,\theta) = v(\alpha;\epsilon_0,\theta)\)</span> and <span class="expressions">\(V_0(\theta)=\max v_0(\alpha,\theta).\)</span>
(This is "maxE" in Keane and Wolpin 1994.)</DD>
<DD>if <span class="expressions">\(\theta \in \Theta_t^S\)</span>, compute <span class="expressions">\(V\)</span> (or Emax), averaging over all values of the IID state vector <span class="expressions">\(\epsilon\)</span>: <span class="equation">$$V(\theta) = {\sum}_{\epsilon} \ \left[ {\max}_{\ \alpha\in A(\theta)\ }\ U\left(\alpha;\epsilon,\theta\right)
+ \delta E_{\alpha,\theta\,}V\left(\theta^\prime\right)\right]\ f\left(\epsilon\right).\nonumber$$</span></DD>
</LI>
<LI>Approximate <span class="expressions">\(V\)</span> on the subsample as a function of values computed at <span class="expressions">\(\epsilon_0\)</span>. The default is to run the regression:
<span class="equation">$$\hat{V}-V_0 = X\beta_t.\nonumber$$</span>
The default specification of the row of state-specific values is
<span class="equation">$$X =\l(\matrix{\l(V_0-v_0\r) & \sqrt{V_0-v_0}}\r).\nonumber$$</span>
<span class="equation">$$X =\left(\matrix{\left(V_0-v_0\right) & \sqrt{V_0-v_0}}\right).\nonumber$$</span>
That is, the difference between Emax and maxE is a non-linear function of the differences in action values at the median shock. </LI>
<LI>For <span class="expressions">\(\th \not\in \Theta^S_t,\)</span> compute <span class="expressions">\(v_0(\th),\)</span> extrapolate the approximation:
<span class="equation">$$V(\th) = \max\{ V_0(\th), V_0(\th)+X\hat\beta_t\}.\nonumber$$</span>
<LI>For <span class="expressions">\(\theta \not\in \Theta^S_t,\)</span> compute <span class="expressions">\(v_0(\theta),\)</span> extrapolate the approximation:
<span class="equation">$$V(\theta) = \max\{ V_0(\theta), V_0(\theta)+X\hat\beta_t\}.\nonumber$$</span>
</LI>
</OL>
<DD>Carry out update conditions for <span class="expressions">\(t\)</span>.</DD>
Expand Down Expand Up @@ -913,7 +916,7 @@ <h2><span class="icon"><img class="icon" src="icons/class.png">&nbsp;</span><spa
<LI value="3">Compute</LI>
<span class="equation">$$\eqalign{
\overrightarrow{\Delta}_t &\equiv Emax(V_1) - V_1\cr
g &\equiv \left(I-\delta P(\thp;\th)\right)^{-1}\left[\overrightarrow{\Delta}_t\right]\cr
g &\equiv \left(I-\delta P(\theta^\prime;\theta)\right)^{-1}\left[\overrightarrow{\Delta}_t\right]\cr
V_0 &= V_1 - g\cr}\nonumber$$</span>
</OL></div>

Expand Down
Loading

0 comments on commit 13d62c3

Please sign in to comment.