# st: RE: Cumulative Percentiles & Accuracy Profiles

 From "Nick Cox" To Subject st: RE: Cumulative Percentiles & Accuracy Profiles Date Thu, 2 Apr 2009 14:35:05 +0100

```It's not clear what kind of modelling you are doing but Stata already
has similar if not identical functionality under headings like -roc-.

Even if that's not what you want, it is not clear that you need to bin;
that's just a means to an end. Sorting values to get cumulatives may be
enough.

Nick
n.j.cox@durham.ac.uk

Ronan Gallagher

I am doing some modelling using Stata and wish to draw a cumulative
accuracy
profile.  Essentially I have a model from which I want to compare the
actual
and predicted values of my dependent variable.

To do this I need to create 100 bins and assign the top 1% of all
predicted
values to the first bin, the top 2% to the second bin and so forth until
the
100th bin consists of the total number of observations.  I then want to
repeat this exercise for the actual value of the dependent variable.
Once
the bins are populated I need to compare how many predicted values in a
given bin also have their actual values in the same bin.  I then need to
plot this percentage for each bin and the resultant graphic is the
cumulative accuracy profile for my model.

My uncertainty centres on the cumulative nature of the bin assignment
i.e.
the first percentile of observations fall into every bin, the second
percentile into 99 bins and the final percentile into only one bin.  The
xtile command therefore is not as useful.

Any help on how to compute the appropriate percentages and display the
cumulative accuracy profile would be greatly appreciated.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```