Search code examples
rquantile

Is the output of R quantile function "inclusive"?


I've got a vector (which I've called x1) of random observations from a binomial distribution with mean 55 and p = 47/55.

When I run quantile(x1, c(0.025, 0.975)), the output is:

2.5% 97.5%
42 52

My question is whether the interval which covers 95% of my generated values is [42, 52] or (42, 52). I've searched all over, but have found nothing.


Solution

  • Yes, it is exclusive by default.

    This is pretty easy to check:

    quantile(1:1000, c(0.025, 0.975))
    

    Returns

    2.5%   97.5% 
    25.975 975.025
    

    So R is returning (25.975, 975.025), which corresponds on this set to [26, 975]