Announcement

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

  • Difference in Number of Obs and Regression Model

    Hi guys,
    I have the question is that the number of Obs (A variable) is 1,746.
    However, when I run regression, tthe number of obs is 1,751.
    I do not know the reason why?
    Could you please let me know?
    Thank you in advance!


    sum A

    Variable | Obs Mean Std. Dev. Min Max
    -------------+---------------------------------------------------------
    A | 1,746 2.336577 .6250715 -1.479457 4.588375


    r regression Number of obs = 1,751
    F(219, 1750) = 5.72
    Prob > F = 0.0000
    R-squared = 0.2108
    Root MSE = .15951

    (Std. Err. adjusted for 1,751 clusters in double_cluster1)
    --------------------------------------------------------------------------------
    | Robust
    SemiexcessR | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    A | -.0496081 .0248835 -1.99 0.046 -.0984127 -.0008035

  • #2
    Hoa:
    if you did not impose an -if- qualifier when -sum-, this finding is a mistery.
    That said, could you please share what you typed annd what Stata gave you back (the whole code and output). Thanks.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,
      Yeah, I found my mistakes because I dropped my missing values in a wrong way.
      However, I fixed it.
      Thank for your valued comment!
      Hoa,

      Comment


      • #4
        Just so that future visitors of this thread are not mistified:

        It is totally normal that when you summarise one variable, say Y, you get more observations than if you do

        reg Y X Z W.

        For the first the count is the non-missing Ys, and for the second the count is the observations for which all of Y, X, Z, W are not missing. Obviously the second could be only as large as the first, and often it will be smaller if any of X, Z , W is missing for some observations.

        Getting results the other way round as OP did is a mistery, and suggest some error in code.

        Comment


        • #5
          Yes, it is a good point. Thank Joro!

          Comment

          Working...
          X