0
$\begingroup$

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?

$\endgroup$
8
  • $\begingroup$ What do you mean by 'the minimum range'? $\endgroup$
    – Macro
    Commented Mar 22, 2012 at 19:24
  • $\begingroup$ See Reference range on Wikipedia. $\endgroup$
    – onestop
    Commented Mar 22, 2012 at 20:08
  • $\begingroup$ What data or related information do you have to begin with? $\endgroup$
    – whuber
    Commented Mar 22, 2012 at 20:14
  • $\begingroup$ Weakly related: stats.stackexchange.com/questions/24588/… $\endgroup$
    – Henry
    Commented Mar 22, 2012 at 21:52
  • 1
    $\begingroup$ 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. $\endgroup$
    – Will
    Commented Mar 23, 2012 at 2:30

1 Answer 1

2
$\begingroup$

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  
$\endgroup$
1
  • $\begingroup$ i think c(quantile(dat, 0.025), quantile(dat, 0.975)) fits what i was looking for. thank you $\endgroup$
    – Prabhu M
    Commented Mar 23, 2012 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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