Skip to contents

The lower and upper ideal-fourth estimates of the quartiles and the resulting interquartile range. With the observations in ascending order, let j be the integer part of n/4 + 5/12 and h = n/4 + 5/12 - j. Then q1 = (1 - h) X[j] + h X[j + 1] and, with k = n - j + 1, q2 = (1 - h) X[k] + h X[k - 1].

Usage

Idealf(x)

Arguments

x

Numeric vector; at least three observations, otherwise the index j falls below one.

Value

A list with components q1, q2, iqr, j, h, n, estimate (= q1) and method.

Details

Note the descending indexing in the upper fourth: it interpolates from X[k] back towards X[k - 1], so q2 mirrors q1. Writing X[k + 1] instead breaks that symmetry.

References

Wilcox, R. R. (2017). Modern Statistics for the Social and Behavioral Sciences: A Practical Introduction, 2nd edn. CRC Press, section 2.4.3, equations (2.6)-(2.8), p.27.

Examples

x <- c(-29.6, -20.9, -19.7, -15.4, -12.3, -8.0,
       -4.3, 0.8, 2.0, 6.2, 11.2, 25.0)
Idealf(x)$q1
#> [1] -17.90833