Announcement

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

  • dwstat errors

    Hello together,

    first to say, i am not a stata expert. I have a panel data set and did fixed effect regressions. Now i have to test for autocorrelation with durbin watson test.

    I tried two ways with either way ending in error:
    tsset companycode Yearcode

    Panel variable: companycode (unbalanced)
    Time variable: Yearcode, 1 to 10
    Delta: 1 year

    dwstat
    sample may not include multiple panels
    r(459);

    tsset Yearcode
    repeated time values in sample
    r(451);

    The dataset: Every Company has a year but some companys have only data for e.g 7 to 10.

    What can i do with my dataset to run the test?

    Last edited by Den Ro; 19 Jan 2022, 12:13.

  • #2
    Den:
    welcome to this forum.
    Have yiou already taken a look at the community-contributed module -xttest2- and -xtserial-?
    As an aside, the way panel dataset was -tsset- in your last code is not correct, as -panelid- should always be plugged in as the first term, followed by -tempvar-.
    If, when both terms have been plugged in after -tsset- (or -xtset-) Stata throws -repeated time values in sample- error message, you can simply -xtset- your panel dataset via -panelid- only.
    However, this fix comes at the cost of making time-series related operators, such as lags and leads, unfeasible.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Hi Carlo,
      thank you for your fast answer. I didnt look up the community-contributed modules, what are the benefits?
      I just realized i did a typo (I wrote tsset Year but did tsset Yearcode)

      I don't know if i get you. I tried to figure out what you said but i couldnt make it working:

      . xtset companycode Year

      Panel variable: companycode (unbalanced)
      Time variable: Year, 2010 to 2019
      Delta: 1 unit

      . dwstat
      sample may not include multiple panels
      r(459);

      . tsset Yearcode
      repeated time values in sample
      r(451);

      . tsset companycode Yearcode

      Panel variable: companycode (unbalanced)
      Time variable: Yearcode, 1 to 10, but with gaps
      Delta: 1 unit

      . dwstat
      sample may not include multiple panels
      r(459);

      . xtset companycode

      Panel variable: companycode (unbalanced)

      . dwstat
      time variable not set, use tsset varname ...
      r(111);

      I am new to Statistical software, sorry for maybe not getting the basics.

      Comment


      • #4
        Den:
        1) the advantage of using community-contributed modules is that they are tailored for situations that are not covered in details by Stata built-in commands;
        2) -dwstat- cannot work with your data;
        3) -tsset Yearcode- is wrong either.

        Take a look at -xt- suite of commands in Stata .pdf manual and related references.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment

        Working...
        X