Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VAR(1) estimation- errors for each observation in the panel data

    Dear Stata users,

    I have estimated the VAR(1) model of the form: zt+1=a + Γzt+ ut+1
    Where zt+1 is m-by-1 state vector with rt+1 as the first element (log excess market return) , a and Γ are m-by-1 vector and m-by-m matrix of constant parameters and ut+1 an i.i.d. m-by-1 vector of shocks. I have obtained my VAR parameters estimates, but for my next computations I need to back out all the ut+1 error terms (for 877 montly observations), to obtain:

    NCF, t+1=(e1'+e1'λ)ut+1

    and

    NDR, t+1=e1'λut+1

    where e1' is supposed to pick the first element of λ and should capture the long run siginificance of each individual VAR shock to discount rate expectations (e1'λ). The greater the absolute value of variable's coefficient in the return prediction equation (top row of Γ) the greater the weight the variable receives in the discount rate formula.
    and λ=pΓ(I-pΓ)-1 with p=0,951/12 and I= identity matrix

    State vector variables are R_Me (log excess market return), TY (term yield), PE (price earings ratio), VS (value spread)

    How can I obtain error terms for each montly observation separately? Is there a way to back out the ut+1 from VAR estimation procedure? I attach the example of my data set.
    Any help will be much appreciated!


    * Example generated by -dataex-. To install: ssc install dataex clear input long Date double(R_Me TY PE VS EtR_Me N_dr N_cf Rrf FFS2BM1 FFS3BM1 FFS4BM1 FFS5BM1 FFS5BM5 RISK10 RISK14 RISK17 RISK19) 199011 .058061626 .67 2.9222078 1.6413188 .0035540038 .062132986 -.0076253644 .005849983 .1183 .1051 .0897 .0646 .0435 .12173959 .10203556 .036494877 .095742293 199012 .023693474 .75 2.9608154 1.6537005 .0090106973 .0178459 -.003163123 .005433334 .0435 .0645 .042 .0325 .0079 .05887135 .048686188 .023024607 .04431314 199101 .042781392 .96 2.9476627 1.664684 .0055701994 -.0051041534 .042315346 .005116646 .0977 .0935 .0841 .0516 .0395 .11749612 .099675956 .01321588 .09292419 199102 .068041102 1.06 3.0515163 1.6708693 .0087658785 .097320626 -.038045402 .004933343 .1229 .0924 .0889 .0815 .08 .11978292 .099244337 .077034147 .094222122 199103 .023502177 1.11 3.0757451 1.6804807 .010210728 -.0010602499 .014351699 .004883342 .0761 .0743 .0481 .0455 .012 .049943459 .028751036 .030019418 .032099285 199104 -.0013861052 1.23 3.0923817 1.6590837 .0058615677 -.0052015584 -.0020461145 .004741713 -.0132 -.0289 -.0078 -.0001 -.0019 -.01046825 -.016978515 -.015338632 .011341767 199105 .035248183 1.5 3.084884 1.67436 .004309962 .0082276908 .02271053 .004549997 .0544 .0376 .0658 .0397 .0686 .058022122 .056415447 .043939377 .067192412 199106 -.049887627 1.42 3.0835875 1.7203005 .0094085029 -.027222457 -.032073673 .004649961 -.0574 -.0516 -.0528 -.0428 -.0395 -.079378644 -.07320167 -.038958906 -.047176416 199107 .041101192 1.71 3.0866172 1.7329534 .00031467686 .042206667 -.0014201516 .00466666 .0424 .0598 .0591 .0643 .0081 .073272477 .050325015 .076738999 .056630268 199108 .022064351 1.61 3.1083668 1.7328576 .010546596 .0053573976 .0061603572 .004500037 .0387 .0546 .0166 .0438 .0176 .039886239 .021745287 .03410797 .034028991 199109 -.015428971 1.23 3.1014802 1.7581476 .007799295 -.014220606 -.0090076597 .004316644 .0064 -.0012 -.0037 -.021 -.0382 -.0010723043 -.029284393 -.0073710169 -.0080010347 199110 .013373658 1.65 3.0994341 1.7707362 .0016168025 .010040765 .0017160908 .004199968 .0239 .0297 .0253 .0147 .005 .0012886541 .0027192137 .024965763 .040451829 199111 -.041675451 1.65 3.0957319 1.7764372 .0068914496 -.027300574 -.021266327 .003699999 -.0502 -.0355 -.0244 -.0121 -.0831 -.051966509 -.039022418 -.01342243 -.046044798 199112 .09856959 1.68 3.1021296 1.801241 .0016835556 .069642376 .027243658 .00312507 .1093 .1452 .1337 .1534 .1286 .14410748 .11005604 .14353534 .12990558 199201 -.0048462536 1.89 3.1703972 1.7699284 .01469567 -.0038516738 -.01569025 .0032 .0842 .015 -.0026 -.0325 .0675 .030558833 .041570478 -.040628776 .021325619 199202 .0099079047 1.68 3.1616104 1.7086906 .0056947576 -.019679887 .023893034 .003299991 .0072 .0007 -.0053 .0022 .1012 .036302385 .04335575 .0057724954 .04176327 199203 -.027359047 1.66 3.1482634 1.6515203 .0066343946 -.046236251 .012242809 .003399936 -.0849 -.0526 -.0563 -.0287 .008 -.041113085 -.028939616 -.026796741 -.022945689 199204 .010674801 2.12 3.147724 1.6043993 .0038999019 -.0046238379 .011398737 .003075019 -.0707 -.0527 -.0191 -.0011 .0704 -.024273608 -.0060293406 .0116734 -.0067946755 199205 .0033786935 2.05 3.1650627 1.5754549 .01102512 -.0028647191 -.0047817072 .003125016 -.0035 .002 .0006 .0131 -.0003 .0028963673 -.00037492673 .011265314 -.0079230652 199206 -.022481149 2.2 3.1478011 1.4847344 .010000813 -.059766014 .027284052 .003058318 -.0539 -.0488 -.0182 -.0308 .0072 -.036795002 -.026061295 -.030658052 -.014513251 199207 .036516521 2.54 3.1629036 1.4758222 .0099050674 .023913187 .0026982671 .002650003 .031 .0523 .0535 .0486 -.0033 .042440025 .026477158 .051032197 .042972537 199208 -.023591751 2.47 3.1684525 1.4582289 .017535883 -.037485448 -.003642186 .00261665 -.0401 -.0441 -.0128 -.0058 -.088 -.035956176 -.039910077 -.010938171 -.036942995 199209 .0099214541 2.72 3.1676465 1.4569487 .011560726 .0012279816 -.0028672533 .002424986 .0205 .0302 .0033 .0083 .0019 .035946488 .029197342 -.0065920437 .031592421 199210 .008369042 2.67 3.1511369 1.4829317 .016347348 -.020301042 .012322736 .002475039 .0479 .0597 .0529 .0201 -.0013 .061445302 .021498778 .0060441428 .030091503 199211 .03665324 2.62 3.1737824 1.5110869 .015794764 .027320823 -.006462348 .002725014 .0948 .0946 .0717 .0368 .0852 .085926641 .079620172 .02495823 .060305642 199212 .014727906 2.61 3.2005716 1.4884234 .017462875 -.0056763363 .0029413675 .002683292 .0159 .0341 .0168 -.0071 .0284 .016971998 .033786524 .0077716184 .040448992 199301 .0097941412 1.98 3.196606 1.4406005 .015228246 -.024033194 .018599089 .002483298 -.0059 -.0212 .0123 -.0241 .0928 .029637817 .053976633 -.02022988 .024467618 199302 .0029814606 2 3.2083474 1.3626069 .011387599 -.022881827 .014475688 .002466725 -.0829 -.0805 -.0529 -.0306 .0209 -.035884624 .010879687 -.0027664923 -.0019350573 199303 .022255393 2.02 3.2238624 1.3478493 .011678315 .0085172658 .0020598123 .002449972 .0113 .0466 .0301 .0067 .0344 .020475056 .028704573 .0081915352 .047276357 199304 -.028227883 2.18 3.2045645 1.3356704 .013583876 -.052764174 .010952415 .002399998 -.0309 -.0451 -.0484 -.0599 .0115 -.038069128 -.046358244 -.03604462 -.017833153 199305 .026448772 2.03 3.2060167 1.3699759 .01027856 .027506062 -.01133585 .002550011 .0732 .0761 .0706 .0313 -.0053 .064019802 .058474132 .020602644 .02753563 end

  • #2

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long Date double(R_Me TY PE VS EtR_Me Rrf FFS1BM1 FFS1BM2 FFS1BM3 FFS1BM4 RISK1 RISK2 RISK3 RISK4)
    199011   .058061626  .67 2.9222078 1.6413188  .0035540038 .005849983  .0358  .0422  .0444  .0249   .020012582     .036707774   .081934385   .072135975
    199012   .023693474  .75 2.9608154 1.6537005  .0090106973 .005433334 -.0012      0  .0037  .0195  .0043070103     .027739029   .012367582   .051274659
    199101   .042781392  .96 2.9476627  1.664684  .0055701994 .005116646   .074  .0699  .1062  .0881  .0040218754     .035280468    .08418443    .10643512
    199102   .068041102 1.06 3.0515163 1.6708693  .0087658785 .004933343  .1484  .1227  .1289   .119   .063541645     .060804611   .077369573   .087195274
    199103   .023502177 1.11 3.0757451 1.6804807   .010210728 .004883342  .1039  .0921  .0794  .0609   .015506054     .026411076   .028343652   .032908724
    199104 -.0013861052 1.23 3.0923817 1.6590837  .0058615677 .004741713  .0076  .0102  .0135  .0068 -.0021661078   -.0053525713   .019836029   .017399885
    199105   .035248183  1.5  3.084884   1.67436   .004309962 .004549997  .0268  .0407  .0462  .0276   .001151971     .029727838   .060501863   .070387764
    199106  -.049887627 1.42 3.0835875 1.7203005  .0094085029 .004649961  -.064 -.0379 -.0372 -.0455  -.013406122    -.019128493  -.041824401  -.068553717
    199107   .041101192 1.71 3.0866172 1.7329534 .00031467686  .00466666  .0241  .0414  .0201  .0307   .041096505     .034718465   .029924258   .057636397
    199108   .022064351 1.61 3.1083668 1.7328576   .010546596 .004500037  .0371  .0462  .0294  .0109   .021285307     .005003363   .019588773   .034718349
    199109  -.015428971 1.23 3.1014802 1.7581476   .007799295 .004316644  .0438  .0238  .0064 -.0022  .0076074822    -.014279766  -.028242507   -.01746338
    199110   .013373658 1.65 3.0994341 1.7707362  .0016168025 .004199968  .0678  .0406  .0089  .0365   .024691455      .03822891   .017709185   .023282766
    199111  -.041675451 1.65 3.0957319 1.7764372  .0068914496 .003699999 -.0173 -.0372 -.0436  -.028  -.042879219    -.045351803  -.045338727  -.064748466
    199112    .09856959 1.68 3.1021296  1.801241  .0016835556  .00312507  .0549  .0406  .0553  .0398   .048077667      .10037436    .12281763    .13220252
    199201 -.0048462536 1.89 3.1703972 1.7699284    .01469567      .0032  .1466  .1606  .0832  .1394  -.030450949    -.013883891   .032557533   .065664601
    199202  .0099079047 1.68 3.1616104 1.7086906  .0056947576 .003299991 -.0037  .0499  .0375  .0538  -.019295947    .0072387467   .042089064   .054981406
    199203  -.027359047 1.66 3.1482634 1.6515203  .0066343946 .003399936 -.0638 -.0545  -.024  .0031  -.022753577    .0067710175  -.020535873  -.010893576
    199204   .010674801 2.12  3.147724 1.6043993  .0038999019 .003075019 -.0934 -.0348  -.047   -.04  .0056234454     .025347498     .0220666 -.0028735439
    199205  .0033786935 2.05 3.1650627 1.5754549    .01102512 .003125016 -.0168   .004  .0016 -.0123   .003464218   -.0030898002  -.005749979  -.012057032
    199206  -.022481149  2.2 3.1478011 1.4847344   .010000813 .003058318  -.095 -.0527 -.0544 -.0493   -.02523143   -.0020191149  -.022047224 -.0090318985
    199207   .036516521 2.54 3.1629036 1.4758222  .0099050674 .002650003  .0067  .0085  .0228  .0243   .042365269    .0077240822   .025502298   .016568615
    199208  -.023591751 2.47 3.1684525 1.4582289   .017535883  .00261665 -.0442 -.0298 -.0168 -.0183 -.0083192266    -.044589028  -.028591945  -.049786292
    199209  .0099214541 2.72 3.1676465 1.4569487   .011560726 .002424986 -.0009  .0191  .0185  .0176  -.018535151     .010320262   .019742703   .030841749
    199210   .008369042 2.67 3.1511369 1.4829317   .016347348 .002475039  .0244  .0222  .0279  .0239  -.037863999 -.000084730723   .022228871   .015180874
    199211    .03665324 2.62 3.1737824 1.5110869   .015794764 .002725014  .1051  .1036  .0781  .0794 -.0057250549     .042787296   .047886627    .08217561
    199212   .014727906 2.61 3.2005716 1.4884234   .017462875 .002683292  .0104   .035    .05  .0392  -.015488022     .043637123   .026668203   .047051218
    199301  .0097941412 1.98  3.196606 1.4406005   .015228246 .002483298  .0316  .0576  .0473  .0591   .033233576     .030601683   .018042554   .070779445
    199302  .0029814606    2 3.2083474 1.3626069   .011387599 .002466725 -.0701  -.051 -.0215 -.0055   .056655139     .031732349  .0074420194   .024875474
    199303   .022255393 2.02 3.2238624 1.3478493   .011678315 .002449972  .0069   .018  .0356  .0236   .035969731     .021718579   .035222091   .033819086
    199304  -.028227883 2.18 3.2045645 1.3356704   .013583876 .002399998 -.0408 -.0458 -.0286 -.0221  .0024521129   -.0084892401 -.0094922126  -.038832971
    199305   .026448772 2.03 3.2060167 1.3699759    .01027856 .002550011  .0518  .0455  .0368  .0308   .021977818     .031910959    .03873381   .036788115
    end

    Comment

    Working...
    X