| 1 |
/* |
| 2 |
* Copyright (C) 1996-2011 Daniel Waggoner and Tao Zha |
| 3 |
* |
| 4 |
* This free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation, either version 3 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* It is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* If you did not received a copy of the GNU General Public License |
| 15 |
* with this software, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
#include "dw_sbvar_command_line.h" |
| 19 |
#include "sbvar_historical_decomposition.h" |
| 20 |
#include "VARio.h" |
| 21 |
#include "switchio.h" |
| 22 |
#include "dw_error.h" |
| 23 |
#include "dw_parse_cmd.h" |
| 24 |
#include "dw_ascii.h" |
| 25 |
#include "dw_std.h" |
| 26 |
#include "dw_rand.h" |
| 27 |
|
| 28 |
#include <stdlib.h> |
| 29 |
#include <string.h> |
| 30 |
#include <ctype.h> |
| 31 |
|
| 32 |
/* |
| 33 |
Top level command line parameters - see each function for specific parameters |
| 34 |
|
| 35 |
-estimate : produces estimation - posterior mode or maximum likelihood |
| 36 |
-simulate : produces simulation run |
| 37 |
-probabilities : produces smoothed or filtered probabilities |
| 38 |
-forecast : produce forecast |
| 39 |
-ir : produce impulse responses |
| 40 |
-variance_decomposition : produce variance decomposition |
| 41 |
-historical : produce historical decomposition |
| 42 |
|
| 43 |
General command line parameters |
| 44 |
|
| 45 |
-seed : seed value for random number generation (default = 0 which is a "random" seed) |
| 46 |
|
| 47 |
-ft <tag> |
| 48 |
The input file tag. Is used to create input filenames if the -fs or |
| 49 |
-fp options are not present. |
| 50 |
|
| 51 |
-di <directory> |
| 52 |
If this argument exists, then all input files are in specified directory, |
| 53 |
otherwise the current directory is used |
| 54 |
|
| 55 |
-do <directory> |
| 56 |
If this argument exists, then all output files are in specified directory, |
| 57 |
otherwise the current directory is used |
| 58 |
|
| 59 |
-fs <filename> |
| 60 |
If this argument exists, then the specification file name is <filename>. |
| 61 |
If this argument is not present, the rules for determining the |
| 62 |
specification file are defined in the comments before the function |
| 63 |
CreateTStateModel_command_line_sbvar(), which is in this file. |
| 64 |
|
| 65 |
-fp <filename> |
| 66 |
If this argument exists, then the parameter file name is <filename>. |
| 67 |
If this argument is not present, the rules for determining the |
| 68 |
parameters file are defined in the comments before the function |
| 69 |
CreateTStateModel_command_line_sbvar(), which is in this file. |
| 70 |
|
| 71 |
-ph <header> |
| 72 |
If this argument exists, then the header for the parameters is <header>. |
| 73 |
If this argument is not present, the rules for determining the |
| 74 |
parameters header are defined in the comments before the function |
| 75 |
CreateTStateModel_command_line_sbvar(), which is in this file. |
| 76 |
|
| 77 |
-MLE |
| 78 |
If -ph or is not present, determines whether the input parameter header is |
| 79 |
"MLE: " or "Posterior mode: ". Also determines if estimation finds the |
| 80 |
posterior mode or maximum likelihood. |
| 81 |
|
| 82 |
-fto <tag> |
| 83 |
The output file tag. Used to create output filenames. The default value |
| 84 |
is the value associated with the -ft arguement. |
| 85 |
|
| 86 |
-fo <filename> |
| 87 |
If this argument exists, then the output file name is <filename>. If |
| 88 |
this augument is not present |
| 89 |
|
| 90 |
-pho <header> |
| 91 |
If this argument exists, then the parameter header used for output is |
| 92 |
<header>. The default value is -ph <header>. |
| 93 |
|
| 94 |
*/ |
| 95 |
int main(int nargs, char** args) |
| 96 |
{ |
| 97 |
// Set seed value |
| 98 |
dw_initialize_generator(dw_ParseInteger_String(nargs,args,"seed",0)); |
| 99 |
|
| 100 |
// estimation |
| 101 |
if (dw_FindArgument_String(nargs,args,"estimate") != -1) |
| 102 |
dw_sbvar_estimate_command_line(nargs,args); |
| 103 |
|
| 104 |
// simulation |
| 105 |
if (dw_FindArgument_String(nargs,args,"simulate") != -1) |
| 106 |
dw_sbvar_simulate_command_line(nargs,args); |
| 107 |
|
| 108 |
// probabilities |
| 109 |
if (dw_FindArgument_String(nargs,args,"probabilities") != -1) |
| 110 |
dw_sbvar_probabilities_command_line(nargs,args); |
| 111 |
|
| 112 |
// mdd - requires posterior draws |
| 113 |
if (dw_FindArgument_String(nargs,args,"mdd") != -1) |
| 114 |
dw_sbvar_mdd_command_line(nargs,args); |
| 115 |
|
| 116 |
// forecasts |
| 117 |
if (dw_FindArgument_String(nargs,args,"forecast") != -1) |
| 118 |
dw_sbvar_forecast_command_line(nargs,args); |
| 119 |
|
| 120 |
// impulse responses - requires posterior draws for error bands |
| 121 |
if (dw_FindArgument_String(nargs,args,"ir") != -1) |
| 122 |
dw_sbvar_impulse_response_command_line(nargs,args); |
| 123 |
|
| 124 |
// variance decomposition |
| 125 |
if (dw_FindArgument_String(nargs,args,"variance_decomposition") != -1) |
| 126 |
dw_sbvar_variance_decomposition_command_line(nargs,args); |
| 127 |
|
| 128 |
/* /\* historical decomposition *\/ */ |
| 129 |
/* if (dw_FindArgument_String(nargs,args,"historical") != -1) */ |
| 130 |
/* dw_sbvar_historical_decomposition_command_line(nargs,args); */ |
| 131 |
|
| 132 |
/* /\* test code *\/ */ |
| 133 |
/* if (dw_FindArgument_String(nargs,args,"test") != -1) */ |
| 134 |
/* dw_sbvar_test_command_line(nargs,args); */ |
| 135 |
|
| 136 |
return 0; |
| 137 |
} |