Announcement

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

  • Variable was not found!

    Dear all

    I am running a classic vector autoregression model, and when I try to get the impulse response function, I receive an error that a variable is not found in the results from the Impulse Response Function , IRF.

    Code:
    impulse mag0 not found in results from cars
    r(49
    8);

    This is also the case with the next variable, if I remove the one that was not found.

    The code I am using and a sample of my data are both given below.

    A side question, how could I get the variable labels on the IRF graph instead of the symbol?



    I would be grateful for your help.




    Code:
    varsoc mag0 mag1 car0 car1 col0 col1 vehicle ka re fd
    
      
    quietly  var mag0 mag1 car0 car1 col0 col1 vehicle ka re fd,lag(4)
     
     
    varstable,graph
     
     varlmar
     
    vargranger
    
    
    irf create cars, set(cars) step(10) 
      set seed 123456
     
    irf graph irf , impulse (mag0 mag1 car0 car1 col0 col1 vehicle ) response ( ka re fd)   
      
    irf graph oirf , impulse (mag0 mag1 car0 car1 col0 col1 vehicle ) response ( ka re fd ) 
                
      
    irf graph   coirf , impulse (mag0 mag1 car0 car1 col0 col1 vehicle) response ( ka re fd)



    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(year mag0 mag1 car0 car1 col0 col1 vehicle ka re fd)
    1945 .08333334 .9166667        1           0            .             .            .           .             .             .
    1946 .11104685 .8889531 .9972528  .002747253   .007133216   -.007133186     .0767169           .             .             .
    1947 .19947444 .8005255 .9980889 .0019111324    .05756658    -.05756658  -.033678144           .             .             .
    1948 .22086407 .7406744 .9615384           0  -.034264237  -.0041972995    .02165809           .             .             .
    1949  .1937322 .7993488  .993081           0   .000801742      .0307408  -.003348023           .             .             .
    1950  .2035002 .7964998  .992267  .007733008  -.030423284     .03734231  .0028122663           .             .             .
    1951 .22954823 .7704518 .9502442    .0497558    .05352053    -.05352056  -.003260791           .             .             .
    1952 .16732623 .8326738 .9955353 .0044647385    -.0533452      .0533452   .033309698           .             .             .
    1953 .16870166 .8312984 .9815832  .018416768    .08407372    -.08407375  -.008517623           .             .             .
    1954 .17623118 .8237689 .9855515  .014448515  -.013736248    .013736278  -.008653492           .             .             .
    1955  .1921042 .8078958 .9871795  .012820513    -.0450753      .0450753   .005571097           .             .             .
    1956 .18711314 .8128868 .9950279  .004972095  -.008823812    .008823812  -.013731807           .             .             .
    1957  .1980057 .7987383  .996744           0     .0465731    -.04982913   .006495297           .             .             .
    1958 .17531542 .8002645 .9734432 .0021367522    .03551078    -.05667481  .0042423904           .             .             .
    1959  .3041311  .695869 .9708995   .02910053    .09544164    -.07102156 -.0012779236           .             .             .
    1960 .26169458 .7383054        1           0   -.03749508     .03749505  -.015391976           .             .             .
    1961 .27614978 .7238503 .9675417  .032458283    .03749508    -.03749505    .00309664           .             .             .
    1962 .27188328 .7281167 .9976317 .0023683214   -.11199883     .11199877   .010390967           .             .             .
    1963  .3119553 .6880447  .969496   .03050398  -.001894653    .001894653   -.01049766           .             .             .
    1964  .3092237 .6907762 .9722375   .02776256   .015789598   -.015789539   .004954934           .             .             .
    1965  .2330586 .7669414        1           0   -.05335116     .05335113     .0115287           .             .             .
    1966 .17653315 .8234668 .9927331  .007266927    .02140197      -.021402   .012013525           .             .             .
    1967 .22536334 .7746366 .9595888    .0404112    .04271534    -.04271531  -.011647135           .             .             .
    1968  .1899249 .8100751 .9677419  .032258064  -.018935263    .018935263    .01712513           .             .             .
    1969 .19505495 .8049451 .9677419  .032258064  -.007119328    .007119298  -.014389515           .             .             .
    1970  .2045374 .7899681 .9622474  .032258064   .025434285    -.03092873  .0019976795           .             .             .
    1971  .2260723 .7739277 .9621588   .03784119   .006380677  -.0008862019  -.021190494  -.39362165             .             .
    1972 .27264693 .7169244 .9406098   .04896155    .05811477   -.068543434  -.007597685  -.24231456             .             .
    1973 .21797733 .7507727 .9263393   .04241072  -.021107137  .00028583407   .006259322  -.24066724             .             .
    1974 .20072116 .7578125 .9370707   .02146291    .02026099   -.030477345   .005590796   -.2665547             .             .
    1975 .17659684 .8094093 .9783654  .007640797    .01244849    .015024036   .006330937  -.24634326             .             .
    1976   .184973  .815027 .9853051  .014694895 -.0037447214    .017738491    .01055935  -.31063345             .             .
    1977 .23524334 .7647567 .9867347  .013265306    .05594742    -.05594736 -.0006091893   -.4182096             .             .
    1978 .21381475 .7764521 .9846154  .005651491  -.018916786    .009183645 -.0009466112   -.3896763             .             .
    1979 .28434065 .6985294 .9394796   .04339043  .0014082193   -.008805037    .01392892   -.3896763             .             .
    1980  .1752619 .8247381 .9987913 .0012087027    .01566708   .0014628172   -.02210301  -.29550555             .             .
    1981  .2135585 .7864415 .9974144   .00258565  -.015343845    .015343904  -.010849535  -.34505615             .             .
    1982  .3413058 .6586943 .9786684   .02133161    .02456367    -.02456367   .004226178  -.25163704   .0001324024    .006160483
    1983 .26389787 .7361021 .9928895  .007110537   -.06221724     .06221718   -.00328362   -.1750894   -.014355402    .014019087
    1984 .18436745 .8156326        1           0   -.05473828     .05473831  .0010181367  -.10805306   -.007924562    .014482632
    1985  .1516645 .8483355        1           0    .02088243    -.02088246 -.0006535053  -.08923411    .005102764    .009850457
    1986 .19957983 .8004202        1           0   .034017503   -.034017444  .0020222664   -.0594031   -.010541415     .02026184
    1987 .23287007   .76713 .9941823  .005817712     .0583387    -.05833873   .006771833  -.14884342     .01484855     .01551783
    1988 .22385173 .7761483 .9896051  .010394843    .01464212    -.01464212  -.003155172   -.1206697     .01575236      .0220432
    1989 .23149644 .7685035 .9966871 .0033128636   -.05698216     .05698213   .016436338 -.036256615 -.00008889288  -.0046534836
    1990 .27984852 .7201515  .994654  .005346005  -.015793383    .015793443    .05697283 .0005995822   -.018172212     .02081114
    1991  .3284199 .6465201 .9749401           0    .02895367    -.05401364     43.27272   .07461239    .015567867    .008893073
    1992  .3083437  .691594 .9999377           0   -.09506172      .1200594    .04439545   .12935932   -.018236343 -.00018396974
    1993 .24354993 .7332776 .9604037  .016423794   -.04099771    .017887473    -1.770897    .3613803   -.005394331    .013688922
    1994 .23602992 .7400631 .9677929   .00830021   -.09033784      .0896034     .0444107    .6830521    .010098682    .033943623
    1995 .27747253 .7225274 .9669732  .033026755    .04459012    -.02068317   .022476196    .7524721      .0101888     .01792264
    1996   .325723  .674277 .9697465  .030253503   -.05218634     .05218637    .02706146     .857617     .01386066   .0020535886
    1997 .30558395 .6757603 .9518272  .029516995  -.036713243    .018057466    .01917267    .7424365   -.024909677     .01871976
    1998 .29313186 .6818681 .9739011 .0010989011   -.04234445    .036000192    .01044464    .7895167     .00673125     .03958488
    1999 .28042582 .7138736 .9756181   .01868132    .02678573   -.007486284   .000793457    .8327662    .008219708      .0237163
    2000  .2688356 .7311644 .9853424  .014657534  -.016068995    .021769524   .029144287    .9176872    -.02601591   .0046441555
    2001  .2554258 .7445742 .9921017  .007898351   .012772292   -.012772262   .031337738    .9703661    .007965174     .02297038
    2002  .2105769  .789423  .982967  .017032966   -.07252747     .07252747   .015750885   1.0378017    .005473087   -.006904125
    2003  .1955357 .8044643  .985989   .01401099 .00020602345 -.00020605326   .016868591   1.1644768    .018079296   -.007299632
    2004  .2408904 .7591096        1           0   .012151897   -.012151897     .0190773    1.276395    .022712436     .01002726
    2005  .2480769 .7519231        1           0 -.0023991466   .0023991466    .01517105   1.3937308   -.022985077    .015026867
    2006  .2673077 .7326923 .9806319   .01936813   .030700564   -.030700505    .02935791    1.459883  -.0082911225    .011752129
    2007 .26824456 .7317554 .9940829   .00591716   -.03289485     .03289479   .024166107   1.5610563     -.0102654    .023671627
    2008  .2303533 .7696467        1           0  -.013935775    .013935804    .02479172   1.5881433    .019328535     .02137667
    2009 .23055235 .7694477 .9828658  .017134182    .06577581    -.06577581    .02153778   1.5653305   -.010148779   -.015480518
    2010 .29588655 .7041135 .9681467   .03185328   -.02413714     .02413714   .015098572   1.5544957   -.018703487      .0095371
    2011  .3009355 .6958717 .9968072           0   -.06095931     .05776656    .00982666   1.5382434      .0073763   -.004389167
    2012 .25005552 .7229174 .9703073 .0026656794  -.021239385   -.002594888   .029712677    1.521991     .01201999   -.008769155
    2013 .20782596 .7834868  .972676   .01863677  -.007940888     .02628064   .017562866   1.4883434    -.02810171   -.009512424
    2014 .22527473 .7747253 .9808435   .01915652  -.028363526    .037050784    .02828598   1.4627517    .018062308   -.000639975
    2015         .        .        .           .            .             .   .018558502    1.490982   -.003878433  -.0006780028
    2016         .        .        .           .            .             .    2.8140755    1.501817   -.029535156     .00385046
    2017         .        .        .           .            .             .    -44.66236   1.5382434     .04417016  -.0021682382
    2018         .        .        .           .            .             .            .   1.5207077    .002493127    .007712066
    2019         .        .        .           .            .             .            .    1.483138   -.007930711   -.005730808
    2020         .        .        .           .            .             .            .           .    -.01844586             .
    end
    ------------------ copy up to and including the previous line ------------------



  • #2
    Anyone who can help with this? It's about getting a graph mostly.....

    Comment


    • #3
      The model is highly parameterized relative to the number of observations. The variable is not found because it's getting dropped since it's collinear with variables. I don't understand the graph question, but you can customize the graphs if you read in the irf file and create them by hand. ( use cars.irf, clear)

      Comment


      • #4
        Originally posted by Justin Niakamal View Post
        The model is highly parameterized relative to the number of observations. The variable is not found because it's getting dropped since it's collinear with variables. I don't understand the graph question, but you can customize the graphs if you read in the irf file and create them by hand. ( use cars.irf, clear)
        Thanks for the reply. Indeed removing the not found variable helped obtaining irfs.

        One last thing,. As I wrote I run a rolling VAR. and a rolling PVAR. I have run an unobserved components model initially in order to obtain one step ahead predictions.

        I need to
        1)
        ​collect the observation error covariance parameters and plot the credible intervals
        And
        2)Collect the (state) innovation variance parameters
        ​​​​​​ and plot the credible intervals. How do I do that?
        Last edited by Mario Ferri; 30 May 2023, 09:09.

        Comment

        Working...
        X