Parameters that depend on age and on fixed type

If I have a parameter that depends both on age and on permanent type (assume N_i is a scalar integer denoting the number of types, not a cell array of strings with names), can I define it as a matrix where 1st dim is type and the 2nd dimension is age?

I know that if I assign names to the types, N_i = {‘low’,‘high’}, I can define the parameter as

Params.kappaj.low = row vector
Params.kappaj.high = another row vector

but I don’t want to declare the names, since I have several types and dealing with names become cumbersome

Thanks in advance!

2 Likes

Yes, you should just be able to set, e.g., Params.alpha so be a matrix of size N_i-by-N_j (or N_j-by-N_i, the codes shouldn’t care).

Probably worth just running LifeCycleProfiles for a FnsToEvaluate that just returns that parameter and check that the conditional-on-ptype-and-age all look correct.

Internally, the permanent type codes look at Params, and if a dimension is N_i then it slices that up for each permanent type, but then other dimensions of the parameter should just go through to sub-commands unchanged (whether it is just 1, or N_j).

2 Likes

It works well. I defined a parameter to be of size [N_i,N_j] inside the semiexo function (for the transition probability of the semiexogenous shock) and the toolkit treated that in the correct way.

I haven’t tested the case of a parameter dependent on both age and the permanent type in either the Return Function or any of the Functions to Evaluate.

However, I think the toolkit always uses the same function to extract the relevant parameters from the structure Params and put them in the cell array ParamCell. Therefore, if it works with the semiexo function, it should work with the others as well.

2 Likes

Yeah, the handling of parameters dependence on permanent type is always done prior to their use in return fn/fns to evaluate/semi-exo shocks/etc. The code is copy-pasted between the various commands so should just work in all cases if it works in one.

1 Like