//Revisions, 03/17/05; //-------------- Model Economy as a Whole. --------------------- #ifndef __MODELECONOMY_H__ #define __MODELECONOMY_H__ #include "optpackage.h" //For optimization of the likelihood or posterior function. #include "rand.h" typedef struct TSinput_tag { //------------------- Input arguments. ---------------------------- FILE *fptr_input; int indxWhichModel; //== indxWhichModel ==// //1: CGP2TP1TI0 defined in swz_conmfuns.h (classical direction of fit); 2: KGP2TP1TI0 defined in swz_conmfuns.h (Keynesian direction of fit). //4: NGO_CGP2TP1TI0 defined in swz_conmfuns.h (no government optimization classical direction of fit); int indxFixz10P10; //== indxFixz10P10 ==// //1: fix z_{1|0} or alpha_{1|0} when doing estimation; 0: must estimate z_{1|0} or alpha_{1|0}; 2: fix z_{1|0} but not P_{1|0}. double tc_P10; //== tc_P10 ==// //Tightness control for the fixed P10. int indxEstFinder; //== indxEstFinder ==// //1: finds the posterior or ML estimate; 0: no such finding and imports values of the parameters. int indxFcsts; //== indxFcsts ==// //1: simulate (long-run) forecasts of gov inflation, expected inflaton, inflation, and unemployment, based on draws of structural residuals. 0: so such forecasts. int locti; //== locti ==// //The forecast date locti must be 0 and fss-1 inclusive when indxFcsts == 1. If locti = -1, the program determines the forecast date. int nsteps; //== nsteps ==// //Number of forecast steps (typically needs thousands of stenps before reaching the limiting distribution). int indxCnterFact; //== indxCnterFact ==// //Only used in ftd_dynfores_uinfs() in swz_comfuns.c. 1: do counterfactual exercises (check ); 0: do not do such exercises. int indxNoUpdating; //== indxNoUpdating ==// //Only used in ftd_dynfores_uinfs() in swz_comfuns.c. 1: no Kalman updating for government; 0: Kalman updating as usual. TSdvector *sclhistshocks_dv; //== sclhistshocks_dv ==// //Only used in ftd_dynfores_uinfs() in swz_comfuns.c. Scaling up or down the historical residuals. int store_sims; //== store_sims ==// //If 1, stores all draws of simulated inflation path (or path of only one variable, which has to be changed in the function ftd_dynfores_uinfs() of swz_comfuns.c; if 0, stores one simulated path of four variables (gov inflation, expected inflation, inflation, unemployment). int nsims; //== nsims ==// //If store_sims, number of simulations to genenerate draws of inflation path (or the path of a chosen variable). double scl_epsilon; //== scl_epsilon ==// //Scale factor espilon for the covariance matrix V in the government's regression when indxFcsts == 1. long randomseed; //== randomseed ==// //From 0 to 2147483646 inclusive for IMSL. If seed==0, a value is computed using the system clock. // int qm; //== qm ==// //If 4, quarterly; if 12, monthly. int yrbin; //== yrbin ==// //The beginning year of the data. int qmbin; //== qmbin ==// //The beginning month (or quarter) of the data. int yrfin; //== yrfin ==// //The finishing year of the data. int qmfin; //== qmfin ==// //The finishing month (or quarter) of the data. int yrstart; //== yrstart ==// //The starting year of the effective sample (excluding lags). int qmstart; //== qmstart ==// //The starting month (or quarter) of the effective sample (excluding lags). // int govmodel; //== govmodel ==// //Government's model (0: Classical direction or regresssion; 1: Keynesian direction). double govpitarget; //== govpitarget ==// //Government's targeted inflation. double govutarget; //== govutarget ==// //Government's targeted unemployment; double govbeta; //== govbeta ==// //Discount rate gov objective function. 0.9936 corresponds to 8% annual growth. double govlambda1; //== govlambda1 ==// //Relative weight on unemployment in the gov object function. double govlambda2; //== govlambda2 ==// //Escape parameter on targeted unemployment by the gov. double _div_gov; //== _div_gov ==// //For government optimization (gensys) problem, dividing number (must be no less than 1.0) for unstable roots in gensys(). // //+ // int _n_gov; //== _n_gov ==// //For government optimization (gensys) problem, number of stacked variables (endogenous, Lagurangian multiplier, expected multiplier, etc.). // int _m_gov; //== _m_gov ==// //For government optimization (gensys) problem, number of exogenous shocks. // int _k_gov; //== _k_gov ==// //For government optimization (gensys) problem, number of expectational errors. //+ Prior hyperparameters. double tc1; //(0, 1]. Tightness control for vstar, theta, theta1, and tau1. double tc2; //>0. Tightness control for zeta1 and zeta2. double tc3; //>0. Tightness control for the elements of the upper triangular decomposition of P_{1|0}. double tc4; //>0. Tightness control for the elements of the upper triangular decomposition of V. double tc5; //>0. Tightness control for the elements of the initial condition z_{1|0} or \alpha^{\hat}_{1|0}. //+ Posterior draws. int ndraws1; //Number of burnt-in draws for the Gibbs sampling. int ndrawsq; //Number of draws to compute the normalizing constant q when restricting the region for the Gaussian weight function. int napartsave; //== napartsave ==// //Number of draws apart between saving or writing a draw to an output file for statistical inferences. Purpose is to (1) save disk space and (2) get less dependent draws. int timesk2b; //Times the number of kept posterior draws is that of burnt-in draws. double sf_mtpl; //== sf_mtpl ==// //Scale factor for sqrt(covariance matrix) in the Metropolis algorithm. Thus, the smaller the number, the smaller the covariance. double sf_mhm; //== sf_mhm ==// //Scale factor for importance covariance matrix used for the MHM method. int indx_readgibbs; //== indx_readgibbs ==// //1: reads Gibbs draws from the file outdatainp_for_prob_constpce.prn; 0: simulates Gibbs draws. int indx_lrsacrats; //== indx_lrsacrats ==// //1: computing and writing to the file outdatainp_for_lreudraws_TAG.prn draws of long-run sacrifice ratios; 0: no such computation or writing. int indx_mhm; //== indx_mhm ==// //1: computing marginal likelihood using the MHM method; 0: no such computation. int indxMHMPeak; //== indxMHMPeak ==// //1: using the posterior peak as the mean of the impoartance Gaussian pdf; 0: using the posterior mean as the mean of the impoartance Gaussian pdf; int indxRecord; //== indxRecord ==// //1: record the xmax_dv that has the max of logPostKernel for the Gibbs draws; 0: no such recording. double cutval_logpost; //Must belong to [0.0,1.0]. Weight for mingibbs_logpostkernel. The larger, the closer to the min. //Added 03/17/05. TSdvector *pcuts_dv; //== pcuts_dv ==// //For the modified harmonic mean (MHM) method, a vector of probabilities for the right-truncated chi-square distribution (a joint normal) of free parameters. TSdvector *zeta1cuts_dv; //Added 03/17/05. For the MHM method, [lower bound, upper bound] for gzetadraws which are always in (0, \infty). TSdvector *zeta2cuts_dv; //Added 03/17/05. For the MHM method, [lower bound, upper bound] for gzetadraws which are always in (0, \infty). //+ int locinflation; //== locinflation ==// //The location (base 0) of the selected inflation (i.e., PCE) in Dataraw_dm in datainp_swz.prn. TSdmatrix *Dataraw_dm; //Columns: 0: U; 1: CPI; 2: core CPI; 3: PCE; 4: core PCE; 5: GDP deflator (interpolated). //--- Model specifications depending on indxWhichModel defined in swz_comfuns.h. int kx; //== kx ==// //Number of right-hand regressors in the government's Phillips curve. //Number of right-hand regressors in the government's Phillips curve. For example, the classical regression may imply {pi_t, pi_{t-1}, u_{t-1}, pi_{t-2}, u_{t-2}, 1}. int nlagsgov; //== nlagsgov ==// //Number of lags or lag length for the government's misspecified Phillips curve. int nlagstrue; //== nlagstrue ==// //Number of lags or lag length for the true Phillips curve. int nlagsinflation; //== nlagsinflation ==// //Number of lags or lag length for the true inflation process. //------------------- Output arguments. ---------------------------- FILE *fptr_output; time_t prog_begtime; time_t prog_endtime; double program_hours; //Hours spent on the program. } TSinput; typedef struct TSconstmodpars_tag { //Collection of all constant-parameter model parameters to be estimated, whereas some paramters like the discount factor are simply given. int indxWhichModel; //1: CGP2TP1TI0 defined in swz_conmfuns.h (classical direction of fit); 2: KGP2TP1TI0 defined in swz_conmfuns.h (Keynesian direction of fit). //4: NGO_CGP2TP1TI0 defined in swz_conmfuns.h (no government optimization classical direction of fit); int indxFixz10P10; //1: fix z_{1|0} or alpha_{1|0} when doing estimation; 0: must estimate z_{1|0} or alpha_{1|0}; 2: fix z_{1|0} but not P_{1|0}. int indxFcsts; //1: simulate (long-run) forecasts of gov inflation, expected inflaton, inflation, and unemployment, based on draws of structural residuals. 0: so such forecasts. int indxCnterFact; //Only used in ftd_dynfores_uinfs() in swz_comfuns.c. 1: do counterfactual exercises (check ); 0: do not do such exercises. int indxNoUpdating; //Only used in ftd_dynfores_uinfs() in swz_comfuns.c. 1: no Kalman updating for government; 0: Kalman updating as usual. TSdvector *sclhistshocks_dv; //Only used in ftd_dynfores_uinfs() in swz_comfuns.c. Scaling up or down the historical residuals. double tc_P10; //Tightness control for the fixed P10. double scl_epsilon; //Scale factor espilon for the covariance matrix V in the government's regression when indxFcsts == 1. long randomseed; //From 0 to 2147483646 inclusive for IMSL. If seed==0, a value is computed using the system clock. //=== Fixed values used for evaluating the logLH or logPosterior that is formed according to nlagstrue. // int govmodel; //== govmodel ==// //Government's model (0: Classical direction or regresssion; 1: Keynesian direction). int kx; //== kx ==// //Number of right-hand regressors in the government's Phillips curve. int nlagsinflation; //== nlagsinflation ==// //Number of lags or lag length for the inflation process. int nlagstrue; //== nlagstrue ==// //Number of lags or lag length for the true Phillips curve. int maxnlags; //max of nlagstrue, nlagsinflation, and nlagsgov. int fss; //Effective sample size (i.e., excluding max lag length in the whole model). double govpitarget; //Government's targeted inflation. //=== For the MLE or posterior estimate. int indxStartValuesForMin; //0: randomly selects the initial starting values for the MLE or posterior estimate; //1: starts from the fixed values manually keyed in (in the modeleconomy.c). //2: uses the starting piont (sp) file, filename_sp_vec_csminwel. //*** This one is used only for printing out final results in ftd_FprintOutput() in modeleconomy.c. int indxMLE; //1: ML estimation (i.e., without no explicit prior); 0: posterior estimation (i.e., with an informative prior). int totnpars; //Total number of free parameters. If rho1=rho2=0, equals to 6+kx+(kx+1)*kx. TSdvector *x_dv; //totnpars-by-1 vector of free parameters. For indxWhichModel = CGP2TP1TI0, we have 6+kx+(kx+1)*kx variables in the order of //vstar, theta0, theta1, tau1, xi1 (sqrt(zeta1)), xi2 (sqrt(zeta2)), z10, P10, and V. //=== Private-sector parameters, pp.20-20a. //--- True Phillips curve. double ustar; //Natural rate of unemployment. double gtheta0; double gtheta1; double gtau1; double gzeta1; //Inverse of residual variance in the true Phillips curve. //--- True inflation process. double grho1; //Coefficient on 1st lag of inflation in the true inflatin process. double grho2; //Coefficient on 1st lag of unemployment in the true inflation process. double gzeta2; //Inverse of residual variance in the true inflation process. //=== Government parameters, but will be estimated outside of the government problem. double gzeta; //Normalized to be equal to gzeta1. Inverse of residual variance in the government's mis-specified Phillips curve. TSdvector *z10_dv; //kx-by-1. Initial condition for the coefficient: z_{1|0} -- coefficients on pi_t, pi_{t-1}, U_{t-1}, pi_{t-2}, U_{t-2}, and Constant. TSdmatrix *P10_dm; //kx-by-kx symmetric matrix. Initial condition for the variance of the coefficient: P_{1|0}. TSdmatrix *V_dm; //kx-by-kx. Covariance (symmetric and positive definite) matrix for the residual of the drifting parameters in the government's Phillips curve. //------- Keyed in within ftd_priorsettings(): tightness control hyperparameters for the prior. See pp.20c-d. ------- //=== Copied in from input_ps. double tc1; //(0, 1]. Tightness control for vstar, theta, theta1, and tau1. double tc2; //>0. Tightness control for zeta1 and zeta2. double tc3; //>0. Tightness control for the elements of the upper triangular decomposition of P_{1|0}. double tc4; //>0. Tightness control for the elements of the upper triangular decomposition of V. double tc5; //>0. Tightness control for the elements of the initial condition z_{1|0} or \alpha^{\hat}_{1|0}. // double vstar_priormean; double vstar_priorvar; double gtheta0_priormean; double gtheta0_priorvar; double gtheta1_priormean; double gtheta1_priorvar; double gtau1_priormean; double gtau1_priorvar; //+ double corr_theta0_theta1; //Correlation between theta0 and theta1. double corr_vstar_theta0; //Correlation between vstar and theta0. double corr_vstar_theta1; //Correlation between vstar and theta1. double corr_vstar_tau1; //Correlation between vstar and tau1. double corr_theta0_tau1; //Correlation between theta0 and tau1. double corr_theta1_tau1; //Correlation between theta1 and tau1. //+ double gzeta1p2_prioralpha; //The parameter alpha in a Gamma prior. double gzeta1p2_priorbeta; //The parameter beta in a Gamma prior. //+ double z10_priormean; //Mean for all elements in z_{1|0} or alpha^{\hat}_{1|0}. double z10_priorvar; //Variance for all elements in z_{1|0} or alpha^{\hat}_{1|0}. //+ double Cpdiag_priormean; //Mean for the diagonal of the upper Choleski decomposition of P_{1|0} = Cp'*Cp where Cp is upper triangular. double Cpoff_priormean; //Mean for the off-diagonal elements of the upper Choleski decomposition of P_{1|0} = Cp'*Cp where Cp is upper triangular. double Cpdiag_priorvar; //Variance for the diagonal of the upper Choleski decomposition of P_{1|0} = Cp'*Cp where Cp is upper triangular. double Cpoff_priorvar; //Variance for the off-diagonal elements of the upper Choleski decomposition of P_{1|0} = Cp'*Cp where Cp is upper triangular. double Cvdiag_priormean; //Mean for the diagonal of the upper Choleski decomposition of V = Cv'*Cv where Cv is upper triangular. double Cvoff_priormean; //Mean for the off-diagonal elements of the upper Choleski decomposition of V = Cv'*Cv where Cv is upper triangular. double Cvdiag_priorvar; //Variance for the diagonal of the upper Choleski decomposition of V = Cv'*Cv where Cv is upper triangular. double Cvoff_priorvar; //Variance for the off-diagonal elements of the upper Choleski decomposition of V = Cv'*Cv where Cv is upper triangular. //=== For the 1st set of parameters: vstar, theta0, theta1, and tau1. TSdvector *mean1stset_dv; TSdmatrix *Var1stSet_dm; TSdmatrix *cholVar1stSet_dm; double term1st1; //=== For the 2nd and 3rd sets of parameters: zeta1 and zeta2. double term2nd1; double term3rd1; //=== For the 4th set of parameters z_{1|0}: coefficients on pi_t, pi_{t-1}, U_{t-1}, pi_{t-2}, U_{t-2}, and Constant. TSdvector *mean4thset_dv; TSdmatrix *Var4thSet_dm; TSdmatrix *cholVar4thSet_dm; double term4th1; //=== For the 5th set of parameters: only upper triangular part of the Choleski decompostion of P_{1|0}. See p.20d. TSdvector *mean5thset_dv; TSdmatrix *Var5thSet_dm; TSdmatrix *cholVar5thSet_dm; double term5th1; //=== For the 6th set of parameters: only upper triangular part of the Choleski decompostion of V. See p.20d. TSdvector *mean6thset_dv; TSdmatrix *Var6thSet_dm; TSdmatrix *cholVar6thSet_dm; double term6th1; //=== Output parameters from the finding ML or posterior peak problem. double LHvalatpostpeak; //LH value at the posterior peak. double peaklogpost; TSdvector *upred_dv; //T-by-1 or fss-by-1 vector of one-step predicted unemployment rate. TSdmatrix *StrResidstran_dm; //2-by-T vector of backed-out residuals. 1st row: true Phillips equation; 2nd row: true inflation process. //=== Other outputs. TSdvector *sampledates_dv; //Length depends on the input values of input_ps->yrstart, input_ps->qmstart, input_ps->yrfin, and input_ps->qmfin. void (*modest)(struct TSconstmodpars_tag *, void *); void (*modprob)(struct TSconstmodpars_tag *, void *); //=== 03/17/05. See pp.42-43. Estimating V, P10, sigma^2 directly from the no-government-optimization (ngo) statistical model. int indxNoGovOpt; //1: no government optimization but simply estimating V using Kalman filtering; 0: options below Oringal Model kicks in. double ngo_maxLHvalue; double ngo_sigmasq; //Normalization. This number is arbitrary. TSdvector *ngo_x_dv; //Free parameters: 6*7/3 free elements for chol(V) and 6*7/3 free elements for chol(P10). //--- one draw of the kth-step inflation forecast. double draw_k_fcstinf; TSdvector *k_fcstinf_z10_dv; } TSconstmodpars; typedef void TFconstmodest(struct TSconstmodpars_tag *, void *); typedef void TFconstmodprob(struct TSconstmodpars_tag *, void *); #endif