Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

So its like saying 95% of the items sold in this website costs between $$25 - $150. While some items might cost less than $25 and other items might cost more than $150.

Is there a way to find this? Is this something related to CI - confidence Interval?

share|improve this question
What do you mean by 'the minimum range'? – Macro Mar 22 '12 at 19:24
See Reference range on Wikipedia. – onestop Mar 22 '12 at 20:08
What data or related information do you have to begin with? – whuber Mar 22 '12 at 20:14
Weakly related: stats.stackexchange.com/questions/24588/… – Henry Mar 22 '12 at 21:52
1  
This sounds like a homework question. It has to do with standard deviation which is used to calculate confidence intervals. I would say more but in the interest of facilitating your learning I'll direct you to the wikipedia page on standard deviation instead. en.wikipedia.org/wiki/Standard_deviation I'd be happy to discuss this further but please read that, make an attempt at solving the problem, and then ask some intelligent questions and we can go from there. – Will Mar 23 '12 at 2:30
show 3 more comments

1 Answer

up vote 2 down vote accepted

If you mean the narrowest range then something like this would do it

set.seed(1)
dat        <- rnorm(1000000)
ordereddat <- sort(dat)
width      <- ceiling(length(ordereddat) * 0.95)
difdat     <- diff(ordereddat, lag = width)
min        <- which(difdat == min(difdat)) 
c(ordereddat[min[1]] , ordereddat[min[1] + width])

producing

[1] -1.962899  1.961126

If you want as many items above as below then there is the simple but slightly wider

> c(quantile(dat, 0.025),  quantile(dat, 0.975))
     2.5%     97.5% 
-1.960232  1.964565  
share|improve this answer
i think c(quantile(dat, 0.025), quantile(dat, 0.975)) fits what i was looking for. thank you – Prabhu M Mar 23 '12 at 4:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.