Announcement

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

  • No observations error (r2000) using xtbond

    I am getting no observations error (r2000) whenever I use xtabond or xtabond2 command. Using stata14 on Microsoft windows, I am trying to find the lagged effect of infrastructure investment on company performance. The data is quarterly panel data where i is the company and time is quarterly year. Is it the structure of my data that is causing the problem?


    input float(i time infrainv roa debttototalassets)
    3 17167 0 .04537837 .14321952
    3 17256 0 -.065482356 .07111654
    3 17347 0 -.09821128 .0641095
    3 17439 0 -.15175483 .0556416
    3 17531 0 -.4903078 .008405073
    3 17532 0 -.4903078 .008405073
    3 17622 0 -.009918966 .008477443
    3 17713 0 -.020889405 .008273439
    3 17805 0 -.04711184 .008262056
    3 17897 0 -.13522986 .008677849
    3 17898 0 -.13522986 .008677849
    3 17987 0 -.009692428 .008599659
    3 18078 0 -.007131842 .008312433
    3 18170 0 -.00242345 .00816882
    3 18262 0 .05913557 .007621267
    3 18263 0 .05913557 .007621267
    3 18352 0 -.018252162 .007714956
    3 18443 0 .026699027 .007226598
    3 18535 0 .031937696 .007124072
    3 18627 0 .011894713 .006897815
    3 18628 0 .011894713 .006897815
    3 18717 0 -.02189715 .006853157
    3 18808 0 -.04486535 .006808427
    3 18900 0 -.06973182 .006778379
    3 18992 0 -.1014094 .0067349
    3 18993 0 -.1014094 .0067349
    3 19083 0 -.0013787354 .006529172
    3 19174 0 -.007219211 .006449025
    3 19266 0 -.01885759 .006338787
    3 19358 0 .0015361225 .006011167
    3 19359 0 .0015361225 .006011167
    3 19448 0 -.016553322 .006245601
    3 19539 0 -.01036206 .00578347
    3 19631 0 -.014032762 .00575888
    3 19723 0 .04953352 .006459419
    3 19724 0 .04953352 .006459419
    3 19813 0 -.006701009 .006322449
    3 19904 0 .0037907965 .005377225
    3 19996 0 .005929627 .005134092
    3 20088 0 .018620526 .005475138
    3 20089 0 .10060038 .1154004
    3 20178 0 -.0021117036 .005311222
    3 20269 0 -.003513036 .005472044
    3 20361 0 .08535425 .10861032
    3 20453 0 .10739034 .063609585
    3 20454 0 .10739034 .063609585
    3 20544 0 .02113936 .18253955
    3 20635 0 .03685101 .38174775
    3 20727 0 .05220349 .4058178
    3 20819 0 .06968259 .3447102
    3 20820 0 .06961187 .3447102
    3 20909 .08250375 .014929133 .3600297
    3 21000 .08590774 .034817357 .3356753
    3 21092 .08329367 .04771492 .3716981
    3 21184 0 .04352673 .3702734
    4 17167 0 .06864819 .24375772
    4 17256 0 .016532712 .28224394
    4 17347 0 .03991171 .27815637
    4 17439 0 .031319417 .19174
    4 17531 0 .07652897 .1746693
    4 17532 0 .07652897 .1746693
    4 17622 0 .009699469 .16897014
    4 17713 0 .02997729 .1716157
    4 17805 0 .03106058 .11948284
    4 17897 0 .05348563 .11576545
    4 17898 0 .05348563 .11576545
    4 17987 0 .00985275 .1501881
    4 18078 0 .033526774 .12464748
    4 18170 0 .03863647 .1505511
    4 18262 0 .06293538 .13544242
    4 18263 0 .06293538 .13544242
    4 18352 0 .010418573 .11530512
    4 18443 0 .025579536 .12825252
    4 18535 0 .026639063 .13466868
    4 18627 0 .05506891 .12161342
    4 18628 0 .05506891 .12161342
    4 18717 0 .007016548 .09580734
    4 18808 0 .016926713 .09787344
    4 18900 0 .01979888 .08213361
    4 18992 0 .05325411 .07667705
    4 18993 0 .05325411 .07667705
    4 19083 0 .00657063 .10743538
    4 19174 0 .01821918 .12587851
    4 19266 0 .02342796 .11584563
    4 19358 0 .05544338 .12128884
    4 19359 0 .05544338 .12128884
    4 19448 0 .00573001 .09903709
    4 19539 .0015697222 .016447248 .08434923
    4 19631 0 .02162792 .0944167
    4 19723 0 .05064997 .08723516
    4 19724 0 .05064997 .08723516
    4 19813 0 .0040762634 .09727043
    4 19904 0 .01365789 .1111415
    4 19996 0 .018380117 .10170295
    4 20088 0 .04917197 .07267673
    4 20089 0 .04917197 .07267673
    4 20178 0 .0022239976 .05551604
    4 20269 0 .016236376 .05264627
    4 20361 0 .0216352 .05381881
    4 20453 0 .05421076 .05847573

  • #2
    First a disclaimer: the total extent of my knowledge about -xtabond- and -xtabond2- is that they are regression commands that use lags. But that is all I need to answer the immediate question.

    The problem is with your time variable. In your mind, it is a quarterly variable, because those dates actually mark the start of quarters. And I'll even bet you have them formatted %td, so that the appearance of the data in the browser or in listings reinforces your belief that you have a quarterly variable. But to Stata, these are daily variables that are spaced variably, averaging about 91 days apart. So when you invoke a command that looks for L.time, Stata wants to see an observation that has the date one day before, not one quarter before. Since there aren't any such, Stata appropriately complains that you have no observations.

    The solution is to create an actual quarterly date variable:

    Code:
    gen quarterly_date = qofd(time)
    format quarterly_date %tq
    xtset i quarterly_date
    xtabond whatever
    Added: Well, actually, this won't quite work with your data. There is an additional problem in your data: you have observations for both 1 Jan and 31 Dec of the immediately preceding year. So you actually have 5 observations in each calendar year, and the 1 Jan and 31 Mar observations will always be in the same quarter. So you won't be able to -xtset- this data. You need to get rid of the 1 Jan observations. (Or get rid of the 31 Dec observations and re-assign 31 Dec of the preceding year to the 1 Jan observations.) But however you do it, you need to get actual quarterly data if you want to proceed.
    Last edited by Clyde Schechter; 19 Aug 2018, 13:02.

    Comment


    • #3
      Welcome to Statalist.

      When displayed using a %td format, your first five time values are 1jan2007, 31mar2007, 30jun2007, 30sep2007, and 31dec2007.

      Your time variable is a Stata Internal Form (SIF) daily date, rather than a SIF quarterly date which is what you need for your analysis. For example, when time=30jun2007, the end of the second quarter, the lagged value of time (L1.time) is 29jun2007 - for which you have no data. So xtabond found no observations for which the necessary lagged values were available, which led to the error message you received.

      You will need to convert your SIF daily date values in the time variable into SIF quarterly date values. And with that, you should change your first time value to 31dec2006 so that it becomes the 4th quarter of 2006, rather than an additional observation in the first quarter of 2007.

      How do you do the conversion?

      Stata's "date and time" variables are complicated and there is a lot to learn. If you have not already read the very detailed Chapter 24 (Working with dates and times) of the Stata User's Guide PDF, do so now. If you have, it's time for a refresher. After that, the help datetime documentation will usually be enough to point the way. You can't remember everything; even the most experienced users end up referring to the help datetime documentation or back to the manual for details. But at least you will get a good understanding of the basics and the underlying principles. An investment of time that will be amply repaid.

      All Stata manuals are included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through the PDF Documentation section of Stata's Help menu.

      In reading the documentation, you will want to pay particular attention to the section that explains how Stata represents various types of SIF dates, and the section on SIF-to-SIF conversion, which will point you to the qofd() function.

      Added in edit: This crossed with Clyde's answer, essentially the same as mine. Do not neglect the reading I recommended.
      Last edited by William Lisowski; 19 Aug 2018, 13:12.

      Comment

      Working...
      X