[R] Confidence Interval

David Winsemius dwinsemius at comcast.net
Sat Feb 2 18:12:37 CET 2008


"Jacques Wagnor" <jacques.wagnor at gmail.com> wrote in
news:787911d50802011830s6f5db31i2e625f3add5b81f5 at mail.gmail.com: 

> 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



More information about the R-help mailing list