statsmodels.tools.eval_measures.iqr#
- statsmodels.tools.eval_measures.iqr(x1, x2, axis=0)[source]#
Interquartile range of error
- Parameters:
- x1array_like
One of the inputs into the IQR calculation.
- x2array_like
The other input into the IQR calculation.
- axis
intorNone,optional Axis along which the summary statistic is calculated. If None, the differences are flattened and the interquartile range of all of them is returned.
- Returns:
Notes
If
x1andx2have different shapes, then they must broadcast. The quartiles are those of the broadcast differencex1 - x2.The result is the difference between the order statistics at the 0-based positions
round((n - 1) * 0.75)andround((n - 1) * 0.25)of thensorted errorsx1 - x2, where the rounding of a tie is to the even integer. There is no interpolation. This equals the difference between the quartiles of R’sIQR(type = 7)and ofnumpy.percentilewith the default method ifn = 1 (mod 4), where both positions are integers. For othern, for example 6 or 10, the results generally differ.Changed in version 0.15.1: Inputs that are broadcast, an
x1of length 1 or a scalarx1, andaxis=Nonewithx1andx2of different shapes, now use the broadcast difference. They used to return 0 (length 1), or raise an error (scalar, and different shapes withaxis=None).