Announcement

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

  • Generating percentiles by group

    Hi all,

    I am trying to do something like: bysort lat lon (date): xtile pct_rain = rainfall, nq(100).

    However, xtile cannot be used with by. I essentially want the percentile value of each observation within lat and lon.

    Any leads are appreciated!

    Thanks!

  • #2
    Set aside the fact that xtile won't do what you want. A natural question is do you want quantile bins for rainfall or for date? And do you have hundreds of measurements for each latitude, longitude pair to make the request work well? Perhaps each latittude, longitude pair is really a meteorological station.

    This may help:

    FAQ . . . . . . . . . . Calculating percentile ranks or plotting positions
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
    2/14 How can I calculate percentile ranks?
    How can I calculate plotting positions?

    https://www.stata.com/support/faqs/s...ing-positions/




    Last edited by Nick Cox; 25 Mar 2025, 15:05.

    Comment

    Working...
    X