Announcement

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

  • Why the number of observations is so small?

    I used "xtset" to declare my dataset is panel data. The data looks like things below:
    code country years var_1 var_2
    1 a 2000 ...(numeric) ...(numeric)
    1 a 2001
    2 b 2000
    2 b 2001
    ... ... ...
    Code:
    xtset code year
    then I run

    Code:
    xtreg var_1 var_2
    and got the number of observations much lower than the one I truly have (number of rows of the table above). Why does STATA drop a lot of observations? Do I have to reshape the table so that the years are unique? If I do this, I lose many observations actually. I just want to see how the regression goes across countries over time, not only for one specific country over time.

    Thanks for your help.

  • #2
    This example shows one way of viewing the data for the observations that were dropped. Perhaps that will lead you to some understanding of the problem.
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . count
      74
    
    . reg price rep78
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(1, 67)        =      0.00
           Model |  24770.7652         1  24770.7652   Prob > F        =    0.9574
        Residual |   576772188        67  8608540.12   R-squared       =    0.0000
    -------------+----------------------------------   Adj R-squared   =   -0.0149
           Total |   576796959        68  8482308.22   Root MSE        =      2934
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           rep78 |   19.28012   359.4221     0.05   0.957    -698.1295    736.6897
           _cons |   6080.379    1274.06     4.77   0.000     3537.345    8623.413
    ------------------------------------------------------------------------------
    
    . list price rep78 if !e(sample)
    
         +----------------+
         |  price   rep78 |
         |----------------|
      3. |  3,799       . |
      7. |  4,453       . |
     45. |  6,486       . |
     51. |  4,424       . |
     64. | 12,990       . |
         +----------------+

    Comment


    • #3
      To extend William's comment, Stata's regression estimator drops observations that a missing for any of the variables. You might find misstable useful.

      Comment

      Working...
      X