1 Small Test Exact Solution Vectorized Bisection

This is the example vignette for function: snw_vfi_main_bisec_vec from the PrjOptiSNW Package. This function solves for policy function with vectorized bisection. Small Solution Analysis. Small Solution Analysis, husband 5 shocks, wife 1 shocks.

1.1 Test SNW_VFI_MAIN Defaults Small

Call the function with defaults parameters.

mp_param = snw_mp_param('default_small');
[V_VFI,ap_VFI,cons_VFI,mp_valpol_more] = snw_vfi_main_bisec_vec(mp_param);

SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:18 of 17, time-this-age:0.06059
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:17 of 17, time-this-age:0.052828
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:16 of 17, time-this-age:0.032745
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:15 of 17, time-this-age:0.029085
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:14 of 17, time-this-age:0.035583
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:13 of 17, time-this-age:0.034991
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:12 of 17, time-this-age:0.033648
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:11 of 17, time-this-age:0.032963
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:10 of 17, time-this-age:0.033174
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:9 of 17, time-this-age:0.036843
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:8 of 17, time-this-age:0.04052
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:7 of 17, time-this-age:0.028633
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:6 of 17, time-this-age:0.035108
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:5 of 17, time-this-age:0.033838
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:4 of 17, time-this-age:0.033585
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:3 of 17, time-this-age:0.03214
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:2 of 17, time-this-age:0.028888
SNW_VFI_MAIN_BISEC_VEC: Finished Age Group:1 of 17, time-this-age:0.031611
Completed SNW_VFI_MAIN_BISEC_VEC;SNW_MP_PARAM=default_small;SNW_MP_CONTROL=default_base;time=0.72345

1.2 Small Param Results Define Frames

Define the matrix dimensions names and dimension vector values. Policy and Value Functions share the same ND dimensional structure.

% Grids:
age_grid = [19, 22:5:97, 100];
agrid = mp_param('agrid')';
eta_H_grid = mp_param('eta_H_grid')';
eta_S_grid = mp_param('eta_S_grid')';
ar_st_eta_HS_grid = string(cellstr([num2str(eta_H_grid', 'hz=%3.2f;'), num2str(eta_S_grid', 'wz=%3.2f')]));
edu_grid = [0,1];
marry_grid = [0,1];
kids_grid = (1:1:mp_param('n_kidsgrid'))';
% NaN(n_jgrid,n_agrid,n_etagrid,n_educgrid,n_marriedgrid,n_kidsgrid);
cl_mp_datasetdesc = {};
cl_mp_datasetdesc{1} = containers.Map({'name', 'labval'}, {'age', age_grid});
cl_mp_datasetdesc{2} = containers.Map({'name', 'labval'}, {'savings', agrid});
cl_mp_datasetdesc{3} = containers.Map({'name', 'labval'}, {'Hshock', eta_H_grid});
cl_mp_datasetdesc{4} = containers.Map({'name', 'labval'}, {'edu', edu_grid});
cl_mp_datasetdesc{5} = containers.Map({'name', 'labval'}, {'marry', marry_grid});
cl_mp_datasetdesc{6} = containers.Map({'name', 'labval'}, {'kids', kids_grid});

1.3 Analyze Savings and Shocks

First, analyze Savings Levels and Shocks, Aggregate Over All Others, and do various other calculations.

% Generate some Data
mp_support_graph = containers.Map('KeyType', 'char', 'ValueType', 'any');
mp_support_graph('cl_st_xtitle') = {'Savings States, a'};
mp_support_graph('st_legend_loc') = 'best';
mp_support_graph('bl_graph_logy') = true; % do not log

MEAN(VAL(A,Z)), MEAN(AP(A,Z)), MEAN(C(A,Z))

Tabulate value and policies along savings and shocks:

