lecture-python.myst icon indicating copy to clipboard operation
lecture-python.myst copied to clipboard

[lake_model] Comments

Open oyamad opened this issue 3 years ago • 2 comments

  • This part https://github.com/QuantEcon/lecture-python.myst/blame/main/lectures/lake_model.md#L260-L274 is not very wise (computing the stationary distribution of a 2-state (column-)stochastic matrix by iteration). As shown in the Finite Markov Chains chapter, and to be discussed in the current chapter, it can be simply computed exactly (up to floating points errors) by

    def rate_steady_state(self):
        x = np.array([self.A_hat[0, 1], self.A_hat[1, 0]])
        return x / x.sum()
    
  • The discussion in "Aggregate Dynamics": This part is hard to read. The same discussion as in "Finite Markov Chains" is given in a different language without any indication: From the discussion in "Finite Markov Chains", we know that

    • the (column-)stochastic matrix A_hat has a stationary distribution (or equivalently, it has a nonnegative eigenvector with eigenvalue one); and
    • A_hat being (irreducible and) aperiodic (or equivalently, the other eigenvalues are less than one in magnitude), from any initial distribution we have convergence to the (unique) stationary distribution.

    In my view, this new language (with eigenvalues) is not necessary, and it would be enough to refer to the previous discussion in "Finite Markov Chains" (as to be done below).

  • There are a few places where the inner product of two vectors (1d-ndarrays) a and b is computed by

    np.sum(a * b)
    

    instead of

    a @ b
    

    Is there any purpose for this?

oyamad avatar Jul 18 '21 05:07 oyamad

Thanks @oyamad . I agree. I'll fix this when I get some time.

jstac avatar Jul 19 '21 09:07 jstac

Thanks @jstac and @oyamad .

My comment on point 1 is that It is a smart change that makes the most of the analytical solution of the stationary distribution of the Markov chain when the stochastic matrix is positive.

For example, let the stochastic matrix be

$$ P = \left( \begin{matrix} 1 - \lambda & \lambda \ \alpha & 1 - \alpha \end{matrix} \right) $$

if $\alpha \in (0, 1)$ and $\lambda \in (0, 1)$, then $P$ has a unique stationary distribution.

However it cannot handle the case when $\alpha$ or $\lambda$ takes the boundary values, that is, $\alpha, \lambda$ takes $0, 1$.

I suggest that we turn this change or the original one into an exercise.

shlff avatar Jul 11 '23 00:07 shlff