EconForge / dolark.py

2 stars 12 forks source link

Age varying magnitudes #13

Closed sbenthall closed 4 years ago

sbenthall commented 4 years ago

@llorracc :

Finite Horizons specification of the SolvingMicroDSOPs life cycle model that has age-varying magnitudes of transitory and permanent shocks, income growth, and other inputs

A key question here is whether or not age can be considered an endogenous state. If implemented in a naive way, this is impractical, as it creates an expanded, sparse state space:

If we want to solve a life cycle problem where the maximum span of life is 120 years (when you reach age 120, probability of death becomes 100 percent), then a symmetric matrix would require the specification of a matrix of size 120 by 120 (for the annual version) to capture the probability that a person who is age 1 transitions to age 119. Of course that probability is zero -- and indeed the matrix is entirely empty except for a single entry in each row, which determines that the probability of transitioning to the next age is 1.

One possibility is to allow the user to write 120 YAML files, one for each age of the agent, and to solve them each in sequence.

Speaking personally, I have the conviction that there is a more succinct way to represent this problem in YAML, such that if necessary, the compiler could expand the succinct representation into the sequence of problems.

One idea: at the top of a dolang YAML file is a list of symbols, grouped by their symbol type, e.g:

symbols:
    states: [a]
    exogenous: [e]
    parameters: [β, γ, ρ, σ, w, r]

What if there were an additional type of symbol, with some additional or constraint semantics. The simplest way would be to include something like:

symbols:
    states: [a]
    age: [t]
    exogenous: [e]
    parameters: [β, γ, ρ, σ, w, r]

Then in the functions definition, there could be a definition of a function that determines the transitioning of the age variable. And, later, a specification of its domain:

equations:
...
  aging:
    - t = t(-1) + 1

domain:
  ...
  t: [0, 120]

When the model gets compiled, the age variables are treated differently as a preprocessing step: the sequence of transitions is computed in advance for the entire domain of the age variable, and then sub-problems are created in which the variable t has a fixed value.

This is just one possible implementation.

(originally discussed here: https://github.com/econ-ark/DARKolo/issues/14 )

albop commented 4 years ago

It seems to me this is should be a dolo issue rather than a dolark one. To be me this particular example can we dealt with without syntax change, just by adding a new kind of exogenous process and possibly indicator functions. Some form of age dependence can be added without changing the syntax :

sbenthall commented 4 years ago

Ah, interesting.

Forgive me: I'm not familiar enough with the intentions here to know what is in dolo scope, and what is in dolark scope. I'll defer to you on that.

I forgot when writing this that exogenous variables in dolo could be processes, and that this means a parameter that changes with time can be isolated from the state space. Of course!

Would it be possible to point me to the syntax candidates for dolo? Is there a process by which you are collecting them? I'd like to refer @llorracc to them, as he has prioritized this issue.