03.06.2016 Views

Download PDF - Ivie

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Algorithm 1 Stochastic simulation<br />

1: Define a grid K over capital, K = (k 1 , ..., k N )<br />

2: Pick initial realization of the aggregate shock ã 0 , initial approximation ˆψ 0 (k ′ , e, a), and<br />

initial distribution λ 1 (k, e|a).<br />

3: Pick tolerance ε, maximum number of neighbors M, and lookback window parameter<br />

m(t), e.g. m(t) = 0.1t<br />

4: Initialize t ← 1, Ψ 0 ← ∅<br />

5: repeat<br />

6: for all possible values of the aggregate state a ∈ {a b , a g } and corresponding capital<br />

distribution λ t (·, ·|a) do<br />

7: Compute aggregate capital K ← ∑ k∈K [λ t(k, 0|a) + λ t (k, 1|a)]k<br />

8: Compute state-dependent wage w(K, a) and interest rate r(K, a)<br />

9: Search Ψ t−1 for M nearest realizations {t 1 , ..., t M }, i.e. find the largest M ≤ M<br />

and {t j } M j=1 ⊂ (t − m(t), ..., t − 2), such that ∀j = 1...M, a tj = a, and d(λ t , λ tj ) ≤<br />

d(λ t , λ τ ) ∀τ /∈ {t 1 , ..., t M }.<br />

10: for all possible values of the individual state e ∈ {0, 1} and capital k ∈ K do<br />

11: Compute ˆψ ∑<br />

t (k ′ , e, a, λ t ) ← 1 M ˜ψ M j=1 tj ((k ′ , e, ã tj , ˜λ tj )), k ′ ∈ K if M > 0, or otherwise<br />

set ˆψ t ← ˆψ 0<br />

12: Solve the optimization problem (9) using ˆψ t in place of ψ, and determine k t(k, ′ e, a)<br />

and V t (k, e, a)<br />

13: end for<br />

14: end for<br />

15: Compute ˜ψ t−1 ← E{V t (k t , e t , a t )|e t−1 , ã t−1 }, using the Markov transition matrix<br />

π(a ′ , e ′ |a, e)<br />

16: Compute discrepancy ε t−1 ← max k,e | ˆψ t−1 (k, e, ã t−1 ) − ˜ψ t−1 (k, e, ã t−1 )|<br />

17: Add an observation (λ t−1 , ã t−1 , ˜ψ t−1 ) to the lookup table: Ψ t ← Ψ t−1 ∪(λ t−1 , ã t−1 , ˜ψ t−1 )<br />

18: Generate the current realization of the aggregate shock ã t according to π(a t |ã t−1 )<br />

19: Using the policy function k t(k, ′ e, a) found in step 12, compute the next period capital<br />

distribution λ t+1 (k t+1 , e t+1 , a t+1 ) for all (e t+1 , a t+1 ) and k t+1 ∈ K<br />

20: advance t ← t + 1<br />

21: until max t−T0 ≤τ≤t−1 ε τ < ε<br />

Algorithm 2 Stochastic simulation with temporal-difference adjustment<br />

1: Select the temporal difference update factor 0 ≤ α TD ≤ 1<br />

2: Initialize M ′ ← 0<br />

3: Proceed with steps 1 - 17 of Algorithm 1<br />

4: if t > 1 and M ′ > 0, for each of the nearest neighbors of period (t − 1), τ 1 , ..., τ M ′,<br />

perform an adjustment: ˜ψτj ← (1 − α TD ) ˜ψ τj + α TD ˜ψt−1 (k, e, ã t−1 )<br />

5: Save M ′ ← M and {τ j } ← {t j }, j = 1...M<br />

6: Proceed with the remaining steps of Algorithm 1 until completion<br />

20<br />

22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!