options double ; name gir2 'Generalized Impulse Response - example with KPSW data/model' ; ? ? (second example, using LSQ and SOLVE to compute the IRs) ? Follows Pesaran, H. Hashem and Shin, Yongcheol (1998), ? Generalized Impulse Response Analysis in Linear Multivariate ? Regression, Economics Letters 58, 17-29. ? - paper downloaded from H. Hashem Pesaran's web page ? - KPSW data downloaded from Mark Watson's web page ? by Clint Cummins 3/7/2002 ? load ; y = log(ey) ; cons = log(ec) ; in = log(ein) ; smpl 48:1 88:4 ; ? sample for estimation trend t ; cint = 1 ; ? do not use C as intercept, because the intercept ? must be set to zero for IRs. ? Fill in these next 4 variables, and the remaining commands ? below will not need to be modified. list ys y cons in ; list xs cint t ; set maxlag=4 ; set horiz=51 ; title 'GIR - generalized impulse response' ; title 'IRs computed with VAR command' ; ? This part is optional ; included for verifying the alternative calculation ? using LSQ and SOLVE. var(terse,nlag=maxlag,shock=chol,nhoriz=horiz) ys | xs ; var(terse,nlag=maxlag,shock=stddev,nhoriz=horiz) ys | xs ; var(terse,nlag=maxlag,shock=unit,nhoriz=horiz) ys | xs ; ? Shock for GIR (invariant to ordering of variables) ? We are using the VAR(SHOCK=matrix) option to compute the IR, and TSP looks for the shocks ? in the rows of this matrix, so the TSP shock matrix is the transpose of the shock matrix ? given by Pesaran and Shin. ? Normalizing diagonal matrix mat rsdi = sqrt(diag(@covu)") ; mat shgir = (@covu*rsdi)' ; print shgir ; var(terse,nlag=maxlag,shock=shgir,nhoriz=horiz) ys | xs ; copy @impres gir ; ? Don't use terse option if you want plots. var(nlag=maxlag,shock=gen,nhoriz=horiz) ys | xs ; select .not.miss(@iry_cons) ; plot @iry_cons @iry_consLB95% @iry_consUB95% ; end ; ? Data is loaded here noprint ; freq q ; smpl 47:1 88:4 ; ? GNP Consumption Investment read ey ec ein ; .008671651 .006502750 .001737097 .008683677 .006584565 .001683028 .008679208 .006564766 .001739173 .008802933 .006532122 .001866460 .008814823 .006569244 .001911566 .008840276 .006620976 .001920025 .008825267 .006614108 .001895418 .008802171 .006655536 .001878789 .008638372 .006648689 .001772469 .008467998 .006711416 .001691096 .008479042 .006677401 .001676793 .008378048 .006710865 .001722724 .008806174 .006797263 .001822724 .009137278 .006911043 .001988186 .009460482 .007171610 .002124499 .009656863 .007053568 .002092733 .009558484 .007205876 .002018295 .009588862 .007083759 .001951072 .009582690 .007153060 .001929356 .009443737 .007182090 .001913187 .009460886 .007196987 .001935853 .009316551 .007314774 .001951305 .009317212 .007335110 .001837812 .009540883 .007473771 .001947911 .009557335 .007497750 .002005212 .009585176 .007517913 .002005525 .009499750 .007495823 .001997393 .009330873 .007472326 .001981334 .009356982 .007481692 .001950375 .009449328 .007527478 .001979164 .009641902 .007628869 .002036086 .009871675 .007742724 .002060008 .01012367 .007837418 .002138727 .01029273 .007934547 .002218496 .01039554 .007990268 .002256022 .01052493 .008101755 .002264353 .01046040 .008101674 .002216624 .01044972 .008092056 .002220464 .01045149 .008092638 .002212156 .01052669 .008152130 .002178029 .01050749 .008183828 .002167018 .01044934 .008177047 .002135743 .01049002 .008205946 .002151548 .01024315 .008201786 .002109588 .009887286 .008093692 .001996709 .009878272 .008156291 .001928972 .01012681 .008254109 .001938578 .01034272 .008307423 .002043168 .01052266 .008406099 .002154046 .01075396 .008487133 .002219057 .01066545 .008535650 .002231921 .01076709 .008537069 .002198106 .01093673 .008543569 .002244925 .01080174 .008628065 .002171114 .01074516 .008565637 .002107980 .01055809 .008553411 .002100585 .01058397 .008536685 .002076034 .01070248 .008627230 .002085370 .01083691 .008610036 .002128560 .01103535 .008749920 .002189787 .01115693 .008825698 .002225691 .01126279 .008876698 .002290115 .01130699 .008912668 .002295461 .01121478 .008970168 .002256999 .01134002 .008994574 .002260769 .01150559 .009005730 .002359072 .01164428 .009093528 .002407278 .01169426 .009120969 .002462077 .01195961 .009257283 .002488117 .01201823 .009374975 .002482227 .01214453 .009498207 .002490794 .01215270 .009482077 .002505407 .01245728 .009603065 .002621330 .01255178 .009671112 .002694644 .01268531 .009801570 .002718056 .01291035 .01001185 .002771895 .01314864 .01009793 .002832689 .01307904 .01011272 .002792709 .01307301 .01018063 .002769943 .01304260 .01018139 .002652837 .01296150 .01022445 .002573547 .01298648 .01031831 .002652729 .01312635 .01031993 .002671211 .01313425 .01033594 .002746309 .01323410 .01049845 .002808017 .01341104 .01060417 .002777265 .01349187 .01074858 .002788658 .01342565 .01073977 .002857465 .01366013 .01081018 .002887410 .01360838 .01083194 .002881652 .01369144 .01084661 .002899811 .01359146 .01088382 .002799330 .01346086 .01089742 .002751754 .01343902 .01088774 .002681511 .01356216 .01092204 .002724508 .01333137 .01082885 .002735419 .01374487 .01093908 .002760482 .01369117 .01096352 .002844937 .01368537 .01095996 .002883302 .01360380 .01103311 .002911564 .01377012 .01106113 .003017370 .01405828 .01118472 .003037730 .01422614 .01127782 .003054192 .01449712 .01148504 .003202149 .01480841 .01157749 .003300121 .01480647 .01149948 .003285858 .01479878 .01148982 .003263530 .01483276 .01137992 .003224131 .01462950 .01119228 .003126454 .01452453 .01120025 .003065177 .01426398 .01120746 .002968146 .01403807 .01100606 .002780771 .01358797 .01103447 .002581794 .01370200 .01117167 .002543422 .01388732 .01122484 .002590198 .01403364 .01127667 .002628675 .01432855 .01146220 .002710301 .01435801 .01149360 .002734095 .01436944 .01156289 .002741386 .01448779 .01168920 .002864103 .01466525 .01180224 .002962434 .01484504 .01178048 .003108054 .01509694 .01184221 .003149978 .01498998 .01195327 .003156606 .01509681 .01195682 .003185999 .01556784 .01213927 .003364797 .01559856 .01214248 .003390750 .01576762 .01220495 .003401953 .01572458 .01219800 .003409334 .01563905 .01212607 .003388927 .01571492 .01215438 .003419498 .01559486 .01215262 .003375394 .01568460 .01208546 .003313698 .01512344 .01179161 .002968062 .01509720 .01187492 .002957576 .01530170 .01194828 .003071247 .01556484 .01195009 .003100798 .01544890 .01190786 .003117100 .01545894 .01192106 .003080757 .01510670 .01181353 .002967419 .01478626 .01184394 .002846697 .01482502 .01186490 .002749680 .01456049 .01189300 .002655319 .01444240 .01201241 .002705061 .01462436 .01206997 .002705398 .01498873 .01227370 .002852424 .01520671 .01239902 .003014056 .01556385 .01252870 .003145464 .01593079 .01259174 .003254806 .01599883 .01275626 .003378844 .01605988 .01278233 .003416285 .01604450 .01287794 .003466335 .01617825 .01306371 .003484632 .01619870 .01313542 .003543765 .01617592 .01331683 .003486847 .01626070 .01333906 .003578840 .01655773 .01343025 .003516746 .01637527 .01353644 .003485457 .01633749 .01370637 .003453965 .01632175 .01370824 .003457111 .01650427 .01368232 .003387887 .01671427 .01378757 .003464151 .01684224 .01390698 .003578376 .01706247 .01379921 .003584296 .01728405 .01391443 .003603357 .01736218 .01398671 .003686222 .01750646 .01408675 .003714557 .01748039 .01415305 .003713294