Statalist


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

Re: st: test difference in quintiles


From   Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: test difference in quintiles
Date   Wed, 10 Jun 2009 16:26:40 +0100

<>

This is a variation of previous advice:
http://www.stata.com/statalist/archive/2009-05/msg00311.html

I believe you want to test the significance of the difference of the
5th percentile for two variables using a bootstrap. If this is the
case, then the code below applies:

/* Bootstrap the difference of percentiles */
clear
webuse nlswork, clear
keep idcode year ttl_exp
reshape wide ttl_exp, i(idcode) j(year)

cap prog drop pctile_bs
program define pctile_bs, rclass
	version 10
	syntax varlist(max=2 min=2) [if] [in]
	marksample touse
	tokenize `varlist'
	local first `1'
	macro shift	
	local second `*'
	_pctile `first' if `touse', percentiles(5)
	scalar pc1 = r(r1)	
	_pctile `second' if `touse', percentiles(5)
	scalar pc2 = r(r1)
	return scalar dpc = pc1-pc2
	ereturn post, esample(`touse')
end
bootstrap  Dpc = r(dpc), reps(2000) dots: pctile_bs ttl_exp68 ttl_exp69
/* End */

Please also see the reference about pivotal statistics in a bootstrap
from the previous message.

T


On Wed, Jun 10, 2009 at 3:57 PM, Susanne
Neckermann<sneckermann@iew.uzh.ch> wrote:
> Hi!
>
> I want to test whether the difference in the fifth percentile of two
> distributions is significant.
> In principle, this test should be similar to the "median" (thats the name of
> the command) test already implemented in Stata, but unfortunately I cannot
> program .ado files and I could not find a user-written procedure.
> Any idea how to go about this?
> P.S. the number of observations in the fifth percentile is pretty low
> (around 6), so one might have to use something with bootstrap or
> permutations.
>
> Thank you so much in advance
> susanne
>
>
>
> *
> *   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/
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index