Tips for fixing a wrong StationaryDist using ExpAsset?

I have created a Life-Cycle model based on LifeCycleModel35 (portfolio choice with housing). I’ve added solarpv as an ExperienceAsset, and I’ve modified my decision variable to choose between:

% buyhouse decisions
%  0=no house
%  1=buy house w/o pv this period
%  2=buy house w/ pv this period
%  3=keep house; no pv upgrade
%  4=keep house; pv upgrade (if possible)

And I’ve modified the return function to model costs of energy, pv electricity generation, and I’ve modified the aprime function to update the solarpv experience asset as houses are bought, kept, and pv installations are activated. It produces plots that comport with my expectations.

I then ported the salient features of the Life-Cycle problem that into the household part of OLGModel14 (households and firms), with households now being able to purchase houses and solarpv in addition to shares in firms.

What I’m seeing is that StationaryDist_FHorz_Iteration_e_raw evolves a Stationary Distribution that starts rich (at age jj=1 there are 45 nonzero terms, at age jj=2 there are 360 nonzero terms, and at age jj=3 there are 495 nonzero terms, and so on).

However, StationaryDist_FHorz_Iteration_nProbs_e_raw evolves a Stationary Distribution that only ever has 21 nonzero terms, and they are the 21 columns (7 z, 3 e) in the top row. We know that a Stationary Distribution that has values only in the top row is never going to mix.

I think it is as likely as not that my own code is the source of the problem, not the toolkit. The key iterative step in the toolkit begins with:

% First, get Gamma
    Gammatranspose=sparse(Policy_aprimez(:,:,jj),II2,PolicyProbs(:,:,jj),N_a*N_z,N_a*N_z*N_e); % Note: sparse() will accumulate at repeated indices

My question is: how should I query Gammatranspose, Policy_aprimez, II2, and/or PolicyProbs to determine which one has been poisoned, and how I might trace that back to my model’s construction?

The answer to my question is: evaluate the ReturnFn for a number of initial parameters.

In my case, the full labor allocation (1.0) at the full wage (1.0) less various initial condition costs did not yield a large enough number to invest in any of the next-state actions (buy shares, buy a house, or bank assets). This is in part because I cannot yet use gridinterplayer and the grids I’m using were too coarse.

By increasing the fundamental wage (to 2.0) and reshaping the grids somewhat, workers at the beginning of their lifecycle can enter the economy by banking small amounts of assets that build to large enough amounts they can make other choices (buying shares, buying houses, etc).

So I’m creating some test functions that tell me whether my initial conditions block economic entry.

A related question: to what extent is it my responsibility to validate that the Stationary Distribution (SD) doesn’t have a dead-end, vs. the toolkit observing such and saying “no valid transitions possible”?

It seems that even in models, debt can become a pit from which there is no escape…

If you look at the the policy function (e.g., ‘Policy’) and the exogenous shock transitions (e.g., ‘pi_z’ if you have markov shocks) then these two together are what determine the stationary distribution.

So it tends to be a good idea to take a look at the contents of Policy (I typically first use PolicyInd2Vals… commands to switch to PolicyVals and plot those) before you go on to doing the stationary distribution. Something like plotting some slices of PolicyVals to get an idea what decisions are being made (in given situtations/parts of the state space) and whether these seem plausible.

[From a theory perspective, the policy function and exogenous shock transition probabilities together define a markov process on the (endo state,exo state) space, and we then just work with this to get the stationary distribution. Hence why looking at policy fn and exogenous shock transition matrix is the relevant things to check to see what is going on.]

[Is a little more complicated if you have, e.g., an experienceasset as now it is the policy fn together with the ‘aprimeFn’ that determine next period endogenous state.]

1 Like

Thank you for that. I’m now doing feasibility testing after the first VFI…no need to hassle with the Stationary Distribution for that.