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

Re: st: test difference in quintiles

From   Tirthankar Chakravarty <>
Subject   Re: st: test difference in quintiles
Date   Wed, 10 Jun 2009 16:26:40 +0100


This is a variation of previous advice:

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 */
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')
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.


On Wed, Jun 10, 2009 at 3:57 PM, Susanne
Neckermann<> 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:
> *
> *
> *

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:

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