Announcement

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

  • xtpcse instead of xtreg

    Hi,
    I used a dataset from a lab experiment
    xtreg dep i1 if i2==0 & i3==0
    and xtreg dep i1 i2 i3
    The coefficient of id remained the same but the standard error changed so there must be some kind of problem. Adding “,robust” did not help, standard errors were still (slightly) different.

    When I use xtpcse for the dataset (with the option “hetonly”) standard errors are the same in the two regressions (coefficients are exactly as for xtreg).

    Is that the solution? Just say the panel is heteroskedastic and thus I need to use xtpcse?

  • #2
    It could very much help if you showed exact code and output and explained what the variables are. What are these i variables? Are they all dummies created from a single categorical variable? You make reference to the coefficient for id but id is not in the model, at least by that name (do you mean i1?)
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    Stata Version: 17.0 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      id1 id2 id3 are dummy variables for treatments 2-4, so they are 0 or 1. (problem remains when I use a larger dataset with more id-variables)
      dep variable ranges from 0-10

      The code looks as follows

      case 1

      xtreg dep id1 if id2==0 & id3==0, robust

      Random-effects GLS regression
      Group variable: subject

      (Std. Err. adjusted for 24 clusters in subject)
      ------------------------------------------------------------------------------
      | Robust
      dep | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      id1 | a 1.559803 . 0.001 .
      _cons | .
      -------------+----------------------------------------------------------------

      case 2

      xtreg dep id1 id2 id3, robust

      Random-effects GLS regression
      Group variable: subject


      (Std. Err. adjusted for 48 clusters in subject)
      ------------------------------------------------------------------------------
      | Robust
      dep | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      id1 | a 1.514323 . 0.001
      id2 | .
      id3 | .
      _cons | .
      -------------+----------------------------------------------------------------
      Hope, it's ok that I deleted some information from the output

      Coefficient for id1 (lets call the coeff. a) is identical in both regressions

      Std. Err. is 1.559803 and 1.514323 but it should be identical?

      Using reg instead of xtreg (with same paramates as above, including ,robust) produces identical SE
      xtpcse with the option “hetonly” output has also identical SE

      Comment


      • #4
        I should have added that you should use the code formatting features. When writing message, click on the A (next to the smiley) and click on #. This will create two code tags; enter your code and output between them. As it is your output is very hard to read. And, I am not sure why you have censored things like the actual value of the coefficient.

        Even if the coefficients are the same, the Ns will differ as well as the Ks (# of variables). I suspect that accounts for the small differences in the standard errors. I can't really comment on the other things you tried because you do not show the actual code and output.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment

        Working...
        X