Announcement

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

  • STATA not displaying output with 'di' command

    Hi everyone- super basic question. I am trying to display scalar output using the 'di' command as well as scalars using the 'return list' command. Nevertheless, STATA is only returning a '.' when I use the display command, i.e. not actually displaying any output. Is display meant to display output somewhere else? If not, how can I see my output?

  • #2
    display will show an isolated dot, period or stop, meaning system missing, the generic numeric missing value, whenever that is appropriate. Here is an example:

    Code:
    . di 42/0
    .
    Try to divide 42 by 0 and Stata shrugs its shoulders the only way it knows. Its sense of irony is limited.

    In the case of returned values, it could be either that missing was returned or that a non-missing result has been overwritten by missing given a later command of the same class. Here is an example:

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . qui tab mpg
    
    . di r(r)
    21
    
    . su mpg
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
             mpg |         74     21.2973    5.785503         12         41
    
    . ret li
    
    scalars:
                      r(N) =  74
                  r(sum_w) =  74
                   r(mean) =  21.2972972972973
                    r(Var) =  33.47204738985561
                     r(sd) =  5.785503209735141
                    r(min) =  12
                    r(max) =  41
                    r(sum) =  1576
    
    . di r(r)
    .
    tabulate is an r-class command so r(r) -- the number of rows in the table just produced -- is accessible immediate afterwards. If we then run summarize, another r-class command, the number of rows is no longer accessible as such.

    In anthropomorphic terms, Stata is saying "I don't know what that is.".

    Comment


    • #3
      Thanks for your reply. This is a code excerpt of my regression:





      Code:
      xtivreg PPVT_RAW_perco ib2.round i.chsex ib1.chlang2 ib1.chethnic2 ib1.ageorder  st_agemon ib90.clustid i.typesite wi_new hhsize dadedu MOLISA numante2 (zhfa2  = MTHEIGHTM shenv1_R2 shecon1_R2 lowbwght NegativeRainfallShockBINARY2001) if round >=2, re vce(cluster CHILDID)
      
      scalar rss= e(rss)
      scalar df1= e(df_r)
      
      
      xtivreg PPVT_RAW_perco ib2.round i.chsex ib1.chlang2 ib1.chethnic2 ib1.ageorder  st_agemon ib90.clustid i.typesite wi_new hhsize dadedu MOLISA numante2 (zhfa2  = MTHEIGHTM shenv1_R2 shecon1_R2 lowbwght NegativeRainfallShockBINARY2001) if round >=2 & typesite==1, re vce(cluster CHILDID)
      scalar rssURBAN= e(rss)
      scalar df1a=e(df_r)
      
      
      
      xtivreg PPVT_RAW_perco ib2.round i.chsex ib1.chlang2 ib1.chethnic2 ib1.ageorder  st_agemon ib90.clustid i.typesite wi_new hhsize dadedu MOLISA numante2 (zhfa2  = MTHEIGHTM shenv1_R2 shecon1_R2 lowbwght NegativeRainfallShockBINARY2001) if round >=2 & typesite==2, re vce(cluster CHILDID)
      
      scalar rssRURAL= e(rss)
      scalar df1b= e(df_r)
      
      scalar rssUn= rssRURAL + rssURBAN
      
      
      scalar f1=((rss-rssUn)/(df1-(df1a+df1b))/((rssUn)/(df1a+df1b)))
      di invFtail((df1-(df1a+df1b)),(df1a+df1b),.01)
      di invFtail((df1-df1a-df1b),(df1a+df1b),.05)
      return list
      When I do this, STATA displays:

      scalars r (level)
      matrices r (table)

      Is there a way to display my output , and can you see any obvious problems with the above code?
      Last edited by Thomas Kurian; 16 Apr 2021, 15:07.

      Comment


      • #4
        return list may usefully follow r-class commands but e-class commands should be followed by ereturn list

        Comment


        • #5
          After the third line, did you try using:
          Code:
          display rss
          display df1
          to check if they are actually valid values?

          I checked the technical document using -help xtivreg- and it seems that the estimate e(df_r) is only available when the option "small" was specified. Scroll way down for the list of estimates to check that description. I didn't see "small" among your regression options. So, all those "dfxx" could be missing values all along.

          Comment


          • #6
            Hi Ken- it appears that , using the small command, I can obtain df_r. However, I am unable to view the RSS (residual sum of squares) in my equation and can only see the R^2 (both for the overall model as well as respective within R^2). Do you know if it is possible to obtain the RSS for a model using xtivreg?

            Comment

            Working...
            X