Announcement

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

  • dfuller - "no observations" error message

    I am attempting to run the dfuller command, but I get the error message "no observations". My data is tsset and has no missing observations. I did see a similar question posted on this forum but it did not have an answer. Thank you for your help.


    Code:
    freduse TB3MS if daten<td(31dec2009), clear
    rename * , lower
    
    tsset daten
    
    tsline tb
    dfuller tb3ms, lags(12)

  • #2
    Your problem is that the user-written freduse command (available from SSC) creates daten as a daily date variable, when that FRED date is actually a monthly variable to which the first day of the month has been assigned.
    Code:
    . list in 1/5, clean
    
                 date   tb3ms       daten  
      1.   1934-01-01     .72   01jan1934  
      2.   1934-02-01     .62   01feb1934  
      3.   1934-03-01     .24   01mar1934  
      4.   1934-04-01     .15   01apr1934  
      5.   1934-05-01     .16   01may1934
    Note that your tsset command suggested this sort of problem with its warning about gaps and its indication that the delta was 1 day despite the apparently monthly nature of the start and end values.
    Code:
    . tsset daten
            time variable:  daten, 01jan1934 to 01dec2009, but with gaps
                    delta:  1 day
    You need to create a Stata monthly date variable from your daily date variable. The code below points the way.
    Code:
    . freduse TB3MS if daten<td(31dec2009), clear
    (992 observations read)
    (80 observations deleted)
    
    . rename * , lower
    
    .
    . generate datem = mofd(daten)
    
    . format datem %tm
    
    . tsset datem
            time variable:  datem, 1934m1 to 2009m12
                    delta:  1 month
    
    . list in 1/5, clean
    
                 date   tb3ms       daten    datem  
      1.   1934-01-01     .72   01jan1934   1934m1  
      2.   1934-02-01     .62   01feb1934   1934m2  
      3.   1934-03-01     .24   01mar1934   1934m3  
      4.   1934-04-01     .15   01apr1934   1934m4  
      5.   1934-05-01     .16   01may1934   1934m5  
    
    .
    . dfuller tb3ms, lags(12)
    
    Augmented Dickey-Fuller test for unit root         Number of obs   =       899
    
                                   ---------- Interpolated Dickey-Fuller ---------
                      Test         1% Critical       5% Critical      10% Critical
                   Statistic           Value             Value             Value
    ------------------------------------------------------------------------------
     Z(t)             -1.995            -3.430            -2.860            -2.570
    ------------------------------------------------------------------------------
    MacKinnon approximate p-value for Z(t) = 0.2886
    
    .
    Last edited by William Lisowski; 13 Sep 2016, 10:35.

    Comment


    • #3
      Works perfectly, thank you!

      Comment

      Working...
      X