Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Problem with centile and normal confidence limits


From   "Isabel Canette, StataCorp LP" <icanette@stata.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problem with centile and normal confidence limits
Date   Thu, 06 Sep 2007 17:06:57 -0500

James Shaw <james_shaw2004[at]yahoo[dot]com> reported
an inconsistency between the formula used to compute
the normal standard errors for the centiles and the formula
in the entry Manual for the command -centile-.

  >> I am having trouble replicating the normal confidence
  >> limits produced by -centile-.  The manual states that
  >> the standard error (Sq) of a given quantile, Cq, may
  >> be computed under the assumption of normality using
  >> the equation on p. 202 in the Stata Reference Manual
  >> (Release 9, A-G).  However, I have to multiply Sq by
  >> sqrt(n) to get the same endpoints as Stata.  My sample
  >> code and output are provided below.

James guesses that there may be a typo in the manual
entry, and he is right. The actual formula for the
standard errors in the normal case is:

s_q = sqrt( q(100-q)/n ) * 1/(100*Z)

We will fix this typo in the manual.

The formula also can be found in:
   Kendall's Advanced Theory of Statistics, by A. Stuart
and K. Ord, 6th Edition, Edward Arnold. (see formula 10.29
on page 358).

  Isabel
  icanette[at]stata[dot]com



James Shaw wrote:
> Dear Statalist:
> 
> I am having trouble replicating the normal confidence
> limits produced by -centile-.  The manual states that
> the standard error (Sq) of a given quantile, Cq, may
> be computed under the assumption of normality using
> the equation on p. 202 in the Stata Reference Manual
> (Release 9, A-G).  However, I have to multiply Sq by
> sqrt(n) to get the same endpoints as Stata.  My sample
> code and output are provided below.  
> 
> I am not sure why I cannot replicate Stata's results
> using the equation presented in the manual.  Given
> that I can approximate the limits produced by
> -centile, normal- using the bootstrap, I suspect that
> the notation in the manual may be incorrect.  I do not
> have access to the original source (Kendall & Stuart)
> and am therefore unable to verify whether or not this
> is the case.  
> 
> Regards,
> 
> Jim
> 
> 
> . drawnorm y
> . qui: summ y
> . scalar sm1= r(mean)
> . scalar sd1 = r(sd)
> . scalar sn = r(N)
>  
> . qui: centile y, normal
> . scalar smd2 = r(c_1)
> . scalar stul = r(ub_1)
> . scalar stll = r(lb_1)
>  
> . /* from Stata */
> . scalar li smd2 stul stll 
>       smd2 =  .02788301
>       stul =  .10364515
>       stll = -.04787914
>  
> . scalar sq =
> sqrt(50*(100-50))/(100*sn*normalden(smd2,sm1,sd1))
>  
> . /* using formula given in manual */
> . scalar ul11 = smd2 + sq*invnormal(.975)
> . scalar ll11 = smd2 - sq*invnormal(.975)
> . scalar li smd2 ul11 ll11 
>       smd2 =  .02788301
>       ul11 =  .03027881
>       ll11 =   .0254872
> 
> . /* multiplied by sqrt(n) */
> . scalar ul12 = smd2 + sq*invnormal(.975)*sqrt(sn)
> . scalar ll12 = smd2 - sq*invnormal(.975)*sqrt(sn)
> . scalar li smd2 ul12 ll12
>       smd2 =  .02788301
>       ul12 =  .10364515
>       ll12 = -.04787914
> 
> 
> 
>        
> ____________________________________________________________________________________
> Yahoo! oneSearch: Finally, mobile search 
> that gives answers, not web links. 
> http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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