% Set
% NaN(n_jgrid,n_agrid,n_etagrid,n_educgrid,n_marriedgrid,n_kidsgrid);
ar_permute = [1,4,5,6,3,2];
% Value Function
tb_az_v = ff_summ_nd_array("MEAN(VAL(A,Z))", V_VFI, true, ["mean"], 4, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(VAL(A,Z))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group     savings     mean_Hshock__1_8395    mean_Hshock__0_91976    mean_Hshock_0    mean_Hshock_0_91976    mean_Hshock_1_8395
    _____    _________    ___________________    ____________________    _____________    ___________________    __________________

      1              0          -21.426                 -13.175              -8.362             -5.4972                -3.9407     
      2      0.0097656          -20.989                 -13.027             -8.2755             -5.4264                 -3.874     
      3       0.078125          -18.901                 -12.204             -7.8053             -5.0563                -3.5316     
      4        0.26367          -15.612                 -10.744             -7.0124             -4.4893                 -3.033     
      5          0.625          -12.124                 -8.9835             -6.0664             -3.8998                -2.5588     
      6         1.2207          -9.0979                 -7.2177             -5.0967             -3.3546                -2.1657     
      7         2.1094          -6.7401                 -5.6532             -4.2107             -2.8614                -1.8516     
      8         3.3496          -4.9967                 -4.3739             -3.4359             -2.4175                -1.5968     
      9              5          -3.7353                 -3.3758             -2.7788             -2.0342                -1.3834     
     10         7.1191          -2.8279                  -2.617             -2.2393             -1.7115                -1.1997     
     11         9.7656           -2.172                 -2.0455             -1.8057             -1.4379                -1.0388     
     12         12.998           -1.693                 -1.6153             -1.4614             -1.2066               -0.89932     
     13         16.875          -1.3389                 -1.2899             -1.1896             -1.0131               -0.77961     
     14         21.455          -1.0737                  -1.042            -0.97552            -0.85247               -0.67683     
     15         26.797           -0.872                -0.85104            -0.80614            -0.71965               -0.58803     
     16         32.959         -0.71656                -0.70236            -0.67148            -0.61005               -0.51138     
     17             40         -0.59521                -0.58538            -0.56375             -0.5196                -0.4454     
     18         47.979         -0.49932                -0.49238            -0.47697            -0.44484               -0.38876     
     19         56.953         -0.42266                -0.41768            -0.40651            -0.38285                -0.3402     
     20         66.982         -0.36074                 -0.3571            -0.34889            -0.33125               -0.29857     
     21         78.125         -0.31022                -0.30751            -0.30139            -0.28809               -0.26288     
     22         90.439         -0.26861                -0.26658            -0.26196            -0.25181               -0.23222     
     23         103.98         -0.23407                -0.23252            -0.22899            -0.22118               -0.20583     
     24         118.82         -0.20516                -0.20397            -0.20125            -0.19517               -0.18307     
     25            135          -0.1808                -0.17987            -0.17775            -0.17298               -0.16337     

% Aprime Choice
tb_az_ap = ff_summ_nd_array("MEAN(AP(A,Z))", ap_VFI, true, ["mean"], 4, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(AP(A,Z))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group     savings     mean_Hshock__1_8395    mean_Hshock__0_91976    mean_Hshock_0    mean_Hshock_0_91976    mean_Hshock_1_8395
    _____    _________    ___________________    ____________________    _____________    ___________________    __________________

      1              0        3.2159e-05              0.0034995            0.049878             0.24382               0.89303      
      2      0.0097656        0.00055365              0.0052722            0.053281             0.24787               0.89865      
      3       0.078125          0.021863               0.029676            0.083029              0.2805               0.93962      
      4        0.26367           0.13323                0.14751             0.20012             0.38877                 1.059      
      5          0.625           0.39134                0.41034             0.45315             0.64573                1.3086      
      6         1.2207           0.84131                0.86393             0.91226              1.0928                 1.745      
      7         2.1094            1.5303                 1.5542              1.6156              1.7559                2.3963      
      8         3.3496            2.4876                 2.5118               2.573              2.6876                3.3398      
      9              5            3.7642                 3.7887              3.8498              3.9922                 4.592      
     10         7.1191            5.4275                 5.4525              5.5145              5.6929                6.1933      
     11         9.7656            7.4794                 7.5043              7.5679              7.7532                8.1877      
     12         12.998            9.9124                 9.9329              9.9956              10.186                10.627      
     13         16.875            12.928                  12.95              13.005              13.196                13.715      
     14         21.455            16.529                 16.548              16.604              16.783                17.374      
     15         26.797            20.601                 20.618              20.668              20.837                21.462      
     16         32.959            25.307                 25.325               25.37              25.525                26.151      
     17             40            30.667                 30.689              30.742              30.886                31.487      
     18         47.979            36.761                 36.782              36.841              36.999                37.562      
     19         56.953            43.773                 43.795              43.847              44.012                 44.56      
     20         66.982            51.605                 51.628              51.688               51.85                52.402      
     21         78.125            59.954                 59.977              60.037              60.209                60.766      
     22         90.439            69.265                 69.288               69.35              69.526                70.095      
     23         103.98             79.75                 79.771              79.831              80.004                80.583      
     24         118.82            91.112                 91.136              91.198              91.364                91.939      
     25            135            103.47                 103.49              103.54              103.72                104.29      

% Consumption Choices
tb_az_c = ff_summ_nd_array("MEAN(C(A,Z))", cons_VFI, true, ["mean"], 4, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(C(A,Z))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group     savings     mean_Hshock__1_8395    mean_Hshock__0_91976    mean_Hshock_0    mean_Hshock_0_91976    mean_Hshock_1_8395
    _____    _________    ___________________    ____________________    _____________    ___________________    __________________

      1              0          0.30273                0.43104              0.68779             1.2165                 2.3366      
      2      0.0097656          0.31374                0.44074              0.69581             1.2239                 2.3424      
      3       0.078125          0.37308                0.49663              0.74605              1.271                 2.3812      
      4        0.26367          0.48039                0.59659                0.846             1.3793                 2.4781      
      5          0.625          0.64735                0.75745               1.0153             1.5439                 2.6497      
      6         1.2207          0.89649                 1.0013               1.2519             1.7913                 2.9071      
      7         2.1094           1.2479                 1.3498               1.5854             2.1634                 3.2903      
      8         3.3496           1.7393                 1.8394               2.0734             2.6754                 3.7896      
      9              5           2.3872                 2.4859               2.7182             3.2909                 4.4564      
     10         7.1191           3.1917                  3.289               3.5191             4.0542                 5.3181      
     11         9.7656           4.2188                 4.3155                4.543               5.07                 6.3986      
     12         12.998           5.5439                 5.6447               5.8722             6.3933                 7.7142      
     13         16.875           7.0334                  7.133               7.3676             7.8866                 9.1285      
     14         21.455            8.754                 8.8551               9.0887             9.6188                 10.789      
     15         26.797           10.886                 10.989               11.228             11.768                 12.903      
     16         32.959           13.336                 13.439               13.682             14.235                 15.368      
     17             40           16.151                 16.249               16.485             17.049                 18.207      
     18         47.979           19.321                  19.42                19.65               20.2                 21.395      
     19         56.953           22.728                 22.827               23.062             23.605                 24.816      
     20         66.982           26.539                 26.637               26.865              27.41                 28.616      
     21         78.125           31.125                 31.222               31.451             31.986                 33.187      
     22         90.439            36.11                 36.207               36.433             36.965                 38.154      
     23         103.98           41.348                 41.447               41.676              42.21                 43.389      
     24         118.82           47.206                 47.302               47.528              48.07                 49.252      
     25            135           53.636                 53.735               53.966             54.501                 55.689      

Graph Mean Values:

mp_support_graph('cl_st_graph_title') = {'MEAN(value(a,z)), a=x, z=color'};
mp_support_graph('cl_st_ytitle') = {'MEAN(value(a,z))'};
ff_graph_grid((tb_az_v{1:end, 3:end})', ar_st_eta_HS_grid, agrid, mp_support_graph);

Graph Mean Savings Choices:

mp_support_graph('cl_st_graph_title') = {'MEAN(APRIME(a,z)), a=x, z=color'};
mp_support_graph('cl_st_ytitle') = {'MEAN(APRIME(a,z))'};
ff_graph_grid((tb_az_ap{1:end, 3:end})', ar_st_eta_HS_grid, agrid, mp_support_graph);

Graph Mean Consumption:

mp_support_graph('cl_st_graph_title') = {'MEAN(C(a,z)), a=x, z=color'};
mp_support_graph('cl_st_ytitle') = {'MEAN(C(a,z))'};
ff_graph_grid((tb_az_c{1:end, 3:end})', ar_st_eta_HS_grid, agrid, mp_support_graph);

1.4 Analyze Kids and Marriage and Age

Aggregating over education, savings, and shocks, what are the differential effects of Marriage and Age.

% Generate some Data
mp_support_graph = containers.Map('KeyType', 'char', 'ValueType', 'any');
ar_row_grid = ["k0M0", "K1M0", "K2M0", "k0M1", "K1M1", "K2M1"];
mp_support_graph('cl_st_xtitle') = {'Age'};
mp_support_graph('st_legend_loc') = 'best';
mp_support_graph('bl_graph_logy') = true; % do not log
mp_support_graph('st_rounding') = '6.2f'; % format shock legend
mp_support_graph('cl_scatter_shapes') = { 'o', 'd' ,'s', 'o', 'd', 's'};
mp_support_graph('cl_colors') = {'red', 'red', 'red', 'blue', 'blue', 'blue'};

MEAN(VAL(KM,J)), MEAN(AP(KM,J)), MEAN(C(KM,J))

Tabulate value and policies:

% Set
% NaN(n_jgrid,n_agrid,n_etagrid,n_educgrid,n_marriedgrid,n_kidsgrid);
ar_permute = [2,3,4,1,6,5];
% Value Function
tb_az_v = ff_summ_nd_array("MEAN(VAL(KM,J))", V_VFI, true, ["mean"], 3, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(VAL(KM,J))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group    kids    marry    mean_age_19    mean_age_22    mean_age_27    mean_age_32    mean_age_37    mean_age_42    mean_age_47    mean_age_52    mean_age_57    mean_age_62    mean_age_67    mean_age_72    mean_age_77    mean_age_82    mean_age_87    mean_age_92    mean_age_97    mean_age_100
    _____    ____    _____    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ____________

      1       1        0        -4.7384        -4.2839        -3.9125        -3.6403        -3.4202        -3.2286        -3.0466        -2.8601        -2.6595        -2.4491        -2.2399        -2.0731        -2.3629        -1.8637        -1.4355         -1.116       -0.89281        -0.68658  
      2       2        0        -6.2307        -5.5732         -5.014        -4.5943        -4.2483        -3.9542        -3.6887         -3.434        -3.1782        -2.9257        -2.6801        -2.4926        -2.8794        -2.3137        -1.8328        -1.4683        -1.2096        -0.97097  
      3       3        0        -6.9818        -6.3368        -5.7685        -5.3334        -4.9708        -4.6532        -4.3595        -4.0736        -3.7846        -3.4985        -3.2208        -3.0125        -3.5228        -2.8558        -2.2747        -1.8248        -1.5002         -1.1892  
      4       1        1        -4.1822        -3.7934        -3.4691        -3.2086         -2.984        -2.7815        -2.5887        -2.3963        -2.1988        -2.0023        -1.8175        -1.6729        -1.7337        -1.3601        -1.0432       -0.80128       -0.63711        -0.48578  
      5       2        1         -5.157         -4.667        -4.2348        -3.8784        -3.5654        -3.2867        -3.0293        -2.7824        -2.5391        -2.3051        -2.0863        -1.9132        -1.9616        -1.5551        -1.2079       -0.94165       -0.76108        -0.59364  
      6       3        1        -5.5929        -5.1267        -4.7056         -4.352        -4.0378        -3.7489        -3.4736        -3.2028        -2.9306        -2.6639        -2.4094        -2.1983        -2.2235        -1.7704        -1.3796        -1.0769       -0.86971        -0.67418  

% Aprime Choice
tb_az_ap = ff_summ_nd_array("MEAN(AP(KM,J))", ap_VFI, true, ["mean"], 3, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(AP(KM,J))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group    kids    marry    mean_age_19    mean_age_22    mean_age_27    mean_age_32    mean_age_37    mean_age_42    mean_age_47    mean_age_52    mean_age_57    mean_age_62    mean_age_67    mean_age_72    mean_age_77    mean_age_82    mean_age_87    mean_age_92    mean_age_97    mean_age_100
    _____    ____    _____    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ____________

      1       1        0        34.931         34.726         34.665         34.554         34.362         34.077         33.682         33.147         32.422           31.5         30.819         29.713         26.817         24.458         21.039         16.761         11.058            0      
      2       2        0        34.603         34.334         34.198         33.995         33.692         33.286         32.762         32.089         31.289         30.736         29.885         28.361         25.892         23.172         19.841         15.524         10.196            0      
      3       3        0        34.187         33.968         33.877         33.705         33.427         33.033          32.51          31.83          31.11          30.61         29.726         28.203         25.828         23.157         19.895         15.696          10.38            0      
      4       1        1        34.821         34.617         34.566         34.458         34.268         33.984         33.592         33.061         32.337         31.426         30.766         29.672         26.686         24.311         20.849         16.614         10.957            0      
      5       2        1         34.67          34.45         34.364         34.205         33.951         33.592         33.119         32.502         31.689         30.947         30.272         28.936         26.238         23.551         20.155         16.013          10.39            0      
      6       3        1        34.303         34.118         34.065         33.937         33.705         33.363         32.896         32.277         31.468         30.828         30.119         28.736         26.155          23.47         20.114         16.016         10.488            0      

% Consumption Choices
tb_az_c = ff_summ_nd_array("MEAN(C(KM,J))", cons_VFI, true, ["mean"], 3, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(C(KM,J))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group    kids    marry    mean_age_19    mean_age_22    mean_age_27    mean_age_32    mean_age_37    mean_age_42    mean_age_47    mean_age_52    mean_age_57    mean_age_62    mean_age_67    mean_age_72    mean_age_77    mean_age_82    mean_age_87    mean_age_92    mean_age_97    mean_age_100
    _____    ____    _____    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ____________

      1       1        0        6.8531         7.1729         7.4988         7.8167         8.1435         8.4993         8.9181         9.4437         10.134         10.995         11.582         12.551          14.27         16.629         20.048         24.326         30.029          41.087   
      2       2        0         7.182         7.5653         7.9659         8.3756          8.813         9.2907         9.8382         10.502         11.267         11.759         12.516         13.903         15.195         17.915         21.247         25.563         30.891          41.087   
      3       3        0        7.5973          7.931         8.2872         8.6657         9.0783         9.5438         10.091         10.761         11.445         11.885         12.675         14.061         15.259          17.93         21.192         25.392         30.707          41.087   
      4       1        1        7.1848         7.5242         7.8662         8.2047          8.552         8.9277         9.3635          9.904          10.61         11.476         12.055         13.024         14.702         17.087         20.557           24.8         30.464          41.428   
      5       2        1        7.3021         7.6535         8.0269          8.412         8.8205         9.2678         9.7814         10.405         11.198         11.892         12.485         13.693         15.151         17.848         21.253         25.403         31.033           41.43   
      6       3        1        7.6455         7.9599          8.297         8.6497         9.0324          9.462         9.9672         10.591         11.378         11.968         12.594         13.847         15.246         17.941         21.307         25.412         30.948          41.443   

Graph Mean Values:

mp_support_graph('cl_st_graph_title') = {'MEAN(value(KM,J)), a=age, z=kids+marry'};
mp_support_graph('cl_st_ytitle') = {'MEAN(value(KM,J))'};
ff_graph_grid((tb_az_v{1:end, 4:end}), ar_row_grid, age_grid, mp_support_graph);

Graph Mean Savings Choices:

mp_support_graph('cl_st_graph_title') = {'MEAN(APRIME(KM,J)), a=x, z=color'};
mp_support_graph('cl_st_ytitle') = {'MEAN(APRIME(KM,J))'};
ff_graph_grid((tb_az_ap{1:end, 4:end}), ar_row_grid, age_grid, mp_support_graph);

Graph Mean Consumption:

mp_support_graph('cl_st_graph_title') = {'MEAN(C(KM,J)), a=x, z=color'};
mp_support_graph('cl_st_ytitle') = {'MEAN(C(KM,J))'};
ff_graph_grid((tb_az_c{1:end, 4:end}), ar_row_grid, age_grid, mp_support_graph);

1.5 Analyze Education and Marriage and Age

Aggregating over education, savings, and shocks, what are the differential effects of Marriage and Age.

% Generate some Data
mp_support_graph = containers.Map('KeyType', 'char', 'ValueType', 'any');
ar_row_grid = ["E0M0", "E1M0", "E0M1", "E1M1"];
mp_support_graph('cl_st_xtitle') = {'Age'};
mp_support_graph('st_legend_loc') = 'best';
mp_support_graph('bl_graph_logy') = true; % do not log
mp_support_graph('st_rounding') = '6.2f'; % format shock legend
mp_support_graph('cl_scatter_shapes') = {'*', 'p', '*','p' };
mp_support_graph('cl_colors') = {'red', 'red', 'blue', 'blue'};

MEAN(VAL(EKM,J)), MEAN(AP(EKM,J)), MEAN(C(EKM,J))

Tabulate value and policies:

% Set
% NaN(n_jgrid,n_agrid,n_etagrid,n_educgrid,n_marriedgrid,n_kidsgrid);
ar_permute = [2,3,6,1,4,5];
% Value Function
tb_az_v = ff_summ_nd_array("MEAN(VAL(EKM,J))", V_VFI, true, ["mean"], 3, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(VAL(EKM,J))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group    edu    marry    mean_age_19    mean_age_22    mean_age_27    mean_age_32    mean_age_37    mean_age_42    mean_age_47    mean_age_52    mean_age_57    mean_age_62    mean_age_67    mean_age_72    mean_age_77    mean_age_82    mean_age_87    mean_age_92    mean_age_97    mean_age_100
    _____    ___    _____    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ____________

      1       0       0        -6.4015        -5.8666        -5.3879        -4.9966        -4.6557        -4.3525        -4.0711        -3.7972        -3.5191        -3.2399        -2.9631        -2.7398        -3.0999        -2.4877        -1.9609         -1.561        -1.2765         -1.0093  
      2       1       0        -5.5658        -4.9294        -4.4088        -4.0487        -3.7705        -3.5382        -3.3254        -3.1146        -2.8958        -2.6757        -2.4641        -2.3123        -2.7435         -2.201        -1.7345        -1.3784        -1.1253        -0.88856  
      3       0       1          -5.35         -4.913        -4.5196        -4.1777         -3.867        -3.5814        -3.3116         -3.049        -2.7867        -2.5306        -2.2873        -2.0881        -2.1106        -1.6708        -1.2955        -1.0066       -0.80985        -0.62643  
      4       1       1        -4.6046        -4.1451        -3.7534        -3.4483        -3.1912        -2.9633        -2.7494        -2.5387        -2.3256        -2.1169        -1.9214        -1.7682        -1.8352        -1.4529        -1.1251       -0.87332       -0.70209        -0.54263  

% Aprime Choice
tb_az_ap = ff_summ_nd_array("MEAN(AP(EKM,J))", ap_VFI, true, ["mean"], 3, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(AP(EKM,J))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group    edu    marry    mean_age_19    mean_age_22    mean_age_27    mean_age_32    mean_age_37    mean_age_42    mean_age_47    mean_age_52    mean_age_57    mean_age_62    mean_age_67    mean_age_72    mean_age_77    mean_age_82    mean_age_87    mean_age_92    mean_age_97    mean_age_100
    _____    ___    _____    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ____________

      1       0       0        34.682         34.444         34.272         34.048         33.753         33.374         32.888         32.256         31.512         30.851          30.02         28.595          26.17         23.589         20.254         15.987         10.542            0      
      2       1       0        34.465         34.241         34.222         34.121         33.901         33.556         33.081         32.455         31.703         31.046         30.267         28.923         26.188         23.603         20.262             16         10.548            0      
      3       0       1        34.725         34.514         34.372         34.177         33.914         33.569          33.12         32.528          31.74         30.976         30.277         28.965         26.367          23.79         20.393         16.226         10.623            0      
      4       1       1         34.47         34.277         34.291         34.223         34.035         33.724         33.285         32.699         31.923         31.158         30.495         29.265         26.352         23.764         20.352         16.203         10.601            0      

% Consumption Choices
tb_az_c = ff_summ_nd_array("MEAN(C(EKM,J))", cons_VFI, true, ["mean"], 3, 1, cl_mp_datasetdesc, ar_permute);

xxx  MEAN(C(EKM,J))  xxxxxxxxxxxxxxxxxxxxxxxxxxx
    group    edu    marry    mean_age_19    mean_age_22    mean_age_27    mean_age_32    mean_age_37    mean_age_42    mean_age_47    mean_age_52    mean_age_57    mean_age_62    mean_age_67    mean_age_72    mean_age_77    mean_age_82    mean_age_87    mean_age_92    mean_age_97    mean_age_100
    _____    ___    _____    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ___________    ____________

      1       0       0        7.1022         7.4087         7.7357         8.0845         8.4713         8.9105          9.427         10.062         10.782         11.389         12.136         13.445           14.9          17.48         20.815         25.082         30.528           41.07   
      2       1       0        7.3195         7.7041         8.0988         8.4875         8.8852          9.312         9.8044         10.409         11.116         11.703         12.379         13.565         14.917         17.502         20.843         25.105         30.557          41.105   
      3       0       1        7.2307         7.5253         7.8393         8.1757         8.5471         8.9685         9.4633         10.073          10.85         11.572         12.198         13.402         14.973         17.559         20.964         25.138         30.748          41.376   
      4       1       1        7.5242         7.8997         8.2875         8.6685         9.0562         9.4697         9.9448         10.527         11.274         11.985         12.558         13.641         15.093         17.692         21.114         25.272         30.882          41.491   

Graph Mean Values:

mp_support_graph('cl_st_graph_title') = {'MEAN(value(EM,J)), a=age, z=kids+marry'};
mp_support_graph('cl_st_ytitle') = {'MEAN(value(EM,J))'};
ff_graph_grid((tb_az_v{1:end, 4:end}), ar_row_grid, age_grid, mp_support_graph);

Graph Mean Savings Choices:

mp_support_graph('cl_st_graph_title') = {'MEAN(APRIME(EK,J)), a=x, z=color'};
mp_support_graph('cl_st_ytitle') = {'MEAN(APRIME(EK,J))'};
ff_graph_grid((tb_az_ap{1:end, 4:end}), ar_row_grid, age_grid, mp_support_graph);

Graph Mean Consumption:

mp_support_graph('cl_st_graph_title') = {'MEAN(C(EK,J)), a=x, z=color'};
mp_support_graph('cl_st_ytitle') = {'MEAN(C(EK,J))'};
ff_graph_grid((tb_az_c{1:end, 4:end}), ar_row_grid, age_grid, mp_support_graph);