quantileCI: Quantiles and confidence intervals

View source: R/quantileCI.r

quantileCIR Documentation

Quantiles and confidence intervals

Description

Calculates an estimate for a quantile and confidence intervals for a vector of discrete or continuous values

Usage

quantileCI(
  x,
  tau = 0.5,
  level = 0.95,
  method = "binomial",
  type = 3,
  digits = 3,
  ...
)

Arguments

x

The vector of observations. Can be an ordered factor as long as type is 1 or 3.

tau

The quantile to use, e.g. 0.5 for median, 0.25 for 25th percentile.

level

The confidence interval to use, e.g. 0.95 for 95 percent confidence interval.

method

If "binomial", uses the binomial distribution the confidence limits. If "normal", uses the normal approximation to the binomial distribution.

type

The type value passed to the quantile function.

digits

The number of significant figures to use in output.

...

Other arguments, ignored.

Details

Conover recommends the "binomial" method for sample sizes less than or equal to 20. With the current implementation, this method can be used also for larger sample sizes.

Value

A data frame of summary statistics, quantile estimate, and confidence limits.

Author(s)

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu

References

https://rcompanion.org/handbook/E_04.html

Conover, W.J., Practical Nonparametric Statistics, 3rd.

See Also

groupwisePercentile, groupwiseMedian

Examples

### From Conover, Practical Nonparametric Statistics, 3rd
Hours = c(46.9, 47.2, 49.1, 56.5, 56.8, 59.2, 59.9, 63.2,
          63.3, 63.4, 63.7, 64.1, 67.1, 67.7, 73.3, 78.5)
quantileCI(Hours)

### Example with ordered factor
set.seed(12345)
Pool = factor(c("smallest", "small", "medium", "large", "largest"),
             ordered=TRUE, 
             levels=c("smallest", "small", "medium", "large", "largest"))
Sample = sample(Pool, 24, replace=TRUE)
quantileCI(Sample)
                 

rcompanion documentation built on Sept. 17, 2023, 5:07 p.m.