Announcement

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

  • Estimating percentile ranking for number not in distribution

    Hi,

    I have a data set of simulated treatment estimates and I want to see where another treatment estimate not in the data set falls in this distribution. I tried to use pctile to estimate the percentile of the additional treatment effect, but it seems like the only way to do this is to add the new value into the distribution of treatment effects. Is there a way to estimate its percentile rank without adding it to the distribution? My goal is to just have the new treatment effect called in as a local, if possible.

    Thanks!

  • #2
    I'm not entirely sure I understand what you want, but perhaps it is this. I assume that you have a data set of simulated treatment effects, the effect being in a variable called te.

    Code:
    local find_percentile_of_this = iinsert_the_number_whose_percentile_you_want_here
    count if te <= `find_percentile_of_this'
    local numerator = r(N)
    local percentile = 100*`numerator'/_N
    Now, if the value of the number you are searching the percentile of is not actually in the data set, this value will be approximate, perhaps off by order of 1/_N. If you need it to be more exact, the code is a bit more complicated. Post back if that is the case. But also be aware that for numbers not in the data set, any solution must make some strong assumption about how the distribution looks in the gap between the numbers that do occur. So if _N is large, the approximation from the code above may be no worse than the error that would be introduced by whatever assumption one makes about how the distribution function looks in the gap.

    Comment

    Working...
    X