Announcement

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

  • Percentiles method used in STATA compared to R

    Hi there,

    I am having trouble figuring out what methods STATA uses to evaluate percentiles. I analysed my data in STATA using the command 'centile'
    for example centile Byg, centile (2.5, 25, 70, 90, 97.5) level 95 and I compare the result with the output from R software. I notice that the centile and 95% CI (using binomial exact CI) outputs are different between STATA and R.

    Can someone help please and advice how I can change between methods?

    Many thanks in anticipation of your support

  • #2
    The method used by Stata is documented in the documentation, in particular the section "methods and formulas" in the entry for centile in the .pdf manual. The easiest way to get there is to type in Stata help centile, which will open the help file. At the top you will see [R] centile - Report ..., where the [R] centile part is blue and thus a link. This is a link to the .pdf manual entry for centile.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Take a look at this paper: Hyndman, R. J. and Y. Fan, Y (1996) Sample quantiles in statistical packages. American Statistician (American Statistical Association), 50 (4):361–365.

      In short, they describe 9 different methods for computing percentiles. To my knowledge, after reading Stata documentation time ago (as Maarten has suggested you should), Stata uses Hyndman&Fan method #2, while SPSS/SAS use by default #6 (available in Stata using the altdef option in pctile/xtile commands), and Excel uses method #7, as R does, by default, although there are R packages that compute all 9 methods. For big sample sizes, the difference is trivial/non existent, but for relatively small sample sizes, the different can be rather important.

      HTH,
      Marta GG

      Comment


      • #4
        Ebenezer Afolabi Please prefer to write Stata (instead of using all capital letters), as recommended in the FAQ. Thank you. Best wishes, Marcos.
        Best regards,

        Marcos

        Comment


        • #5
          Many thanks Maarten for your help and thank you Marta for the description of the method that Stata and other software uses for computing percentile. Marcos, for pointing out the way Stata should be written thank you.

          Cheers

          Comment

          Working...
          X