Statalist


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

RE: st: AW: ksmirnov


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: AW: ksmirnov
Date   Wed, 30 Sep 2009 13:26:23 +0100

In principle that is an -addplot(function ...)- option call to -kdensity-. 

In practice density estimates won't I think be as direct as quantile-quantile plots in honest assessments of fit. 

Nick 
[email protected] 

tzygmund mcfarlane

Thank you Nick! This is precisely what I needed.

Now if I can figure out how to do kernel densities with nonintegral
degrees of freedom t-distributions overlaid...


On Tue, Sep 29, 2009 at 7:18 PM, Nick Cox <[email protected]> wrote:
> I don't know why I said that because it isn't true. In fact, I was
> overlooking my own work...
>
> In terms of the original example,
>
> webuse wpi1
> g returns = D.ln_wpi
>
> and given a download of -qplot- from the Stata Journal site, you can go
>
> qplot returns, trscale(invttail(6, 1 - @)) xli(0) yli(0)
>
> Alternatively, you can do it from first principles
>
> count if !missing(returns)
> local N = r(N)
> sort returns
> gen quantilet = invttail(6, 1 - (_n - 0.5) / `N')
> scatter returns quantilet , xli(0) yli(0)
>
> For (_n - 0.5) / `N', substitute any other plotting position formula.
> For "6" substitute any other desired df.
>
> In this example, the fit is lousy: the mean is a long way from zero and
> the distribution is not even symmetric.
>
> See also for a meant-to-be-encouraging note
>
> SJ-7-2  gr0027  . .  Stata tip 47: Quantile-quantile plots without
> programming
>        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N.
> J. Cox
>        Q2/07   SJ 7(2):275--279                                 (no
> commands)
>        tip on producing various quantile-quantile (Q-Q) plots
>
> That and 75 other tips have just been reprinted in
>
> Seventy-six Stata Tips, 2nd Edition
> Publisher: Stata Press
> Copyright: 2009
> ISBN-10: 1-59718-071-8
> ISBN-13: 978-1-59718-071-9
> Pages:  177; paperback
> Price:  $29.00
>
> <http://www.stata.com/bookstore/tips2.html>
>
> Nick
> [email protected]
>
> Nick Cox
> ========
>
> You'd need to clone one or more existing programs, e.g. -qnorm-, -pnorm-
> and replace code there with code specific to the t-distribution.
>
> I am not familiar with the etiquette on fitting t-distributions. Isn't
> the df in effect a parameter to be estimated? Otherwise, there would
> need to be some justification for using a particular df.
>
> tzygmund mcfarlane
> ==================
>
> Thanks for your replies Martin & Nick.
>
> Martin: My question was actually simpler - was my procedure correct?
>
> That is, should the data be standardised by an estimate of the scale
> before using the Kolmogorov-Smirnov procedure or is that not
> necessary?
>
> Also, from the help file for chi2fit by Stas Kolenikov I could not
> figure out how to implement it for a t-distribution. Any help will be
> appreciated.
>
> Nick: I am particularly interested in deviation from a t-distribution.
> My data is almost certainly non-normal. I agree about the merits of
> plotting it, but am not aware of any tools for my particular case. Any
> ideas?

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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index