Hi,
1. I want to estimate my risk measures using bi-variate diagonal GARCH (1,1) model (DVECH) for each of my 360 panels (IDs) in the data(for a time period of 20 years). when I simply run my code, the error I get is that "sample may not include multiple panels". Could someone help me devise foreach code to extract correlation coefficient between X and Y variable, Variance or standard deviation of the Y variable, Variance or standard deviation of the X variable, t stat and p values.
The regression syntax I am using is as:
mgarch dvech (Y=L.Y) (X=L.X), arch(1) garch(1)
where Y is the dependant variable, L.Y is the lagged Y variable at (t-1), X is the independent variable.
Please see my data example below for just two panels IDs(275 and 276) posted here:
2. My Y variable data is not normally distributed, what techniques I shall consider to normalize it for GARCH modelling? The assumption is that both the Y and X variable follow a bi-variate normal distribution.
Regards
1. I want to estimate my risk measures using bi-variate diagonal GARCH (1,1) model (DVECH) for each of my 360 panels (IDs) in the data(for a time period of 20 years). when I simply run my code, the error I get is that "sample may not include multiple panels". Could someone help me devise foreach code to extract correlation coefficient between X and Y variable, Variance or standard deviation of the Y variable, Variance or standard deviation of the X variable, t stat and p values.
The regression syntax I am using is as:
mgarch dvech (Y=L.Y) (X=L.X), arch(1) garch(1)
where Y is the dependant variable, L.Y is the lagged Y variable at (t-1), X is the independent variable.
Please see my data example below for just two panels IDs(275 and 276) posted here:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long ID float(Date X Y) 275 17532 -.9448536 .8354189 275 17533 .3487111 -.2693492 275 17534 .2836161 -.17842436 275 17535 . 0 275 17538 1.656796 . 275 17539 .9286202 -.08710092 275 17540 -1.8091848 -.04588305 275 17541 1.6367277 .16509503 275 17542 . 0 275 17545 2.59634 . 275 17546 1.678565 -.0810245 275 17547 1.0624355 .4417567 275 17548 -2.242841 -.13226286 275 17549 . 0 275 17552 6.591204 . 275 17553 -1.0402253 3.274396 275 17554 -2.8957386 -.458727 275 17555 -1.4676168 -.3175855 275 17556 . 0 275 17559 2.3655958 . 275 17560 .09141315 -.3981869 275 17561 .57441044 -.1596823 275 17562 1.0667937 .009047816 275 17563 . 0 275 17566 -1.7750583 . 275 17567 1.4845915 .074129224 275 17568 0 .19125396 275 17569 0 .02732165 275 17570 . 0 275 17573 2.484294 . 275 17574 -.4080752 -.3319641 275 17575 .7379941 -.29444113 275 17576 -3.068964 -.3005825 275 17577 . 0 275 17580 -.7636237 . 275 17581 .4831726 -.3440623 275 17582 .7934458 .02211948 275 17583 -2.0359843 -.08973708 275 17584 . 0 275 17587 1.3930135 . 275 17588 -1.3764292 -.03779463 275 17589 -2.0453684 -.07851576 275 17590 .9485728 .02572221 275 17591 . 0 275 17594 1.9457484 . 275 17595 -.017554902 -.13483116 275 17596 .2816869 -.07304642 275 17597 -1.1848292 -.07768305 275 17598 . 0 275 17601 .5061342 . 275 17602 -1.2829027 -.3825753 275 17603 -1.8511173 -.326667 275 17604 2.428849 .18069623 275 17605 . 0 275 17608 1.0206416 . 275 17609 -2.3306415 -.11481378 275 17610 -.5284565 .012798377 275 17611 0 .014203067 275 17612 . 0 275 17615 -1.4381084 . 275 17616 -3.162646 -.2389299 275 17617 -1.1833931 .01078685 275 17618 .16642608 -.13291514 275 17619 . 0 275 17622 .7881719 . 275 17623 -1.9291533 -.6465864 275 17624 -2.484611 -.4927806 275 17625 -.4476654 .0501497 275 17626 . 0 275 17629 -1.0812626 . 275 17630 .2128137 -.4863795 275 17631 .7718029 -.3550645 275 17632 -2.5250444 -.18530308 275 17633 . 0 275 17636 1.9678795 . 275 17637 1.4971073 .09815712 275 17638 -.5609957 .0976398 275 17639 -1.4524742 -.06738571 275 17640 . 0 275 17643 -1.5427467 . 275 17644 -.07093139 1.545077 275 17645 -.8000664 .7919154 275 17646 1.2043766 .24864738 275 17647 . 0 275 17650 -.8486731 . 275 17651 -.3858811 -.1931482 275 17652 0 .01122949 275 17653 -.9671556 .1462957 275 17654 . 0 275 17657 -.41946185 . 275 17658 -.11834846 .4144604 275 17659 .7723355 .7863739 275 17660 2.2498853 .35206985 275 17661 . 0 275 17664 .3849867 . 275 17665 -.4651551 -.067269385 275 17666 .8010302 .05592031 275 17667 -.5863638 .10466933 275 17668 . 0 275 17671 -1.714908 . 275 17672 .55663955 -.02399113 275 17673 -.5582111 -.19157113 275 17674 1.2003723 .21305996 275 17675 . 0 275 17678 1.8554692 . 275 17679 .45745665 .64939 275 17680 -.12183766 .7578576 275 17681 .53087777 .10868005 275 17682 . 0 275 17685 -.07326257 . 275 17686 1.0590341 -.26588959 275 17687 .35715 -.3316403 275 17688 .1465411 -.07622816 275 17689 . 0 275 17692 2.624693 . 275 17693 1.6282976 .08328944 275 17694 -.9891568 -.3005187 275 17695 .7715387 .09954578 275 17696 . 0 275 17699 -2.2379537 . 275 17700 -.4555624 -.3852659 275 17701 .14622067 -.08326889 275 17702 1.7126575 .3337774 275 17703 . 0 275 17706 .52168447 . 275 17707 -.016833052 -.360022 275 17708 -1.4465773 .3252652 275 17709 -1.0467112 -.03505685 275 17710 . 0 275 17713 1.0990441 . 275 17714 1.334379 -.11756666 275 17715 -1.3395193 .10773988 275 17716 1.2523624 .20052333 275 17717 . 0 275 17720 -.2701383 . 275 17721 1.4375293 1.0624845 275 17722 -1.7240967 .0996057 275 17723 .9814016 .06832132 275 17724 . 0 275 17727 .05752651 . 275 17728 1.0759283 1.2098705 275 17729 1.0457535 .8387258 275 17730 -.8885576 .09181806 275 17731 . 0 275 17734 -1.840747 . 275 17735 .9189287 -.2369358 275 17736 -1.7101812 -.3988784 275 17737 -.5019524 -.012656693 275 17738 . 0 275 17741 -.450145 . 275 17742 1.74288 .4152934 275 17743 -1.361951 .22918233 275 17744 -.3784299 .036926772 275 17745 . 0 275 17748 .7786454 . 275 17749 -.8225358 .6326553 275 17750 .3362251 .09695192 275 17751 2.62957 .2126996 275 17752 . 0 275 17755 1.3273808 . 275 17756 -.9506874 .6310061 275 17757 -.8665434 .3440818 275 17758 .011449438 -.04084237 275 17759 . 0 275 17762 -.6029612 . 275 17763 2.0009193 .676532 275 17764 -1.0074242 .4899583 275 17765 .4939459 .163318 275 17766 . 0 275 17769 .4387149 . 275 17770 1.6924874 .3743745 275 17771 -.3183445 -.420342 275 17772 -.4176282 -.010667897 275 17773 . 0 275 17776 1.5126754 . 275 17777 -1.3462456 .9574438 275 17778 1.4175 .4151205 275 17779 2.3630495 .19571374 275 17780 . 0 275 17783 -5.192647 . 275 17784 .787276 .30941185 275 17785 1.5859063 .8979475 275 17786 4.1234207 .4249836 275 17787 . 0 275 17790 2.649753 . 275 17791 1.0324059 3.144228 275 17792 1.0113052 -1.1764535 275 17793 .2163054 .06195149 275 17794 . 0 275 17797 .27457067 . 275 17798 2.593637 .8793958 275 17799 .24451683 .6621457 275 17800 1.4845705 .06394596 275 17801 . 0 275 17804 1.3420187 . 275 17805 0 .0021264986 275 17806 -.9225485 .07488141 275 17807 .44253105 .0693523 275 17808 . 0 275 17811 8.550269 . 275 17812 -.10918797 3.620046 275 17813 5.682075 1.683814 275 17814 -4.500806 -.024856167 275 17815 . 0 275 17818 -4.796797 . 275 17819 -4.262467 -3.0210874 275 17820 3.003715 1.1346748 275 17821 3.437421 .4610553 275 17822 . 0 275 17825 -4.481159 . 275 17826 3.58992 -.06506504 275 17827 5.668676 2.29232 275 17828 7.681322 .5397015 275 17829 . 0 275 17832 11.532278 . 275 17833 -4.6320586 .27511767 275 17834 5.731647 -.9557837 275 17835 -8.629296 -.477014 275 17836 . 0 275 17839 -5.878052 . 275 17840 1.9197185 -.6787698 275 17841 -4.004157 -.5425225 275 17842 4.790688 .4592072 275 17843 . 0 275 17846 .904058 . 275 17847 4.0181484 2.674548 275 17848 2.0851493 1.557288 275 17849 2.8203266 .35117126 275 17850 . 0 275 17853 1.912763 . 275 17854 .8629184 .4985007 275 17855 2.79079 .3115564 275 17856 3.5591354 .3217009 275 17857 . 0 275 17860 -.3935625 . 275 17861 -5.14361 -.26080194 275 17862 -2.1745372 .31906235 275 17863 -2.106215 -.09433806 275 17864 . 0 275 17867 4.057175 . 275 17868 1.773407 1.5954512 275 17869 1.8641368 -.18450505 275 17870 -.7844057 -.02482805 275 17871 . 0 275 17874 -.7754063 . 275 17875 -7.718072 -.52155423 275 17876 -4.3969555 -.35110685 275 17877 -.9990728 -.09066255 275 17878 . 0 275 17881 -.5766259 . 275 17882 -2.892514 -.21423855 275 17883 1.621788 .12884219 275 17884 -.1113434 -.14128058 275 17885 . 0 275 17888 1.8014857 . 275 17889 .9284344 -.20125595 275 17890 0 .06472899 275 17891 -3.250345 -.008247561 275 17892 . 0 275 17895 .0008978591 . 275 17896 -2.5990536 -.1691266 275 17897 0 -.05741507 276 17532 1.635493 .8354189 276 17533 -1.471723 -.2693492 276 17534 0 -.17842436 276 17535 . 0 276 17538 -.871711 . 276 17539 0 -.08710092 276 17540 1.5456324 -.04588305 276 17541 0 .16509503 276 17542 . 0 276 17545 1.551087 . 276 17546 -2.31708 -.0810245 276 17547 -19.10259 .4417567 276 17548 0 -.13226286 276 17549 . 0 276 17552 -9.462498 . 276 17553 4.197288 3.274396 276 17554 -1.8090326 -.458727 276 17555 0 -.3175855 276 17556 . 0 276 17559 3.1783845 . 276 17560 -1.410829 -.3981869 276 17561 -.59593374 -.1596823 276 17562 0 .009047816 276 17563 . 0 276 17566 -7.737052 . 276 17567 -.0888175 .074129224 276 17568 -6.291576 .19125396 276 17569 0 .02732165 276 17570 . 0 276 17573 3.4900906 . 276 17574 -6.061938 -.3319641 276 17575 -12.494024 -.29444113 276 17576 0 -.3005825 276 17577 . 0 276 17580 -5.204611 . 276 17581 -13.437892 -.3440623 276 17582 13.239464 .02211948 276 17583 0 -.08973708 276 17584 . 0 276 17587 -4.83119 . 276 17588 -4.6089635 -.03779463 276 17589 3.7785664 -.07851576 276 17590 0 .02572221 276 17591 . 0 276 17594 -3.428463 . 276 17595 -3.530055 -.13483116 276 17596 -1.370222 -.07304642 276 17597 0 -.07768305 276 17598 . 0 276 17601 -11.636923 . 276 17602 -17.389702 -.3825753 276 17603 -18.345716 -.326667 276 17604 0 .18069623 276 17605 . 0 276 17608 2.4213905 . 276 17609 3.26327 -.11481378 276 17610 0 .012798377 276 17611 0 .014203067 276 17612 . 0 276 17615 -4.535011 . 276 17616 -12.42974 -.2389299 276 17617 15.186446 .01078685 276 17618 0 -.13291514 276 17619 . 0 276 17622 1.33363 . 276 17623 -1.9559397 -.6465864 276 17624 3.4256854 -.4927806 276 17625 0 .0501497 276 17626 . 0 276 17629 -11.614422 . 276 17630 -4.794767 -.4863795 276 17631 2.332233 -.3550645 276 17632 0 -.18530308 276 17633 . 0 276 17636 -4.371339 . 276 17637 .770042 .09815712 276 17638 .7922998 .0976398 276 17639 0 -.06738571 276 17640 . 0 276 17643 .7293228 . 276 17644 1.660068 1.545077 276 17645 -1.0115426 .7919154 276 17646 0 .24864738 276 17647 . 0 276 17650 30.45607 . 276 17651 1.897267 -.1931482 276 17652 0 .01122949 276 17653 0 .1462957 276 17654 . 0 276 17657 5.494571 . 276 17658 2.582631 .4144604 276 17659 .830285 .7863739 276 17660 0 .35206985 276 17661 . 0 276 17664 6.690775 . 276 17665 6.950309 -.067269385 276 17666 7.396179 .05592031 276 17667 0 .10466933 276 17668 . 0 276 17671 -7.63819 . 276 17672 -6.051295 -.02399113 276 17673 3.028843 -.19157113 276 17674 0 .21305996 276 17675 . 0 276 17678 .9714295 . 276 17679 -1.6027133 .64939 276 17680 5.937746 .7578576 276 17681 0 .10868005 276 17682 . 0 276 17685 8.544799 . 276 17686 -2.945718 -.26588959 276 17687 -.03857173 -.3316403 276 17688 0 -.07622816 276 17689 . 0 276 17692 -2.600786 . 276 17693 .6139032 .08328944 276 17694 1.6856712 -.3005187 276 17695 0 .09954578 276 17696 . 0 276 17699 2.087778 . 276 17700 1.319442 -.3852659 276 17701 1.3170284 -.08326889 276 17702 0 .3337774 276 17703 . 0 276 17706 1.3789568 . 276 17707 -5.528686 -.360022 276 17708 0 .3252652 276 17709 0 -.03505685 276 17710 . 0 276 17713 0 . 276 17714 -1.3029145 -.11756666 276 17715 1.2934916 .10773988 276 17716 0 .20052333 276 17717 . 0 276 17720 8.565106 . 276 17721 1.1018476 1.0624845 276 17722 .006335855 .0996057 276 17723 0 .06832132 276 17724 . 0 276 17727 -5.383254 . 276 17728 3.698886 1.2098705 276 17729 13.676517 .8387258 276 17730 0 .09181806 276 17731 . 0 276 17734 5.082239 . 276 17735 0 -.2369358 276 17736 -2.6525104 -.3988784 276 17737 0 -.012656693 276 17738 . 0 276 17741 -.5998918 . 276 17742 10.465086 .4152934 276 17743 -3.024452 .22918233 276 17744 0 .036926772 276 17745 . 0 276 17748 4.2909007 . 276 17749 3.36493 .6326553 276 17750 -.8218333 .09695192 276 17751 0 .2126996 276 17752 . 0 276 17755 7.924467 . 276 17756 6.292953 .6310061 276 17757 7.13474 .3440818 276 17758 0 -.04084237 276 17759 . 0 276 17762 4.456162 . 276 17763 8.219277 .676532 276 17764 .04869774 .4899583 276 17765 0 .163318 276 17766 . 0 276 17769 1.8572234 . 276 17770 .17269987 .3743745 276 17771 -1.4594604 -.420342 276 17772 0 -.010667897 276 17773 . 0 276 17776 -6.486739 . 276 17777 .24245247 .9574438 276 17778 -14.381198 .4151205 276 17779 0 .19571374 276 17780 . 0 276 17783 -1.1779838 . 276 17784 1.1361294 .30941185 276 17785 -1.201011 .8979475 276 17786 0 .4249836 276 17787 . 0 276 17790 11.440876 . 276 17791 3.396565 3.144228 276 17792 .4810865 -1.1764535 276 17793 0 .06195149 276 17794 . 0 276 17797 -1.0431293 . 276 17798 .7270016 .8793958 276 17799 3.287153 .6621457 276 17800 0 .06394596 276 17801 . 0 276 17804 0 . 276 17805 0 .0021264986 276 17806 0 .07488141 276 17807 0 .0693523 276 17808 . 0 276 17811 -6.233808 . 276 17812 10.348805 3.620046 276 17813 .5770051 1.683814 276 17814 0 -.024856167 276 17815 . 0 276 17818 -.7836846 . 276 17819 -4.708588 -3.0210874 276 17820 1.363078 1.1346748 276 17821 0 .4610553 276 17822 . 0 276 17825 4.240919 . 276 17826 3.610716 -.06506504 276 17827 19.56696 2.29232 276 17828 0 .5397015 276 17829 . 0 276 17832 .6601269 . 276 17833 -3.425278 .27511767 276 17834 5.184638 -.9557837 276 17835 0 -.477014 276 17836 . 0 276 17839 1.1907704 . 276 17840 -3.684428 -.6787698 276 17841 5.196092 -.5425225 276 17842 0 .4592072 276 17843 . 0 276 17846 -18.75826 . 276 17847 -2.741206 2.674548 276 17848 10.536908 1.557288 276 17849 0 .35117126 276 17850 . 0 276 17853 4.2906303 . 276 17854 9.635596 .4985007 276 17855 .4515028 .3115564 276 17856 0 .3217009 276 17857 . 0 276 17860 7.678648 . 276 17861 -2.0375218 -.26080194 276 17862 -.57947344 .31906235 276 17863 0 -.09433806 276 17864 . 0 276 17867 3.0766544 . 276 17868 3.938889 1.5954512 276 17869 -1.958521 -.18450505 276 17870 0 -.02482805 276 17871 . 0 276 17874 0 . 276 17875 -.8067458 -.52155423 276 17876 -1.3497015 -.35110685 276 17877 0 -.09066255 276 17878 . 0 276 17881 1.0332724 . 276 17882 1.4363856 -.21423855 276 17883 -.5722924 .12884219 276 17884 0 -.14128058 276 17885 . 0 276 17888 -.8590128 . 276 17889 1.6446818 -.20125595 276 17890 1.536159 .06472899 276 17891 0 -.008247561 276 17892 . 0 276 17895 .6297305 . 276 17896 -1.9363302 -.1691266 276 17897 0 -.05741507 end format %td Date label values ID ID label def ID 275 "OCBC SP Equity", modify label def ID 276 "ODIN EY Equity", modify
2. My Y variable data is not normally distributed, what techniques I shall consider to normalize it for GARCH modelling? The assumption is that both the Y and X variable follow a bi-variate normal distribution.
Regards