Announcement

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

  • Cutting out the appropriate end of the variables

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(quarter Dlprod) double lrea float Dlop double inf float(Dlrgdp Dlexc)
     80             .   39.13813266666667            .  7.74278215223094            .            .
     81   -.035614014  60.410011999999995 -.0036604404  10.2464332036316   -.04316902 -.0008628368
     82    -.01580906   51.08060033333334   -.08054447   12.291933418694  -.028956413  -.020701766
     83    -.03905678           62.466026    .17828774  13.1147540983606    .08399487    .03753448
     84     .02488899   58.54461133333333   -.04705215  14.7381242387332   -.01137352    .06241119
     85   -.021674156  40.808108000000004   -.10607576                14  -.022613525    .06047547
     86    -.04679394   20.17195633333333   -.05337715  13.5689851767389  -.015737534    .06826341
     87    .001235962  12.483683466666667    .05288005  12.3745819397994    .05860233   -.04127169
     88   -.015400887  -.2111375666666667   -.08884788  11.8895966029724   -.01995945   .019032836
     89   -.028642654   .5451751000000004    .04567003  11.0423116615067  -.025244713    .02091241
     90    .020044327  -37.34087466666667  -.009387732  10.8433734939759  -.009765625    .08882523
     91     .02977276  -23.72058266666667   -.00683546  11.6071428571428    .06259918   .073213935
     92   -.070046425 -13.459465066666667    -.0800426  9.77229601518024  -.009399414  -.005073905
     93     .02050209 -12.350081633333332   .010914087   9.1078066914498   .007008553  .0083755255
     94     .04874039 -33.336627666666665    .02732563  7.78985507246374  -.017912865   .032039404
     95   .0018424988  -27.24211366666667   -.04581285  7.28888888888891   .065146446   .013346195
     96   -.002747536          -23.977575   .010084867  6.30942091616251    .00942421    .02453232
     97    .005511284          -18.353044   .002732754  6.47359454855195  -.020303726    .00676179
     98   -.017630577          -27.757518   -.04061341  6.13445378151261    .02085972    .07764363
     99    .002876282  -20.14504066666667  -.023606777  5.96520298260146    .04980183    .05618048
    100   -.003787041          -25.616022 -.0044965744  5.69105691056911   .011543274    .05679584
    101   -.023112297 -26.788110666666668  -.015342474  5.75999999999999  -.036082268   -.05182862
    102    .002131462          -52.681589   .005304575  5.77988915281077    .01897907   -.06399655
    103     .06078339  -36.48232166666667   .035532236  5.62939796716187    .06870365   -.06899428
    104   -.012742996  -48.39284266666667     -.492239  5.76923076923076   -.02629471   -.06177926
    105    .014677048  -65.86139466666667    -.3213961  6.05143721633889  -.005705833    .01131153
    106     .02001858  -71.29853133333333            0  8.00898203592812 -.0007314682 -.0021862984
    107    -.02536392          -53.494223     .1625726  8.80829015544041    .07444286   .011133432
    108   -.019616127 -41.291238666666665    .19018364  9.96363636363637   -.04241371   -.05986404
    109    .006961823          -25.291703    .03786588  9.70042796005709   .003426552   -.04718626
    110     .05217457          -25.120687   .029469013  7.90020790020794   -.03904152  .0028271675
    111  -.0039129257 -11.800554066666665  -.064515114  7.41496598639454    .09070873   -.03897548
    112    -.01266098  11.860477533333333   -.11970901  7.07671957671957    -.0380516  -.016815186
    113    .004841805  3.7127351333333336    .02114606  7.02210663198959   -.03488922  -.017273188
    114    .017139435  -8.790290666666666   -.13296938  6.61528580603723  -.009062767    .08864713
    115     .04496288   5.500527566666666  -.069060326  6.01646611779607    .06791592   -.03344822
    116    -.04605198            15.59104    .25841665  4.69425571340333   -.05028057   .016834259
    117    .008478165  13.602316466666666    .08156276  4.67800729040098    .02255535     .0415448
    118     .01911831  2.1667307900000004   -.05910301  4.51807228915663  -.024207115   .004276037
    119     .02155781  14.136153666666667   .072547674  4.30107526881723    .07222748  -.027472496
    120  -.0012311935  13.700408666666668    .03893995  4.36578171091446   -.02434349   -.04696953
    121   -.003965378  -6.543706466666666   -.20725727  3.83052814857803  -.025891304  -.006798387
    122    -.03584957 -20.250679666666667     .4835284  3.80403458213255  -.011367798   -.05305231
    123     .02464962  -8.576893003333334     .1891837    4.524627720504     .0831728   -.04859436
    124    .000743866   9.022044406666666    -.4457831  3.90050876201245    -.0319252   .018657684
    125   -.023163795  13.382336333333333   -.07966495  3.80100614868644   .013855934    .12299943
    126    .015841484   5.221383433333333    .05793595  3.49805663520268  -.028817177   .008721352
    127    .011842728           8.4833935   .022568226  2.57534246575342    .06528664  -.063886166
    128   -.005056381          -9.1815819    -.1264615  2.33949945593033    .00262928  -.005768895
    129    -.01706028 -19.907728666666667     .1171906   2.4232633279483  -.030332565  -.006651998
    130    .005515099  -32.55594233333333   .015793324  2.30686695278971   .008387566   -.08576798
    131    .014642715 -20.428037666666665   -.05341005  2.24358974358973    .05217743    .09891403
    132  -.0008001328  -8.793030700000001   -.05233955  2.60499734183944   -.03020191    .08356285
    133   -.017170906  4.2965170666666666 .00018525124  2.41850683491062  -.012756348   -.01551175
    134    .006093025  -6.222860533333333      -.10499  2.14997378080752   .016050339    .05739963
    135    .009690285 -13.556194533333333   -.07940865  1.98537095088822     .0934496    .01007378
    136     .00741005 -23.626597333333333   -.07587433   1.2435233160622   -.04366684   .015948415
    137  -.0029649734         -8.37051217    .15959454  .975359342915802    .00847435  -.031848192
    138   .0015182495 -1.6039786999999996    .04682732  1.54004106776183   -.02486992   -.05193007
    139    .017782211  23.068966333333332  -.026546717  1.74180327868853    .09761047  -.016186953
    140  -.0010061264  31.917483333333337   .036661625  2.66120777891503   -.02917862  -.032115936
    141    .003125191   36.41205033333333    .05387354  2.69445856634468  -.031635284   -.04464781
    142     .00968361  29.452066666666667    -.1004212   2.3255813953488    .02602291   .010604978
    143    .003537178   9.859649666666668   .032122374  2.16515609264855    .07105446 -.0038758516
    144    .007936478 -3.9989844666666663     .0757897  .897308075772663  -.011328697    .02155018
    145 -.00010108948  -9.716630499999999    .06210089  .990099009900991  -.030052185   .018499613
    146     .00338459  -34.44321300000001     .0570159  1.38339920948619   .029580116   -.01876986
    147    .016378403 -12.624126133333334    .11149788  1.77427304090683    .04030895   .003127813
    148    .010835648          -4.8125161   -.08976126  3.06324110671939  -.017730713     .0299412
    149   -.000919342 -15.160078333333333   -.13125277  2.69607843137256    .03354168    .06529093
    150    .006411552          -15.143239    .00897336  2.29044834307992  -.025523186    .05278087
    151    .013442993 -18.731099999999998   .009778738  2.22760290556901     .0763483   -.04578638
    152    .018574715  -35.81994366666667   -.28532577  2.15723873441995   -.01279831    .05636358
    153   -.007968903  -46.57734100000001  -.064397335   2.2434367541766   -.02697754  -.003437281
    154   -.016814232           -59.66092  -.021053314  2.28680323963794   -.02005291    .01630497
    155    .005273819  -49.17695533333333   -.09287786  2.32117479867363    .06525898  -.019602537
    156    .007332802  -56.07041733333333  -.017594099  2.25246363209761   -.02033615   .022954226
    157   -.030688286 -42.895834666666666     .3197281  2.47432306255837  -.023492813   .017477036
    158    .010526657  -36.91814933333333     .2431948  2.04937121564973   .013630867   .005753994
    159    .003252983          -13.267707    .15230894  2.68518518518515    .07452679   .006227255
    160     .01356125  -5.286501533333333    .11157179  2.89123451124368 -.0006017685    .04070139
    161     .01726532   4.948936066666667   .005619764  2.91571753986331    -.0603199    .06567001
    162    .017752647   6.775513666666666    .11014366  3.42309447740759   .008555412   .019916296
    163     .00973606   8.435973533333334  -.007164478  3.11091073038775    .06538296   .032980442
    164   -.011986732  -2.792858986666667   -.12935114  3.52363960749332  -.005785942   -.04024959
    165    -.02381325          -9.4281721   .024876595  3.93979637007527   -.04561424   .032016277
    166    .009342194  -40.64816866666667   -.05828905   2.5595763459841   .010370255  -.020018816
    167   -.003803253 -57.250793666666674   -.26657724   2.0113686051596    .06894302  -.010724306
    168   -.013516426  -45.27946333333333     .0800693   1.0340370529944   -.04633999  .0009560585
    169   -.004775047 -40.545537333333336     .1861112  .468483816013621    .02115917   -.08499837
    170    .008533478  -38.74795833333334   .066512346  1.41996557659209   -.03976345   -.08406281
    171    .018037796          -4.0900479  -.007452488  2.22888984140592    .07687569   -.02767825
    172    .008569717          10.6210139     .1587529  4.60554371002131   -.02139473   -.03637564
    173   -.006990433   32.22018033333333   -.16814756  2.24671470962272   -.04574585  -.006904006
    174   .0085430145   39.52709866666667     .0691607  1.90920661858297   .011060715    .04578185
    175    .029878616  102.57146666666665    .03383112  1.21593291404613   .064902306     -.058622
    176    .009285927           121.67917    .09015703 -1.42682429677945   .014725685  -.001775503
    177    .002621651           83.438888    .10330415  .829187396351576   -.03930473  -.006779671
    178    .013513565           94.319298    .12952352  1.20732722731057  -.018507004 .00048577785
    179    .005133629  117.48598333333335    .05228329  1.24275062137531    .08005524    -.0803665
    end
    format %tq quarter
    Hi guys, I'm a little confused with the estimation of the var model. Basically, I did the ADF, DF-GLS and Phillips-Perron tests to check for stationarity of the variables and found only two variables in my var model to be stationary (i.e. lrea - log of real economic activity index & inf - inflation rate (%)).The rest of the variables are first differenced in order to induce stationarity. However, in doing so, expectedly, I have different number of observations for my my differenced variables and the ones that are non-differenced. How do remove the last observation for the undifferenced variables (lrea and inf)


    summarize Dlprod lrea Dlop Dlrgdp inf Dlexc

  • #2
    It's not clear to me that you want to remove the last observation for the undifferenced variables.

    Look at your first observation - that's where you have two lrea and inf with the differenced ones are missing.

    You don't tell us why you want to remove the observation. In general it's not necessary - Stata does "casewise omission" and will omit any observation from estimation where one or more of the variables is mssing.

    Because summarize is not an estimation command it computes the summary statistics separately for each variable. Below I show two summary commands - the one you used, and the one that includes only complete observations.
    Code:
    . summarize Dlprod lrea Dlop Dlrgdp inf Dlexc
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
          Dlprod |         99    .0016682    .0205442  -.0700464   .0607834
            lrea |        100   -3.904499    37.65133  -71.29853   121.6792
            Dlop |         99    .0018497    .1366445   -.492239   .4835284
          Dlrgdp |         99    .0072069    .0422466  -.0603199   .0976105
             inf |        100    4.729691    3.582737  -1.426824   14.73812
    -------------+---------------------------------------------------------
           Dlexc |         99    .0024959    .0447392   -.085768   .1229994
    
    . summarize Dlprod lrea Dlop Dlrgdp inf Dlexc if Dlprod!=.
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
          Dlprod |         99    .0016682    .0205442  -.0700464   .0607834
            lrea |         99   -4.339273    37.58979  -71.29853   121.6792
            Dlop |         99    .0018497    .1366445   -.492239   .4835284
          Dlrgdp |         99    .0072069    .0422466  -.0603199   .0976105
             inf |         99    4.699256    3.587954  -1.426824   14.73812
    -------------+---------------------------------------------------------
           Dlexc |         99    .0024959    .0447392   -.085768   .1229994

    Comment


    • #3
      Thanks William, makes sense, I was just worried it might cause problems with my estimation.

      Comment

      Working...
      X