[R] standard error for quantile

PIKAL Petr petr.pikal at precheza.cz
Wed Oct 31 10:48:28 CET 2012


Thanks Jim.

After reinstall of new R version all mentioned packages work. I tested various functions which revealed that on my lognorm data there is no big difference in error of median or 10% quantile. I also found some function for quantile se computing in Hmisc package.

Petr


> -----Original Message-----
> From: Jim Lemon [mailto:jim at bitwrit.com.au]
> Sent: Wednesday, October 31, 2012 9:56 AM
> To: PIKAL Petr
> Cc: r-help at r-project.org
> Subject: Re: [R] standard error for quantile
> 
> On 10/31/2012 12:46 AM, PIKAL Petr wrote:
> > Dear all
> >
> > I have a question about quantiles standard error, partly practical
> > partly theoretical. I know that
> >
> > x<-rlnorm(100000, log(200), log(2))
> > quantile(x, c(.10,.5,.99))
> >
> > computes quantiles but I would like to know if there is any function
> > to find standard error (or any dispersion measure) of these estimated
> > values.
> >
> > And here is a theoretical one. I feel that when I compute median from
> > given set of values it will have lower standard error then 0.1
> > quantile computed from the same set of values.
> >
> > Is it true? If yes can you point me to some reasoning?
> >
> Hi Petr,
> Using a resampling method, it depends upon the distribution of the
> values. If you have a "love-hate" distribution (bimodal and heavily
> weighted toward extreme values), the median standard error can be
> larger. Try this:
> 
> x<-sample(-5:5,1000,TRUE,
>   prob=c(0.2,0.1,0.05,0.04,0.03,0.02,0.03,0.04,0.05,0.1,0.2))
> x<-ifelse(x<0,x+runif(1000),x-runif(1000))
> hist(x)
> mcse.q(x, 0.1)
> $est
> [1] -3.481419
> 
> $se
> [1] 0.06887319
> 
> mcse.q(x, 0.5)
> $est
> [1] 1.088475
> 
> $se
> [1] 0.3440115
> 
>  > mcse.q(x, 0.1)
> $est
> [1] -3.481419
> 
> $se
> [1] 0.06887319
> 
> Jim




More information about the R-help mailing list