Re: [R] Confidence Interval

From: David Winsemius <>
Date: Sat, 2 Feb 2008 17:12:37 +0000 (UTC)

"Jacques Wagnor" <> wrote in

> I have a model as follows:
> x <- replicate(100, sum(rlnorm(rpois(1,5), 0,1)))
> y <- quantile(x, 0.99))
> How would one go about estimating the boundaries of a 95% confidence
> interval for y?
> Any pointers would be greatly appreciated.

I'm not a statistician, so giving the answer in terms of extreme value statistics is beyond me, but the R Team gives us a (sharp) tool.

quantile(x,99) is returning the midpoint of the 99th and 100th elements of the sorted 100 element vector you created.

If you repeat that process 1000 times, sort again, and pick the 25th and the 975th points, you can pull the 0.025 and 97.5 percentile points from the simulated distribution. Obviously an estimate and will vary depending on the seed.

Here's what I got after that process:
> sort(y1000.df$midpt)[25]

[1] 20.8424
> sort(y1000.df$midpt)[1000-25]

[1] 47.47615

David Winsemius

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 02 Feb 2008 - 17:16:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 03 Feb 2008 - 01:30:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive