Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: ksmirnov
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: ksmirnov
Date
Tue, 21 Aug 2012 11:05:42 +0100
That's not a precise question. What's the precise generating process
you have in mind? -search arch- , in either case.
Nick
On Tue, Aug 21, 2012 at 10:58 AM, Guessab Houda
<[email protected]> wrote:
> 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: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: mardi 21 août 2012 11:50
> To: [email protected]
> Subject: Re: st: ksmirnov
>
> Sorry, but you have to think about this yourself based on your data
> 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
> in your data.
>
> Nick
>
> On Tue, Aug 21, 2012 at 10:40 AM, Guessab Houda
> <[email protected]> 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: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
>> Sent: mardi 21 août 2012 11:27
>> To: [email protected]
>> 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
>> <[email protected]> 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/