Announcement

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

  • Typo in xtile.ado with option altdef

    Line 135 of xtile.ado appears to contain a typo. The line reads

    Code:
        args wt x newvar nq altdev
    However, as best I can tell it should read

    Code:
        args wt x newvar nq altdef
    To see the incorrect behavior, consider

    Code:
    set rmsg on
    clear
    set obs 10
    gen x = _n
    xtile x1 = x, nq(7)
    xtile x2 = x, nq(7) altdef
    pctile p1 = x, nq(7)
    pctile p2 = x, nq(7) altdef
    xtile xp1 = x, c(p1)
    xtile xp2 = x, c(p2) altdef
    l
    This shows
    Code:
         +------------------------------------------+
         |  x   x1   x2   p1         p2   xp1   xp2 |
         |------------------------------------------|
      1. |  1    1    1    2   1.571429     1     1 |
      2. |  2    1    1    3   3.142857     1     2 |
      3. |  3    2    2    5   4.714286     2     2 |
      4. |  4    3    3    6   6.285714     3     3 |
      5. |  5    3    3    8   7.857143     3     4 |
         |------------------------------------------|
      6. |  6    4    4    9   9.428572     4     4 |
      7. |  7    5    5    .          .     5     5 |
      8. |  8    5    5    .          .     5     6 |
      9. |  9    6    6    .          .     6     6 |
     10. | 10    7    7    .          .     7     7 |
         +------------------------------------------+
    x1 == x2, but this should not be the case. Using cutpoints and pctile we get the different (and expected) results. I only have access to Stata for Unix, but this is present in 13, 14, and 15.

  • #2
    I can confirm this is also true in xtile.ado under Stata 15 for Windows -- as you would expect, as the system ado files are platform-independent, I guess. I think Mauricio Caceres spotted a bug here.

    Does someone from StataCorp read here and can confirm this? If not, you should probably raise a support ticket with Stata technical support.

    Regards
    Bela

    Comment


    • #3
      I've sent the reference of this thread to StataCorp technical support.

      Comment


      • #4
        I can confirm that this is indeed a typo in the code. We will fix it in a future update.

        Comment

        Working...
        X