Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: RE: how can I create deciles by group?

 From Argyn Kuketayev To statalist@hsphsun2.harvard.edu Subject Re: st: RE: how can I create deciles by group? Date Thu, 7 Jul 2011 10:28:49 -0400

```Nick

in original paper they call it decile plot, because they had enough
data, and the variable was continuous, which would make it possible to
create deciles. In my case, I simply ran

estat gof , group(10) table outsample

which created a table like this:

Group    Prob  Obs_1   Exp_1   Obs_0     Exp_0   Total
-------+--------+-------+--------+--------+----------+--------
2  0.0012    290   306.2  259754  259737.8  260044
4  0.0063   1821  1844.7  294979  294955.3  296800
7  0.0127   4293  4297.6  335630  335625.4  339923
9  0.0221   7164  7113.7  324602  324652.3  331766
10  0.0371   1776  1781.4   46259   46253.6   48035

then i draw a scatter plot with Prob on X-axis, then Obs_1/Total on

cheers

On Thu, Jul 7, 2011 at 6:48 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> As I understand it, you don't need to create deciles at all for your problem. Why you asked the question in the first place is now something of a mystery!
>
> As the issue now seems to be how to draw a particular graph, I note that what are called "decile plots" in the paper referred to are just standard scatter plots with a line of equality through the origin. That is achieved by e.g. -twoway scatter ... || function equality = x, ... but naturally you have to calculate what is being plotted first.
>
> It's impossible for any individual to know about usages of graph terminology across all disciplines, but to me the term "decile plots" conveys only that deciles are being plotted, or that results are being plotted by decile. I wouldn't be surprised by either usage.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Argyn Kuketayev
>
> in original paper they'd have stub3 variable continuous, which they
> would slice into deciles, then compute the actual failure rates within
> these deciles and show on Y-axis. that's why they call it decile plot.
>
> in my case, stub3 is discrete, so i don't really need deciles, but
> simply groups by stub3. hence, you're right there's no deciles in my
> problem, but it's very similar, and i thought the solution would be
> the same. i thought there would eb a standard plot called "decile
> plot", which i'd plug my data into and get a nice graph
>
> On Wed, Jul 6, 2011 at 7:33 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>> Sorry, Argyn, but this makes no sense to me. Where are the deciles?
>>
>> Nick
>>
>> On Wed, Jul 6, 2011 at 11:02 PM, Argyn Kuketayev
>> <akuketayev@mail.primaticsfinancial.com> wrote:
>>> Nick
>>>
>>> i'm still having trouble to make it work.
>>>
>>> i have the variable "stub3", which shows the probability of failure.
>>> then i have a variable called "dq", which indicates failures with
>>> value 1, and 0 if no failure.
>>>
>>> so i want to build a decile plot, where on X-axis - stub3, and in
>>> Y-axis - the "actual" failure rate in this group.
>>>
>>> cheers
>>>
>>> On Wed, Jul 6, 2011 at 4:22 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>>>> I drew attention to an -egen- function written by Uli Kohler in that thread.
>>>>
>>>> Nick
>>>>
>>>> On Wed, Jul 6, 2011 at 8:56 PM, Argyn Kuketayev
>>>> <akuketayev@mail.primaticsfinancial.com> wrote:
>>>>> Nick
>>>>>
>>>>> I didn't like the solution with a loop. I'm going to try -egen- solution.
>>>>>
>>>>> I'm trying to reproduce the Figure 4 in this paper
>>>>> http://grimshawville.byu.edu/ddmm.pdf
>>>>>
>>>>> cheers
>>>>>
>>>>> On Wed, Jul 6, 2011 at 3:46 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>>>>>> What's wrong with those answers?
>>>>>>
>>>>>> Nick
>>>>>>
>>>>>> On Wed, Jul 6, 2011 at 7:09 PM, Argyn Kuketayev
>>>>>> <akuketayev@mail.primaticsfinancial.com> wrote:
>>>>>>
>>>>>>> is there a better way than describes in this thread?
>>>>>>> http://www.stata.com/statalist/archive/2007-07/msg00469.html
>
> *
> *   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/
>

--
Argyn Kuketayev

*
*   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/
```