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

# RE: st: ksmirnov

 From "Guessab Houda" To Subject RE: st: ksmirnov Date Tue, 21 Aug 2012 11:58:04 +0200

```Thank you very much nick.

That will help me so much...i also need to ask another question. Do you know if we can estimate a student distribution in stata? Or do we have to use Maximum likelihood estimation to do that?

Houda GUESSAB

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: mardi 21 août 2012 11:50
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: ksmirnov

and your problem. One is a fit based on mean and SD and the other is
more robust being, less sensitive to outliers in the data. A perfect
fit would mean that the data follow the line exactly. There aren't
agreed guidelines for imperfect fit.

You can get reference plots by simulating from t(8). As said earlier,
you may have difficulties as a side-effect of any dependence structure

Nick

On Tue, Aug 21, 2012 at 10:40 AM, Guessab Houda
<houda.guessab@gre.generali.com> wrote:
> Nick
>
> From scatter mpg expected ///
> || function t_8 = `mean' + x * `sd' / sqrt(4/3), ra(exp) ///
> || function t_8_2 = `median' + x * `iqr' / (2 * invttail(8, 0.25)), ra(exp)
>
> I get two lines, which one I use and how can I interpret it then? I mean how can I say that the distribution is more or less similar to student with 8 degrees?
>
>
>
> Houda GUESSAB
>
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: mardi 21 août 2012 11:27
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: ksmirnov
>
> When you say the qnormal function, I presume you mean the -qnorm- command.
>
> There is no one way to do it. With the normal distribution, most
> people regard matching means and SDs to be the way to do it, but there
> is a good case for fitting a more robust line. In the case of t with 8
> d.f. (henceforth t(8))  the case is even stronger. By my calculation
> t(8) has SD = sqrt(8/6) = sqrt(4/3), but you could use the IQR or any
> other pair of quantiles. Similarly, although t(8) has mean, median and
> any other measure of level all 0, it is open for discussion how the
> data should be summarized. It may even be that 0 is a natural
> reference for whatever your data are.
>
> The straight lines come from manipulating
>
> (observed y - level for y) / (expected x - level for x) = (spread for
> y) / (spread for x)
>
> where in practice level for x is always 0.
>
> Example code:
>
>  sysuse auto, clear
>  egen rank = rank(mpg), unique
>  su rank, meanonly
>  gen expected = -invttail(8, (rank - 0.5) / `r(max)')
>  su mpg, detail
>  local mean = r(mean)
>  local sd = r(sd)
>  local median = r(p50)
>  local iqr = r(p75) - r(p25)
>
>
>  scatter mpg expected ///
> || function t_8 = `mean' + x * `sd' / sqrt(4/3), ra(exp) ///
> || function t_8_2 = `median' + x * `iqr' / (2 * invttail(8, 0.25)), ra(exp)
>
>
> On Tue, Aug 21, 2012 at 9:41 AM, Guessab Houda
> <houda.guessab@gre.generali.com> wrote:
>> OK you are right. Then I will use the program you sent me.
>>
>> sysuse auto, clear
>>>> egen rank = rank(mpg), unique
>>>> su mpg, meanonly
>>>> local N = r(N)
>>>> gen tquantile = -invttail(8, (rank - 0.5) / `N')
>>>> scatter mpg tquantile
>>
>> I just need to draw 45 degree reference line like the qnormal function does; can you help me with that?
> *
> *   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/
>
>
> Ai sensi del D.Lgs. 196/2003 si precisa che le informazioni contenute in questo messaggio sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in parola Le fosse pervenuto per errore, La invitiamo ad eliminarlo senza copiarlo e a non inoltrarlo a terzi, dandocene gentilmente comunicazione. Grazie.
>
> Pursuant to Legislative Decree No. 196/2003, you are hereby informed that this message contains confidential information intended only for the use of the addressee. If you are not the addressee, and have received this message by mistake, please delete it and immediately notify us. You may not copy or disseminate this message to anyone. Thank you.
>
> *
> *   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/

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

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