I would set up a_grid using the minimum value of gamma (here 0.1) that you plan to use.
This grid will mean some points are unused with gamma=0.2, but this is not a problem, just a little bit of a waste.
(so set up a_grid using -(1-0.1)*maxh, and then use this same grid with both gamma values; toolkit is not currently capable of handling that a_grid changes with age/time-period)
Nice! I could try and finish the Chen (2010) replication if I find the time. I think his experiment is to eliminate social security as in the seminal work by Conesa and Krueger (1999)
Hi Robert, Iām currently working on a housing portfolio model with mortgage contracts. There is an additional state variable to count the remaining periods of mortgage. I wonder does TransitionPath_Case1_FHorz.m work for three state variables?
I think that the answer is yes, you can use TransitionPath_Case1_FHorz() with three endogenous states [so length(n_a)=3]. Iāve never tried.
Obviously runtimes might be an issue (might be too slow to be useful), but I guess you will find out
If it doesnāt run, let me know and I will try fix it.
What you cannot do yet is use divide and conquer (which would make it faster). Not sure if fastOLG will work or not (good odds it runs out of memory anyway; you can always try it).
PS. Iām assuming āhousing portfolio modelā does not mean using a riskysset, if it does mean using a riskyasset then you cannot currently do this in transition paths.
I used a simple model to test it. The basic model is still from Chen (2010). Besides net deposit a and housing h, I add an āidleā state variable o. It has only one grid value 0, so basically it does nothing. Households just keep choosing 0. The equilibrium prices are r and Tr. I examined the effect of change in alpha.
Here are my codes. The initial and final equilibrium have no problem but the transition path of all aggregate variables somehow become zero.
When it iterates, it has the following output:
ans =
0.0358 0.0887 NaN 0.0886
0.0355 0.0878 NaN 0.0878
0.0352 0.0870 NaN 0.0869
0.0349 0.0862 NaN 0.0861
0.0346 0.0853 NaN 0.0853
0.0343 0.0845 NaN 0.0844
0.0340 0.0837 NaN 0.0836
0.0337 0.0828 NaN 0.0827
0.0334 0.0820 NaN 0.0819
0.0331 0.0812 NaN 0.0811
0.0328 0.0803 NaN 0.0802
0.0325 0.0795 NaN 0.0794
0.0322 0.0787 NaN 0.0786
0.0319 0.0778 NaN 0.0777
0.0316 0.0770 NaN 0.0769
0.0313 0.0761 NaN 0.0761
0.0310 0.0753 NaN 0.0752
0.0307 0.0745 NaN 0.0744
0.0304 0.0736 NaN 0.0736
0.0301 0.0728 NaN 0.0727
0.0298 0.0720 NaN 0.0719
0.0295 0.0711 NaN 0.0711
0.0293 0.0703 NaN 0.0702
0.0290 0.0695 NaN 0.0694
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 NaN 0.0685
0.0287 0.0686 0.0287 0.0686
Number of iterations on transition path: 1
Current distance between old and new price path (in L-Infinity norm): 0.000089
Current distance to convergence: 0.89 (convergence when reaches 1)
Just pushed a fix to what was the problem (it didnāt actually calculate AggVars when length(n_a)=3, and so just returned all zeros).
I donāt promise this means three assets in FHorz transition path works, Iāve never tested it. But what used to be the error is now gone (maybe there is a new one, maybe not).
Number of iterations on transition path: 1
Current distance between old and new price path (in L-Infinity norm): 0.000042
Current distance to convergence: 0.42 (convergence when reaches 1)
I have another question about the price path. In my test example, the price paths converge immediately. is it normal?
No. It will only happen once the update of the transition path is less than the convergence tolerance.
If you want an easy test of whether your code likely works, try solving the transition path where ānothing happensā (initial and final eqm are the same).
Good suggestion @robertdkirkby. This is also what I always do to check the transition path.
Basically you compute only the initial steady state and then you set the final steady state equal to the initial one. Hence the guess for the interest rate path (and for other GE variables) is a constant sequence with elements equal to r_ss, the interest rate in the initial/final steady state. Then you should converge almost immediately. If not, there is a bug in the code
@robertdkirkby@aledinola Thanks for the suggestion. If I understand correctly, I should also keep alpha constant (my test model is to analyze the change of alpha), and since nothing changes, the transition path of prices (interest rate and transfer) will be horizontal lines?
Being able to solve the ānothing happensā transition path does not guarantee that your actual transition path will solve correctly, but if you cannot solve ānothing happensā then you cannot solve your actual transition path. Plus the ānothing happensā is very easy to debug because you know exactly what the answer is so you can see exactly what is going wrong.
Of course, the ānothing happensā transition path is not of any actual interest itself, just tends to be a nice way to do a first debugging of code because no matter how complex the model, you can still easily see if it is getting things correct or not. Once you know you your code solves the ānothing happensā transition path, then you can start solving the actual transition path you are interested in.