Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]

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?


-----Original Message-----
From: [] On Behalf Of Nick Cox
Sent: mardi 21 août 2012 11:27
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
<> 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:

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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index