Chapter 7 Support Tools
7.1 FF_CONTAINER_MAP_DISPLAY Examples
Go back to fan’s MEconTools Toolbox (bookdown), Matlab Code Examples Repository (bookdown), or Math for Econ with Matlab Repository (bookdown).
Examples](https://fanwangecon.github.io/M4Econ/), or** Dynamic Asset This is the example vignette for function: ff_container_map_display from the MEconTools Package. This function summarizes statistics of matrixes stored in a container map, as well as scalar, string, function and other values stored in container maps.
7.1.1 Test FF_CONTAINER_MAP_DISPLAY Defaults
Call the function with defaults.
ff_container_map_display();
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ND Array (Matrix etc)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx ndim numel rowN colN sum mean std coefvari min max
__ ___ ____ _____ ____ ____ ______ _______ _______ ________ __________ _______
mat_1 1 7 2 12 3 4 6.5142 0.54285 0.2232 0.41115 0.22685 0.98076
mat_2 2 8 2 2650 50 53 1313.3 0.49559 0.29232 0.58985 6.7838e-05 0.99964
mat_2_boolean 3 9 2 2650 50 53 1361 0.51358 0.49991 0.97337 0 1
mat_3 4 10 2 4 2 2 1.8111 0.45277 0.45111 0.99635 0.00012471 0.88615
tensor_1 5 15 3 16 2 8 7.3043 0.45652 0.27787 0.60867 0.018091 0.8345
tensor_2 6 16 3 75 3 25 40.195 0.53593 0.29044 0.54194 0.0024293 0.99731
tensor_3 7 17 2 4 1 4 1.6926 0.42315 0.37389 0.88359 0.1219 0.91553
tesseract_1 8 18 4 72 3 24 34.321 0.47669 0.26374 0.55327 0.010239 0.96435
tesseract_2 9 19 4 20 2 10 8.4191 0.42096 0.28981 0.68846 0.043114 0.97146
tesseract_bl_3 10 20 4 10 1 10 3 0.3 0.48305 1.6102 0 1
xxx TABLE:mat_1 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4
_______ _______ _______ _______
r1 0.69647 0.55131 0.98076 0.39212
r2 0.28614 0.71947 0.68483 0.34318
r3 0.22685 0.42311 0.48093 0.72905
xxx TABLE:mat_2 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c50 c51 c52 c53
________ ________ _______ ________ ________ ________ ________ ________
r1 0.43857 0.6249 0.17108 0.56564 0.072152 0.67855 0.61667 0.54002
r2 0.059678 0.67469 0.82911 0.084904 0.63289 0.27236 0.32528 0.24957
r3 0.39804 0.84234 0.33867 0.58267 0.046367 0.44513 0.075047 0.7839
r4 0.738 0.083195 0.55237 0.81484 0.50561 0.11117 0.59532 0.35603
r5 0.18249 0.76368 0.57855 0.33707 0.10653 0.028681 0.7435 0.91869
r46 0.6813 0.55326 0.88786 0.69983 0.83758 0.16382 0.74191 0.065638
r47 0.87546 0.85445 0.69631 0.66117 0.97069 0.79092 0.42466 0.78725
r48 0.51042 0.38484 0.44033 0.049097 0.017768 0.33302 0.24401 0.97956
r49 0.66931 0.31679 0.43821 0.7923 0.12979 0.75311 0.79466 0.079086
r50 0.58594 0.35426 0.7651 0.51872 0.86415 0.58281 0.84795 0.4579
xxx TABLE:mat_2_boolean xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c50 c51 c52 c53
_____ _____ _____ _____ _____ _____ _____ _____
r1 true false false true true false true true
r2 true false true true false false true true
r3 false true false true false true false true
r4 false true false false false true true true
r5 true true true false true false false true
r46 false true true false true true true true
r47 true true true true true true false false
r48 true false false false true true false true
r49 true true false true true true false false
r50 false false false false false false false false
xxx TABLE:mat_3 xxxxxxxxxxxxxxxxxx
c1 c2
__________ _______
r1 0.00012471 0.13253
r2 0.88615 0.79226
xxx TABLE:tensor_1 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c5 c6 c7 c8
________ _______ _______ _______ _______ _______ ______ _______
r1 0.019363 0.34271 0.52167 0.53703 0.75756 0.68839 0.8345 0.26597
r2 0.018091 0.33355 0.11738 0.77857 0.81933 0.28644 0.6157 0.368
xxx TABLE:tensor_2 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c22 c23 c24 c25
________ _______ _______ _______ _______ _______ _________ _______
r1 0.51866 0.40495 0.48278 0.99731 0.46584 0.62976 0.035924 0.10505
r2 0.028692 0.37408 0.24149 0.35201 0.66054 0.87243 0.0024293 0.81088
r3 0.87339 0.19457 0.83212 0.15315 0.77859 0.96663 0.2501 0.8056
xxx TABLE:tensor_3 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4
______ ______ _______ _______
r1 0.1219 0.5119 0.91553 0.14329
xxx TABLE:tesseract_1 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c21 c22 c23 c24
_______ _______ _______ ________ _______ _______ _______ _______
r1 0.64531 0.59299 0.32115 0.67653 0.90328 0.56911 0.52562 0.12014
r2 0.74558 0.5007 0.46142 0.21384 0.35564 0.13732 0.155 0.23786
r3 0.91137 0.46403 0.18118 0.049919 0.46246 0.46842 0.75348 0.64547
xxx TABLE:tesseract_2 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c7 c8 c9 c10
________ _______ _______ _______ _______ _______ ________ _______
r1 0.28898 0.48211 0.44359 0.97146 0.61782 0.65121 0.80715 0.11605
r2 0.094493 0.34941 0.17595 0.14192 0.16754 0.57097 0.043114 0.70518
xxx TABLE:tesseract_bl_3 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c7 c8 c9 c10
_____ _____ _____ _____ _____ _____ _____ _____
r1 false false true true false true false false
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx value
_ ___ _______
boolean_1 1 1 1
empty 2 2 NaN
mat_4 3 11 0.74898
string_float_1 4 13 1021.1
string_int_1 5 14 1021
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
String
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx string
___ ____ _____________________
list_string_1 "1" "5" "col1;col2;col3;col4"
list_string_2 "2" "6" "row1;row2;row3;row4"
string_1 "3" "12" "Table Name"
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Functions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx functionString
___ ___ ___________________
func1 "1" "3" "@(x)1+2+x"
func2 "2" "4" "@(x,y)x*1+sqrt(y)"
7.1.2 Test FF_CONTAINER_MAP_DISPLAY summarize Matrix Only
Three large matrixes, show summaries
% Create Container
mp_container_map = containers.Map('KeyType','char', 'ValueType','any');
rng(123);
mp_container_map('mat_1') = rand(100,100);
mp_container_map('mat_2') = rand(100,100)*2 + 1;
mp_container_map('mat_2_boolean') = (rand(100,100) > 0.5);
% Will only print
ff_container_map_display(mp_container_map);
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_container_map ND Array (Matrix etc)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx ndim numel rowN colN sum mean std coefvari min max
_ ___ ____ _____ ____ ____ ______ _______ _______ ________ __________ _______
mat_1 1 1 2 10000 100 100 4982.3 0.49823 0.28829 0.57863 6.7838e-05 0.99989
mat_2 2 2 2 10000 100 100 20029 2.0029 0.57632 0.28774 1.0003 2.9993
mat_2_boolean 3 3 2 10000 100 100 4995 0.4995 0.50002 1.0011 0 1
7.1.3 Test FF_CONTAINER_MAP_DISPLAY Show Matrix Subset
A container map with three small matrixes, print only only 2 rows and 3 columns.
% Create Container
mp_container_map = containers.Map('KeyType','char', 'ValueType','any');
rng(789);
mp_container_map('mat_1') = rand(3,4);
mp_container_map('mat_2') = rand(50,53);
mp_container_map('mat_2_boolean') = (rand(50,53) > 0.5);
% Will only print
ff_container_map_display(mp_container_map, 2, 3);
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_container_map ND Array (Matrix etc)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx ndim numel rowN colN sum mean std coefvari min max
_ ___ ____ _____ ____ ____ ______ _______ _______ ________ __________ _______
mat_1 1 1 2 12 3 4 4.9876 0.41564 0.33586 0.80805 0.01062 0.97541
mat_2 2 2 2 2650 50 53 1324.3 0.49973 0.28834 0.57699 0.00046692 0.99985
mat_2_boolean 3 3 2 2650 50 53 1350 0.50943 0.50001 0.98149 0 1
xxx TABLE:mat_1 xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4
_______ _______ _______ _______
r1 0.32333 0.62442 0.01062 0.53815
r3 0.79378 0.75889 0.11104 0.55157
xxx TABLE:mat_2 xxxxxxxxxxxxxxxxxx
c1 c2 c52 c53
_______ _______ _______ _______
r1 0.72837 0.20976 0.74583 0.22321
r50 0.52812 0.545 0.49521 0.29826
xxx TABLE:mat_2_boolean xxxxxxxxxxxxxxxxxx
c1 c2 c52 c53
_____ _____ _____ _____
r1 false true true true
r50 true false false true