Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial condition for stationary distribution of LSS with a constant term #201

Open
jlperla opened this issue Jan 30, 2018 · 3 comments
Open

Comments

@jlperla
Copy link
Member

jlperla commented Jan 30, 2018

A couple of students were having trouble with the LSS model and calling stationary_distributions because they hadn't created it with an initial condition. So the following works

using QuantEcon
A1 = 0.6;
a = 1.0
A = [A1 a; 0 1]
C1 = 4
C = [C1;0]
G = [1 0]
x_0 = [0; 1.0] #Important that the initial condition is in the correct place!
lss = LSS(A, C, G; mu_0 = x_0)
#If you look at the notes and the documents, it says you need an initial condition
μ_x, μ_y, Σ_x, Σ_y = stationary_distributions(lss)

But changing it to lss = LSS(A, C, G) does not

The issue is that the code doesn't warn them that this wouldn't work and doesn't correct the default initial condition (which I assume is just 0s)?

So, is there any way to either warn them that this is not kosher with a constant term, or (even better!) adjust the default initial condition to include the constants? You are already detecting the constant terms with the remove_constants(lss) function?

@jlperla
Copy link
Member Author

jlperla commented Feb 9, 2018

Just an update on this: this caused a great deal of confusion in the assignments for people when the state space had a constant term. Also, using the initial prior mean for the initial condition of the stationary distribution algorithm is a little hard to understand for some. I think that adjusting the default initial condition for the steady state algorithm to put in any of the constant terms would help a great deal with that confusion.

@jstac
Copy link
Contributor

jstac commented Feb 9, 2018

I didn't fully understand the second comment but certainly it should be possible to call stationary_distributions after lss = LSS(A, C, G) .

In fact I would have thought we should be computing these stationary moments with linear algebra routines rather than iteratively. The expressions are available here:

https://lectures.quantecon.org/jl/linear_models.html

For the variance-covariance matrices we should be using solve_discrete_lyapunov from this package.

@jlperla
Copy link
Member Author

jlperla commented Feb 9, 2018

Great, I think that calling stationary_distributions on LSS(A, C, G) directly would be great (and I think it is easy enough to do since you are already identifying constant. My second comment was that it was tricky for them to understand that optional parameter called mu_0 was the initial condition for the solution to the stationary_distributions.

For a user, the nice thing about the iterative method instead of solving the lyapunov directly is that it works for a state space with the constant term in it. That way they don't need to do the transformation to a state space representation that removes the constant term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants