Announcement

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

  • OLS Observation Count

    Hi,

    I am running an OLS regression in which the main regressor variable is a binary variable. I would like to know in the case I have for instance 9,300 observations, how many of those are 1s and 0s. Many thanks!

    Kind regards,
    Vlad

  • #2
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . regress mpg foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     13.18
           Model |  378.153515         1  378.153515   Prob > F        =    0.0005
        Residual |  2065.30594        72  28.6848048   R-squared       =    0.1548
    -------------+----------------------------------   Adj R-squared   =    0.1430
           Total |  2443.45946        73  33.4720474   Root MSE        =    5.3558
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |   4.945804   1.362162     3.63   0.001     2.230384    7.661225
           _cons |   19.82692   .7427186    26.70   0.000     18.34634    21.30751
    ------------------------------------------------------------------------------
    
    . tab foreign if e(sample)
    
       Car type |      Freq.     Percent        Cum.
    ------------+-----------------------------------
       Domestic |         52       70.27       70.27
        Foreign |         22       29.73      100.00
    ------------+-----------------------------------
          Total |         74      100.00
    
    . tab foreign if e(sample), nola
    
       Car type |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              0 |         52       70.27       70.27
              1 |         22       29.73      100.00
    ------------+-----------------------------------
          Total |         74      100.00
    The qualifier

    Code:
    if e(sample)
    spells out "for observations included in the previous regression", which is often important.

    Comment


    • #3
      Thank you Nick! This answered my question.

      Kind regards,
      Vlad

      Comment

      Working...
      X