According to this wiki link (https://en.wikipedia.org/wiki/Interquartile_range), the iqr for this set of data
102 104 105 107 108 109 110 112 115 116 118
should be 115 - 105 = 10. I wonder why Matlab give me value of 8.75.

댓글 수: 1

Dajiang
Dajiang 2015년 7월 1일
I just came across this web page ( http://math.stackexchange.com/questions/65391/calculating-interquartile-range ). It seems several ways to calculate iqr(x); all of which will output similar result, I guess, if length(x) is big enough. Isn't it? However, I wonder how Matlab implements it.

댓글을 달려면 로그인하십시오.

답변 (2개)

Steven Lord
Steven Lord 2015년 7월 1일

0 개 추천

If you're using the Statistics and Machine Learning Toolbox IQR function, the description of the output argument described what it does. The definition of Q1 and Q3 from that Wikipedia page are different from the definition given in the QUANTILE function. The quantile values for the vector do not necessarily need to be in the vector. They may be, if the length of the vector allows for it or if there are repeated values, but they are not required to be. This difference explains the different results.
Brendan Hamm
Brendan Hamm 2015년 7월 1일

0 개 추천

MATLAB uses the prctile() function to find Q3 and Q1 to calculate the IQR. See Quantiles and Percentiles for descriptions on how this calculation is performed.

카테고리

도움말 센터File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

질문:

2015년 7월 1일

답변:

2015년 7월 1일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by