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]

RE: st: ksmirnov

From   "Guessab Houda" <>
To   <>
Subject   RE: st: ksmirnov
Date   Tue, 21 Aug 2012 13:59:21 +0200

Nick told me that it's not correct to use kormogolv smirnov to compare the shape of series with a student distribution, is there another numerical method (not graphical)to do that?

Thank you very much maarten for you help!


-----Original Message-----
From: [] On Behalf Of Maarten Buis
Sent: mardi 21 août 2012 12:27
Subject: Re: st: ksmirnov

On Tue, Aug 21, 2012 at 11:40 AM, Guessab Houda wrote:
> I mean how can I say that the distribution is more or less similar to student with 8 degrees?

For that I typically like to add a portfolio of simulated variables
that were drawn from the distribution of interest. That way you can
get an informal idea of how much variation on can reasonably expect if
your model (a student t-distribution with 8 degrees of freedom) is

*------------------ begin example -------------------
sysuse auto, clear
egen rank = rank(mpg), unique
su rank, meanonly
gen expected = -invttail(8, (rank - 0.5) / `r(max)')
su mpg
local mean = r(mean)
local sd = r(sd)

 void function dangerous_sort(string scalar var,
                              string scalar touse) {
	real matrix x
	st_view(x =., ., var, touse)
	x[.,.] = x[order(x,1)]
gen byte touse = 1

sort expected
forvalues i = 1/10 {
	gen sim`i' = rt(8)*`sd'/sqrt(4/3) + `mean'
	mata: dangerous_sort("sim`i'", "touse")
	local lpattern "`lpattern' solid"
	local lcolor "`lcolor' gs8"
local lpattern "lpattern(`lpattern')"
local lcolor "lcolor(`lcolor')"

twoway line sim* expected,                    ///
    `lcolor' `lpattern'                    || ///
scatter mpg expected, mstyle(p1)           || ///
function t_8 = `mean' + x * `sd' / sqrt(4/3), ///
    ra(expected) lstyle(refline)              ///
    legend(order(1  "simulation"              ///
                 11 "observed"                ///
                 12 "reference"))
*------------------- end example --------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Maarten L. Buis
Reichpietschufer 50
10785 Berlin
*   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