boxplot のバックアップ(No.1) - アールメカブ

アールメカブ


boxplot のバックアップ(No.1)


Rの備忘録

R の boxplot で,四分位数範囲とヒンジ散布度のカンケーがどうなってたか,すぐ忘れる

四分位数範囲Interquartile range:IQR は第3四分位数の第1四分位数の差

ヒンジ散布度 hinge spread は上側ヒンジ(中央値より上の値の中央値)と下側ヒンジ(中央値より下の値の中央値)の差

従って二つは一致しない.

R では前者が使われているが,?boxplot.stats を実行すると以下のような説明がある

> The two ‘hinges’ are versions of the first and third quartile, i.e., close to ‘quantile(x, c(1,3)/4)’. The hinges equal the quartiles for odd n (where ‘n <- length(x)’) and differ for even n. Whereas the quartiles only equal observations for ‘n 4 == 1’ (n = 1 mod 4), the hinges do so _additionally_ for ‘n 4 == 2’ (n = 2 mod 4), and are in the middle of two observations otherwise.