| 1 |
// --+ options: stochastic,json=compute +-- |
| 2 |
|
| 3 |
var U2_Q_YED |
| 4 |
U2_G_YER |
| 5 |
U2_STN |
| 6 |
U2_EHIC |
| 7 |
U2_ESTN |
| 8 |
U2_G_EYER |
| 9 |
U2_HH_OCOR |
| 10 |
U2_HH_COR |
| 11 |
U2_H_Q_YER400 |
| 12 |
U2_HH_COR1 ; |
| 13 |
|
| 14 |
varexo res_U2_Q_YED |
| 15 |
res_U2_G_YER |
| 16 |
res_U2_STN |
| 17 |
res_U2_EHIC |
| 18 |
res_U2_ESTN |
| 19 |
res_U2_HH_OCOR |
| 20 |
res_U2_H_Q_YER |
| 21 |
res_ez ; |
| 22 |
|
| 23 |
parameters u2_q_yed_ecm_u2_q_yed_L1 |
| 24 |
u2_q_yed_ecm_u2_stn_L1 |
| 25 |
u2_q_yed_u2_q_yed_L1 |
| 26 |
u2_q_yed_u2_g_yer_L1 |
| 27 |
u2_q_yed_u2_stn_L1 |
| 28 |
u2_g_yer_ecm_u2_q_yed_L1 |
| 29 |
u2_g_yer_ecm_u2_stn_L1 |
| 30 |
u2_g_yer_u2_q_yed_L1 |
| 31 |
u2_g_yer_u2_g_yer_L1 |
| 32 |
u2_g_yer_u2_stn_L1 |
| 33 |
u2_stn_ecm_u2_q_yed_L1 |
| 34 |
u2_stn_ecm_u2_stn_L1 |
| 35 |
u2_stn_u2_q_yed_L1 |
| 36 |
u2_stn_u2_g_yer_L1 |
| 37 |
u2_q_yed_ecm_u2_g_yer_L1 |
| 38 |
u2_g_yer_ecm_u2_g_yer_L1 |
| 39 |
u2_stn_ecm_u2_g_yer_L1 |
| 40 |
u2_hh_ocor_ecm_u2_q_yed_L1 |
| 41 |
u2_hh_ocor_ecm_u2_stn_L1 |
| 42 |
u2_hh_ocor_ecm_u2_g_yer_L1 |
| 43 |
u2_hh_ocor_u2_q_yed_L1 |
| 44 |
u2_hh_ocor_u2_g_yer_L1 |
| 45 |
u2_hh_ocor_u2_stn_L1 |
| 46 |
u2_hh_ocor_ecm_u2_hh_ocor_L1 |
| 47 |
u2_hh_ocor_u2_hh_ocor_L1 |
| 48 |
beta |
| 49 |
ecm_pac |
| 50 |
u2_hh_cor_pac_u2_hh_cor_L1 ; |
| 51 |
|
| 52 |
|
| 53 |
beta = 0.98 ; |
| 54 |
ecm_pac = 0.2; |
| 55 |
u2_hh_cor_pac_u2_hh_cor_L1 = 0.4; |
| 56 |
|
| 57 |
model; |
| 58 |
|
| 59 |
[name='U2_G_YER'] |
| 60 |
diff(U2_G_YER) = u2_g_yer_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1)) |
| 61 |
+ u2_g_yer_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1)) |
| 62 |
+ u2_g_yer_ecm_u2_g_yer_L1 * (U2_G_YER(-1) - U2_G_EYER(-1)) |
| 63 |
+ u2_g_yer_u2_q_yed_L1 * diff(U2_Q_YED(-1)) |
| 64 |
+ u2_g_yer_u2_g_yer_L1 * diff(U2_G_YER(-1)) |
| 65 |
+ u2_g_yer_u2_stn_L1 * diff(U2_STN(-1)) |
| 66 |
+ res_U2_G_YER ; |
| 67 |
|
| 68 |
|
| 69 |
[name='U2_Q_YED'] |
| 70 |
diff(U2_Q_YED) = u2_q_yed_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1)) |
| 71 |
+ u2_q_yed_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1)) |
| 72 |
+ u2_q_yed_ecm_u2_g_yer_L1 * (U2_G_YER(-1)- U2_G_EYER(-1)) |
| 73 |
+ u2_q_yed_u2_q_yed_L1 * diff(U2_Q_YED(-1)) |
| 74 |
+ u2_q_yed_u2_g_yer_L1 * diff(U2_G_YER(-1)) |
| 75 |
+ u2_q_yed_u2_stn_L1 * diff(U2_STN(-1)) |
| 76 |
+ res_U2_Q_YED ; |
| 77 |
|
| 78 |
|
| 79 |
[name='U2_ESTN'] |
| 80 |
U2_ESTN = U2_ESTN(-1) + res_U2_ESTN ; |
| 81 |
|
| 82 |
[name='U2_EHIC'] |
| 83 |
U2_EHIC = U2_EHIC(-1) + res_U2_EHIC ; |
| 84 |
|
| 85 |
[name='U2_G_EYER'] |
| 86 |
U2_G_EYER = 0; |
| 87 |
|
| 88 |
[name='U2_HH_OCOR'] |
| 89 |
diff(diff(log(U2_HH_OCOR))) = u2_hh_ocor_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1)) |
| 90 |
+ u2_hh_ocor_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1)) |
| 91 |
+ u2_hh_ocor_ecm_u2_g_yer_L1 * (U2_G_YER(-1) - U2_G_EYER(-1)) |
| 92 |
+ u2_hh_ocor_ecm_u2_hh_ocor_L1 * (diff(log(U2_HH_OCOR(-1))) - U2_H_Q_YER400(-1)) |
| 93 |
+ u2_hh_ocor_u2_q_yed_L1 * diff(U2_Q_YED(-1)) |
| 94 |
+ u2_hh_ocor_u2_g_yer_L1 * diff(U2_G_YER(-1)) |
| 95 |
+ u2_hh_ocor_u2_stn_L1 * diff(U2_STN(-1)) |
| 96 |
+ u2_hh_ocor_u2_hh_ocor_L1 * diff(diff(log(U2_HH_OCOR(-1)))) |
| 97 |
+ res_U2_HH_OCOR ; |
| 98 |
|
| 99 |
[name='U2_H_Q_YER400'] |
| 100 |
U2_H_Q_YER400 = U2_H_Q_YER400(-1) + res_U2_H_Q_YER; |
| 101 |
|
| 102 |
[name='U2_STN'] |
| 103 |
diff(U2_STN) = u2_stn_ecm_u2_q_yed_L1 * (U2_Q_YED(-1) - U2_EHIC(-1)) |
| 104 |
+ u2_stn_ecm_u2_stn_L1 * (U2_STN(-1) - U2_ESTN(-1)) |
| 105 |
+ u2_stn_ecm_u2_g_yer_L1 * (U2_G_YER(-1) - U2_G_EYER(-1)) |
| 106 |
+ u2_stn_u2_q_yed_L1 * diff(U2_Q_YED(-1)) |
| 107 |
+ u2_stn_u2_g_yer_L1 * diff(U2_G_YER(-1)) |
| 108 |
+ res_U2_STN ; |
| 109 |
|
| 110 |
[name='zpac'] |
| 111 |
diff(log(U2_HH_COR)) = ecm_pac*(log(U2_HH_OCOR(-1))-log(U2_HH_COR(-1))) + |
| 112 |
u2_hh_cor_pac_u2_hh_cor_L1*diff(log(U2_HH_COR(-1))) + |
| 113 |
pac_expectation(pacman) + |
| 114 |
res_ez; |
| 115 |
|
| 116 |
[name='zpac1'] |
| 117 |
diff(log(U2_HH_COR1)) = ecm_pac*(log(U2_HH_OCOR(-1))-log(U2_HH_COR1(-1))) + |
| 118 |
u2_hh_cor_pac_u2_hh_cor_L1*diff(log(U2_HH_COR1(-1))) + |
| 119 |
pac_expectation(pacman1) + |
| 120 |
res_ez; |
| 121 |
end; |
| 122 |
|
| 123 |
// Use the same calibration as in tcm6.mod. |
| 124 |
tcm6 = load('tcm6_data.mat'); |
| 125 |
M_.params = tcm6.params; |
| 126 |
|
| 127 |
trend_component_model(model_name=toto, eqtags=['U2_Q_YED', 'U2_G_YER', 'U2_STN', 'U2_EHIC', 'U2_ESTN', 'U2_HH_OCOR', 'U2_H_Q_YER400'], targets=['U2_EHIC', 'U2_ESTN', 'U2_H_Q_YER400']); |
| 128 |
trend_component_model(model_name=titi, eqtags=['U2_Q_YED', 'U2_G_YER', 'U2_STN', 'U2_EHIC', 'U2_ESTN', 'U2_HH_OCOR', 'U2_H_Q_YER400'], targets=['U2_H_Q_YER400', 'U2_ESTN', 'U2_EHIC']); |
| 129 |
|
| 130 |
% toto |
| 131 |
AR = zeros(4,4,1); |
| 132 |
A0 = zeros(4,4,1); |
| 133 |
A0s = zeros(4,3,1); |
| 134 |
|
| 135 |
AR(1,:) = [M_.params(strcmp(M_.param_names, 'u2_q_yed_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_q_yed_u2_g_yer_L1')), M_.params(strcmp(M_.param_names, 'u2_q_yed_u2_stn_L1')), 0]; |
| 136 |
AR(2,:) = [M_.params(strcmp(M_.param_names, 'u2_g_yer_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_g_yer_u2_g_yer_L1')), M_.params(strcmp(M_.param_names, 'u2_g_yer_u2_stn_L1')), 0]; |
| 137 |
AR(3,:) = [M_.params(strcmp(M_.param_names, 'u2_stn_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_stn_u2_g_yer_L1')), 0, 0]; |
| 138 |
AR(4,:) = [M_.params(strcmp(M_.param_names, 'u2_hh_ocor_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_u2_g_yer_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_u2_stn_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_u2_hh_ocor_L1'))]; |
| 139 |
|
| 140 |
A0(1,:) = [M_.params(strcmp(M_.param_names, 'u2_q_yed_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_q_yed_ecm_u2_g_yer_L1')), M_.params(strcmp(M_.param_names, 'u2_q_yed_ecm_u2_stn_L1')), 0]; |
| 141 |
A0(2,:) = [M_.params(strcmp(M_.param_names, 'u2_g_yer_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_g_yer_ecm_u2_g_yer_L1')), M_.params(strcmp(M_.param_names, 'u2_g_yer_ecm_u2_stn_L1')), 0]; |
| 142 |
A0(3,:) = [M_.params(strcmp(M_.param_names, 'u2_stn_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_stn_ecm_u2_g_yer_L1')), M_.params(strcmp(M_.param_names, 'u2_stn_ecm_u2_stn_L1')), 0]; |
| 143 |
A0(4,:) = [M_.params(strcmp(M_.param_names, 'u2_hh_ocor_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_ecm_u2_g_yer_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_ecm_u2_stn_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_ecm_u2_hh_ocor_L1'))]; |
| 144 |
|
| 145 |
A0s(1,:) = [M_.params(strcmp(M_.param_names, 'u2_q_yed_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_q_yed_ecm_u2_stn_L1')), 0]; |
| 146 |
A0s(2,:) = [M_.params(strcmp(M_.param_names, 'u2_g_yer_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_g_yer_ecm_u2_stn_L1')), 0]; |
| 147 |
A0s(3,:) = [M_.params(strcmp(M_.param_names, 'u2_stn_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_stn_ecm_u2_stn_L1')), 0]; |
| 148 |
A0s(4,:) = [M_.params(strcmp(M_.param_names, 'u2_hh_ocor_ecm_u2_q_yed_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_ecm_u2_stn_L1')), M_.params(strcmp(M_.param_names, 'u2_hh_ocor_ecm_u2_hh_ocor_L1'))]; |
| 149 |
|
| 150 |
[ARt, A0t, A0st] = tcm8.trend_component_ar_a0('toto', M_.params); |
| 151 |
|
| 152 |
if sum(sum(abs(AR-ARt))) ~= 0 |
| 153 |
error('Problem with AR') |
| 154 |
end |
| 155 |
|
| 156 |
if sum(sum(abs(A0-A0t))) ~= 0 |
| 157 |
error('Problem with A0') |
| 158 |
end |
| 159 |
|
| 160 |
if sum(sum(abs(A0s-A0st))) ~= 0 |
| 161 |
error('Problem with A0star') |
| 162 |
end |
| 163 |
|
| 164 |
// Remove column associated to U2_G_EYER |
| 165 |
tcm6.A00star(:,2) = []; |
| 166 |
|
| 167 |
if sum(sum(abs(tcm6.AR0-ARt))) ~= 0 |
| 168 |
error('Problem with AR (relative to tcm6.mod, first model)') |
| 169 |
end |
| 170 |
|
| 171 |
if sum(sum(abs(tcm6.A00-A0t))) ~= 0 |
| 172 |
error('Problem with A0 (relative to tcm6.mod, first model)') |
| 173 |
end |
| 174 |
|
| 175 |
if sum(sum(abs(tcm6.A00star-A0st))) ~= 0 |
| 176 |
error('Problem with A0star (relative to tcm6.mod, first model)') |
| 177 |
end |
| 178 |
|
| 179 |
[ARtt, A0tt, A0stt] = tcm8.trend_component_ar_a0('titi', M_.params); |
| 180 |
|
| 181 |
if sum(sum(abs(AR-ARtt))) ~= 0 |
| 182 |
error('Problem with AR') |
| 183 |
end |
| 184 |
|
| 185 |
if sum(sum(abs(A0-A0tt))) ~= 0 |
| 186 |
error('Problem with A0') |
| 187 |
end |
| 188 |
|
| 189 |
if sum(sum(abs(A0s-A0stt(:,[3,2,1])))) ~= 0 |
| 190 |
error('Problem with A0star') |
| 191 |
end |
| 192 |
|
| 193 |
// Remove column associated to U2_G_EYER |
| 194 |
tcm6.A01star(:,1) = []; |
| 195 |
|
| 196 |
if sum(sum(abs(tcm6.AR1-ARtt))) ~= 0 |
| 197 |
error('Problem with AR (relative to tcm6.mod, second model)') |
| 198 |
end |
| 199 |
|
| 200 |
if sum(sum(abs(tcm6.A01-A0tt))) ~= 0 |
| 201 |
error('Problem with A0 (relative to tcm6.mod, second model)') |
| 202 |
end |
| 203 |
|
| 204 |
if sum(sum(abs(tcm6.A01star-A0stt))) ~= 0 |
| 205 |
error('Problem with A0star (relative to tcm6.mod, second model)') |
| 206 |
end |
| 207 |
|
| 208 |
pac_model(auxiliary_model_name=toto, discount=beta, model_name=pacman, growth = U2_H_Q_YER400); |
| 209 |
pac.initialize('pacman'); |
| 210 |
C0 = oo_.trend_component.toto.CompanionMatrix; |
| 211 |
|
| 212 |
pac_model(auxiliary_model_name=titi, discount=beta, model_name=pacman1, growth = U2_H_Q_YER400); |
| 213 |
pac.initialize('pacman1'); |
| 214 |
C1 = oo_.trend_component.titi.CompanionMatrix; |
| 215 |
|
| 216 |
// Remove U2_G_EYER (columns and rows) |
| 217 |
tcm6.C0(:,[5,13]) = []; |
| 218 |
tcm6.C0([5,13],:) = []; |
| 219 |
|
| 220 |
if any(abs(C0(:)-tcm6.C0(:)))>1e-12 |
| 221 |
error('Companion matrix is not independent of the ordering of the equations, first model.') |
| 222 |
end |
| 223 |
|
| 224 |
// Remove U2_G_EYER (columns and rows) |
| 225 |
tcm6.C1(:,[5,13]) = []; |
| 226 |
tcm6.C1([5,13],:) = []; |
| 227 |
|
| 228 |
if any(abs(C1(:)-tcm6.C1(:)))>1e-12 |
| 229 |
error('Companion matrix is not independent of the ordering of the equations, second model.') |
| 230 |
end |