For some reason I cannot modify the post above. Let me continue here:
If the agent is employed he can either stay where they are with prob 1-\\delta_1 or move up one level with probability \\delta_1. So the logic is that if you are unemployed, your human capital depreciates stochastically, but if you are employed your human capital might stochastically increase. The movement are only + or - one grid point.
I can easily create the two transition matrices in Matlab with the following simple code:
clear,clc,close all
n = 4; % number of states
delta = 0.1; % probability of downward/upward move
%% Markov chain if unemployed (l=0)
prob_hc_l0 = (1 - delta)*eye(n) + delta*diag(ones(n-1,1), -1);
% fix bottom row so it still sums to 1
prob_hc_l0(1,:) = 0;
prob_hc_l0(1,1) = 1; % stays in state 1 if already at the bottom
disp(prob_hc_l0)
%% Markov chain if employed (l=1)
prob_hc_l1 = (1 - delta)*eye(n) + delta*diag(ones(n-1,1), 1);
% fix top row so it still sums to 1
prob_hc_l1(n,:) = 0;
prob_hc_l1(n,n) = 1; % stays in state n if already at the top
disp(prob_hc_l1)
which produces the matrix for unemployed:
1 0 0 0
0.1 0.9 0 0
0 0.1 0.9 0
0 0 0.1 0.9
and the matrix for employed
0.9 0.1 0 0
0 0.9 0.1 0
0 0 0.9 0.1
0 0 0 1
Is it possible to do this with the toolkit?
More in general, I find that the use of f_SemiExoStateFn with if conditions inside is a bit limiting, because it works only if you have a very small number of values for the semi-exogenous shocks. I think it would be nicer to allow the user to input directly the transition matrix for semiz, something like an array with 3 dimensions F(semiz,semiz’,d) or 4 dimension if it is also age-dependent F(semiz,semiz’,d,j)