You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lectures/imp_sample.md
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ import matplotlib.pyplot as plt
36
36
from math import gamma
37
37
```
38
38
39
-
## Mathematical Expectation of Likelihood Ratio
39
+
## Mathematical expectation of likelihood ratio
40
40
41
41
In {doc}`this lecture <likelihood_ratio_process>`, we studied a likelihood ratio $\ell \left(\omega_t\right)$
42
42
@@ -57,11 +57,10 @@ $$
57
57
Our goal is to approximate the mathematical expectation $E \left[ L\left(\omega^t\right) \right]$ well.
58
58
59
59
In {doc}`this lecture <likelihood_ratio_process>`, we showed that $E \left[ L\left(\omega^t\right) \right]$ equals $1$ for all $t$.
60
+
60
61
We want to check out how well this holds if we replace $E$ by with sample averages from simulations.
61
62
62
-
This turns out to be easier said than done because for
63
-
Beta distributions assumed above, $L\left(\omega^t\right)$ has
64
-
a very skewed distribution with a very long tail as $t \rightarrow \infty$.
63
+
This turns out to be easier said than done because for Beta distributions assumed above, $L\left(\omega^t\right)$ has a very skewed distribution with a very long tail as $t \rightarrow \infty$.
65
64
66
65
This property makes it difficult efficiently and accurately to estimate the mean by standard Monte Carlo simulation methods.
Since we must use an $h$ that has larger mass in parts of the distribution to which $g$ puts low mass, we use $h=Beta(0.5, 0.5)$ as our importance distribution.
162
161
@@ -178,7 +177,7 @@ plt.ylim([0., 3.])
178
177
plt.show()
179
178
```
180
179
181
-
## Approximating a Cumulative Likelihood Ratio
180
+
## Approximating a cumulative likelihood ratio
182
181
183
182
We now study how to use importance sampling to approximate
@@ -252,13 +251,13 @@ The Monte Carlo method underestimates because the likelihood ratio $L(\omega^T)
252
251
253
252
Most samples from $g$ produce small likelihood ratios, while the true mean requires occasional very large values that are rarely sampled.
254
253
255
-
In our case, since $g(\omega) \to 0$ as $\omega \to 0$ while $f(\omega)$ remains bounded, the Monte Carlo procedure undersamples precisely where the likelihood ratio $\frac{f(\omega)}{g(\omega)}$ is largest.
254
+
In our case, since $g(\omega) \to 0$ as $\omega \to 0$ while $f(\omega)$ remains constant, the Monte Carlo procedure undersamples precisely where the likelihood ratio $\frac{f(\omega)}{g(\omega)}$ is largest.
256
255
257
256
As $T$ increases, this problem worsens exponentially, making standard Monte Carlo increasingly unreliable.
258
257
259
258
Importance sampling with $q = h$ fixes this by sampling more uniformly from regions important to both $f$ and $g$.
260
259
261
-
## Distribution of Sample Mean
260
+
## Distribution of sample mean
262
261
263
262
We next study the bias and efficiency of the Monte Carlo and importance sampling approaches.
264
263
@@ -333,17 +332,15 @@ The simulation exercises above show that the importance sampling estimates are u
333
332
334
333
Evidently, the bias increases with increases in $T$.
335
334
336
-
## Choosing a Sampling Distribution
335
+
## Choosing a sampling distribution
337
336
338
337
+++
339
338
340
339
Above, we arbitraily chose $h = Beta(0.5,0.5)$ as the importance distribution.
341
340
342
341
Is there an optimal importance distribution?
343
342
344
-
In our particular case, since we know in advance that $E_0 \left[ L\left(\omega^t\right) \right] = 1$.
345
-
346
-
We can use that knowledge to our advantage.
343
+
In our particular case, since we know in advance that $E_0 \left[ L\left(\omega^t\right) \right] = 1$, we can use that knowledge to our advantage.
$E\left[L\left(w^{t}\right)\bigm|q=g\right]=1$ for all
265
265
$t \geq 1$.
266
266
267
-
## Peculiar Property
267
+
## Peculiar property
268
268
269
269
How can $E\left[L\left(w^{t}\right)\bigm|q=g\right]=1$ possibly be true when most probability mass of the likelihood
270
270
ratio process is piling up near $0$ as
@@ -300,7 +300,7 @@ We explain the problem in more detail in {doc}`this lecture <imp_sample>`.
300
300
There we describe an alternative way to compute the mean of a likelihood ratio by computing the mean of a _different_ random variable by sampling from a _different_ probability distribution.
301
301
302
302
303
-
## Nature Permanently Draws from Density f
303
+
## Nature permanently draws from density f
304
304
305
305
Now suppose that before time $0$ nature permanently decided to draw repeatedly from density $f$.
Let the random variable $s_t \in (0,1)$ at time $t =0, 1, 2, \ldots$ be distributed according to the same Beta distribution with parameters
172
172
$\theta = \{\theta_1, \theta_2\}$.
@@ -195,7 +195,7 @@ $$c^1(s_t) = y_t^1 = s_t. $$
195
195
196
196
But in our model, agent 1 is not alone.
197
197
198
-
## Nature and Agents' Beliefs
198
+
## Nature and agents' beliefs
199
199
200
200
Nature draws i.i.d. sequences $\{s_t\}_{t=0}^\infty$ from $\pi_t(s^t)$.
201
201
@@ -239,7 +239,7 @@ $$
239
239
c_t^1 + c_t^2 = 1 .
240
240
$$
241
241
242
-
## A Socialist Risk-Sharing Arrangement
242
+
## A socialist risk-sharing arrangement
243
243
244
244
In order to share risks, a benevolent social planner dictates a history-dependent consumption allocation that takes the form of a sequence of functions
245
245
@@ -284,7 +284,7 @@ $$ (eq:objectiveagenti)
284
284
where $\delta \in (0,1)$ is an intertemporal discount factor, and $u(\cdot)$ is a strictly increasing, concave one-period utility function.
285
285
286
286
287
-
## Social Planner's Allocation Problem
287
+
## Social planner's allocation problem
288
288
289
289
The benevolent dictator has all the information it requires to choose a consumption allocation that maximizes the social welfare criterion
290
290
@@ -305,45 +305,12 @@ This means that the social planner knows and respects
305
305
306
306
Consequently, we anticipate that these objects will appear in the social planner's rule for allocating the aggregate endowment each period.
307
307
308
-
The Lagrangian for the social planner's problem is
Now for the competitive equilibrium, notice that if we take $\mu_1 = \frac{1}{\lambda}$ and $\mu_2 = \frac{1}{1-\lambda}$, formula {eq}`eq:allocationce` agrees with formula {eq}`eq:allocationrule1`, and we get from {eq}`eq:priceequation1`
Let's compute some values of limiting allocations {eq}`eq:allocationrule1` for some interesting possible limiting
@@ -429,7 +396,7 @@ Doing this will allow us to connect our analysis with an argument of {cite}`alch
429
396
430
397
431
398
432
-
## Competitive Equilibrium Prices
399
+
## Competitive equilibrium prices
433
400
434
401
Two fundamental welfare theorems for general equilibrium models lead us to anticipate that there is a connection between the allocation that solves the social planning problem we have been studying and the allocation in a **competitive equilibrium** with complete markets in history-contingent commodities.
435
402
@@ -555,6 +522,9 @@ According to formula {eq}`eq:pformulafinal`, we have the following possible limi
555
522
* when $l_\infty = \infty$, $c_\infty^1 = 1 $ and tails of competitive equilibrium prices reflect agent $1$'s probability model $\pi_t^1(s^t)$ according to $p_t(s^t) \propto \delta^t \pi_t^1(s^t) $
556
523
* for small $t$'s, competitive equilibrium prices reflect both agents' probability models.
557
524
525
+
We leave the verification of the shadow prices to the reader since it follows from
526
+
the same reasoning.
527
+
558
528
## Simulations
559
529
560
530
Now let's implement some simulations when agent $1$ believes marginal density
@@ -850,7 +820,7 @@ This ties in nicely with {eq}`eq:kl_likelihood_link`.
850
820
851
821
852
822
853
-
## Related Lectures
823
+
## Related lectures
854
824
855
825
Complete markets models with homogeneous beliefs, a kind often used in macroeconomics and finance, are studied in this quantecon lecture {doc}`ge_arrow`.
0 commit comments