Announcement

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

  • PVAR does not run

    Hi everyone!

    I have a paneldata of 891 observations (81 time series for 11 countries). I am trying to run a PVAR, but before I want to find the optimal lags. Hence, I am trying to run pvarsoc.
    However, If I run my code:
    Code:
     pvarsoc lgPCE lgGDP if countryid, maxlag(10)
    .

    My data file shows "Running panel VAR lag order selection on estimation sample". However, the programme keeps stuck at this point. The actual results is never showed. This surprised me because I do not have a very big sample size.
    I checked on Statalist for answers, but could not find anything. That's why I'm asking here now.

    Thank you a lot in advance for any help!

  • #2
    Please present your data using dataex. I'm also willing to bet my next paycheck that this is a user written command (or at least it likely is, I've never heard of it), which you're asked to specify in the FAQ.

    In other words, please read the FAQ. Read it and revise your question in the post below this one. I'm sure there's an answer, but as of now, nobody can find the answer without data and code.

    Comment


    • #3
      The pvar command is part of a community contributed package available from the Stata Journal.
      Code:
      net describe st0455, from(http://www.stata-journal.com/software/sj16-3)
      Two thoughts on your problems.

      1) The default for maxlag() is 4. Try a much smaller value than 10 - perhaps start with 1 and work your way up. Running the example in the output of help pvarsoc I find that increasing maxlag() slightly increases the run time substantially, and can result in failure to converge.

      2) What is the intent of "if countryid" in the command you ran?
      Code:
      pvarsoc lgPCE lgGDP if countryid, maxlag(10)

      Comment


      • #4
        Thank you for the comments Jared and William - much appreciated - and apologies for the inconvenience of lacking information on my problem.

        I found that the pvarsoc and pvar commands are meant for datasets large-N/short-T panels, whereas my datasets is the opposite.
        I tried xtvar for my dataset and this works. FYI xtvar is from the following user command:
        Code:
        net install xtvar, from (http://fmwww.bc.edu/RePEc/bocode/x)
        More info here: https://www.researchgate.net/publica...ute_panel_vect or_autoregression

        Re 2) I ran the if countryid to control for each country separately, although I now realise this is not necessary in this command for the panel VAR.

        For completeness I will put all my information still below:
        I am using Stata14 on Windows10. The pvarsoc command I am using I downloaded from the following:
        Code:
        net install st0085_2, from (http://www.stata-journal.com/software/sj14-2)
        This user written command is explained by the author here: https://journals.sagepub.com/doi/10....867X1601600314

        An example of my data is the below, where EHB stands for equity home bias, GDP for gross domestic product, PCE for private consumption expenditure, GGD for general government debt, EMC for equity market capitalisation, and NEX for net exports.
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input long countryid float time double(EHB GDP PCE GGD EMC NEX)
        1 167  .7618109171729182       58940031000        31404700500        1.29687e+11        25204350000 1011282200.0000001
        1 168  .7721190367180102       59679552750        31767612000 137176200000.00002        27297795000 2118992699.9999998
        1 169  .7809325300892426       60066173625        32086792875       1.565068e+11        29391240000         1506974900
        1 170  .7885464600613793       60346998000        32581844625       1.554511e+11 31484684999.999996         2126624600
        1 171  .7951818017497305       60814863000 32868991500.000004        1.58664e+11 33578129999.999996 2053162899.9999998
        1 172  .7775253505934068       60966392250        32911036125       1.727094e+11        39314210000         1525886200
        1 173  .7643543225102741       61186731375        33131269875       1.861938e+11        45050290000         1735959400
        1 174  .7541509572309953       61507387500 33192492749.999996       1.845251e+11        50786370000         1853311400
        1 175  .7460131087309412       62656607250        33511989750        1.92845e+11        56522450000         2164329400
        1 176  .7165346432053997       63027211125        34127485125       1.961664e+11        64335905000         2641476700
        1 177  .6934185153344629       64187179125        34476803250       2.048494e+11        72149360000 2994093700.0000005
        1 178  .6748020090540734       65081180625  35320224749.99999       2.116547e+11        79962815000         2401532000
        1 179  .6594853336244544       65558213250        35222542125       2.151919e+11        87776270000         1155104600
        1 180  .6684621857151675       66636094125        35902737750       2.332509e+11        97395070000         3719920000
        1 181   .675800580280813       67357702125        36502216125       2.273936e+11       107013870000         1995521830
        1 182  .6819076014527853       68037265500        36398000250       2.268793e+11       116632670000         2205869170
        1 183  .6870661194962651 69340859624.99999        37056594000       2.057438e+11       126251470000         2804403000
        1 184  .6764608363879723       69765204750        37303593000       2.229284e+11       142881180000 2893360899.9999995
        1 185  .6680448209590957       71197988625  37818244499.99999       2.450669e+11       159510890000         3136652400
        1 186  .6612009967780578       71939091000  37987265999.99999       2.375176e+11       1.761406e+11         3399050700
        1 187   .655524697166828       73326036750        38189796750       2.374156e+11       192770310000         4357585000
        1 188  .6637624647871456       74386530750        38792436375       2.577261e+11       203689830000 3898590100.0000005
        1 189  .6711618038516604       75003922875        38956189125       2.734972e+11       214609350000         5159494000
        1 190  .6778445156388537       76267579875        39701295750       2.988964e+11       225528870000         4707259000
        1 191  .6839098987087082       77092982250        40234282500       2.718593e+11       236448390000         5154989000
        1 192   .675268988165966       78008901750  40319846999.99999       3.023334e+11       196408467500         7198971000
        1 193  .6621532093396293       77931556500        40157780250       3.042224e+11       156368545000         4531522500
        1 194  .6399062539808335       76512155250  39746080124.99999       2.791974e+11       116328622500         5508692300
        1 195  .5940494553165002       75477056625        39948084000       2.808588e+11        7.62887e+10 3155093999.9999995
        1 196  .6051546131387663       75259035750  40662104999.99999       2.810484e+11        85735542500         3642279670
        1 197  .6140552345895729       75960833250        40914794250       3.042702e+11        95182385000         3121925700
        1 198  .6213484928886384       76666740375        40746299625       3.099065e+11       104629227500         3641415600
        1 199  .6274337380898335       76319951250  41069590124.99999        3.31359e+11       114076070000         4024513680
        1 200  .6298992103941851       77354312250  41127967874.99999       3.135362e+11       117065042500         3338822400
        1 201  .6322415423758366       78270547875        42137881875        2.97352e+11       120054015000 2627855600.0000005
        1 202  .6344697434951422       79528936125  42441151125.00001       3.336739e+11       123042987500         2732542100
        1 203  .6365919642096487       80918937750        42668655750       3.269639e+11       126031960000         3212349400
        1 204  .6325876963960597       81519469875  43386786374.99999       3.519602e+11       115841350000 2184714999.9999995
        1 205  .6277958302650144       82207779375        43878993000       3.618799e+11       105650740000         2908174000
        1 206  .6219624117096213       82122214875        44513455875        3.40222e+11        95460130000 1464643999.9999998
        1 207  .6147118128154012       83738245875        44932953750       3.308292e+11        85269520000         3198851900
        1 208  .6115589465831625       83756581125  44839907624.99999       3.757853e+11        90461335000         1855845000
        1 209   .608746662344084       83978500875  44828316374.99999       3.601552e+11        95653150000         2324880000
        1 210  .6062225153360242       84361222875        44993649750       3.642849e+11       100844965000         2824217100
        1 211  .6039443128423502       84306322500        45431272125       3.730987e+11       106036780000         2626663000
        1 212  .6413237579371426       84893788125        45623054625       3.659159e+11       108945437500         4065377500
        1 213  .6767581431247581       85739317125        45858989250       3.736974e+11       111854095000 2914032600.0000005
        1 214  .6247153984827056       86243747250  46267211999.99999       3.943194e+11       114762752500 2670413099.9999995
        1 215  .5752447271505635       86379786375        46678701375       3.961421e+11       117671410000 2539477900.0000005
        1 216  .5638550973143334       87650398125        46749197250       3.983946e+11       112451140000         2202961100
        1 217  .5513446483443432       88321110000        47092087500       4.028739e+11       107230870000 3850374199.9999995
        1 218  .5396457572415635       88960314750        46946564625       3.664757e+11       1.020106e+11         3714739700
        1 219  .5266726037025966       89246513250        47335925250       3.703502e+11        96790330000         4616328000
        1 220  .5412541157123867       90219756750        47675232750         3.3484e+11        96612592500 4156828999.9999995
        1 221  .5558885518935109       91386468750  47876604374.99999       3.547406e+11        96434855000         3909162700
        1 222  .5432145303417135       91950119625        48210010875       3.591722e+11        96257117500 3131935799.9999995
        1 223  .5304926887004431       93536540250        48326661000       3.482489e+11        96079380000      2659990341.14
        1 224  .5813871683608844       94088283750        49248376125       3.706116e+11 102303717484.13725         4696375000
        1 225  .6264362994877993       94376484375        49183149000       3.612112e+11  108528054968.2745         3436546500
        1 226  .6144124756281355       94830229125        50154811875       3.557636e+11 114752392452.41174         4061570000
        1 227  .6036196169163662       95598729000        50520990000       3.420062e+11   120976729936.549         2446719200
        1 228   .557595971183086       97003693875  50892963749.99999       3.402343e+11 128394044952.41174         1943252700
        1 229  .5165993683972306       98014450875        51487278750       3.661225e+11  135811359968.2745 3453686899.9999995
        1 230    .52256270279738       98789167875        51467152125       3.773206e+11 143228674984.13724 3336749700.0000005
        1 231  .5279387371200369      100477170000        52594243125       3.821192e+11       150645990000 4021144500.0000005
        1 232  .5010813835321621      100599194250  52409520749.99999       3.917307e+11       142184992500         4330595700
        1 233  .4708229268022531      101610267375        52505622750       3.717932e+11       133723995000 3643660300.0000005
        1 234  .4912173155339743      103342632375        53281288125       3.692576e+11       125262997500         3041885800
        1 235  .5145629021298463      103858337625        53864960250       3.611079e+11        1.16802e+11 2081548700.0000002
        1 236  .5206598374934065      103959603000        53809216875       3.515405e+11       120876055000         4302404000
        1 237  .5263591823101572      105315673875        53877816000       3.548842e+11       124950110000         3252067000
        1 238  .5123128874388706      105246442500        54061590000       3.398723e+11       129024165000         3484420000
        1 239  .4991264865721077      103096581750  53396779124.99999       3.493866e+11       133098220000         4655882000
        1 240  .5492655600477985       92872677750        46354146375       3.514092e+11       132844477500 4017944999.9999995
        1 241  .5995894242147446      103234096125        51851349375       3.900461e+11       132590735000         2764237000
        1 242  .5310667908455162      101649256125        49915083750       3.912195e+11       132336992500 3716479999.9999995
        1 243  .4622753699465156      101256102000  49308861374.99999        4.32173e+11       132083250000         2508606000
        1 244 .49219083458974044      105833170500  52158728249.99999       4.287844e+11    146034543281.25  95046000.00000005
        1 245  .5168836524669478      111061245750  56757187874.99999       4.443542e+11     159985836562.5  641768399.9999999
        1 246   .536090115990483      109802857500  54817234124.99999       4.302915e+11 173937129843.74997         1418213370
        1 247  .5524410126078069      113408052375        58131594000       4.224977e+11 187888423124.99997          340202000
        2 167  .7792095983682614       7.08963e+10        36775875000       2.598143e+11        1.65843e+11 2420498800.0000005
        2 168  .7693948013437943       71682397500        36980302500 265220900000.00003       156271390000         2512864100
        2 169  .7582926532006832       72371550000  37237417499.99999       3.014455e+11       146699780000         2808673400
        2 170  .7456326940233197       72990101250        37397587500       2.967091e+11       137128170000         2999270200
        2 171  .7310631178469418       73064917500        37674723750        3.11617e+11       127556560000         2835626100
        2 172  .7270171352371367       73707705000        37669455000       3.332857e+11       139055575000 1067602059.9999999
        2 173  .7235891924563469       74309396250        37977150000       3.485292e+11       150554590000         3408400300
        2 174  .7206477259057192       75228266250        38367037500       3.537967e+11       162053605000         2958003600
        2 175  .7180960395432584       76805730000        38767462500        3.80331e+11       173552620000         3971983800
        2 176  .7136056310314048       77620278750        39168941250       3.840756e+11       198476320000         3076483700
        2 177   .710040873233593       78787833750        39411303750       3.814847e+11       223400020000         2474171400
        2 178  .7071310000742902       79552856250        39785385000        3.90242e+11 248323719999.99997         3437532100
        2 179  .7047029605769501       80181945000        40088865000       4.119808e+11 273247419999.99997         4247486000
        2 180  .7009858615588022       81152448750        40647352500       4.122591e+11       277055830000 3069163999.9999995
        2 181   .697367214467093       81995448750  41400783749.99999       3.813998e+11       280864240000         2613559000
        2 182  .6938432429376896       83380076250        41840197500       3.785668e+11       284672650000 1979742700.0000002
        2 183  .6904103530968567       84334773750        42162645000       3.646547e+11       288481060000         1878516500
        2 184  .6838043057195133       84820552500        42701111250       3.907873e+11       315402777500         1413515500
        2 185  .6782253741525354       86037633750  43121557499.99999       4.035424e+11       342324495000         1520128500
        end
        format %tq time
        label values countryid countryid
        label def countryid 1 "Austria", modify
        label def countryid 2 "Belgium", modify

        Comment


        • #5
          While I realize you've moved on from pvar, I want to point out that if what you wanted was "to control for each country separately" then
          Code:
          pvarsoc lgPCE lgGDP if countryid, maxlag(10)
          would not do what you want, but instead would simply run the pvarsoc command one time, including only those observations for which countryid is nonzero.
          Code:
          help if
          help by

          Comment


          • #6
            Thank you for the note William!

            Comment

            Working...
            X