pyhctsa.operations.distribution.custom_skewness¶
-
pyhctsa.operations.distribution.custom_skewness(y, what_skew=
'pearson')¶ Compute custom skewness measures of a time series.
Calculates the Pearson skewness (using the median or the mode) or the Bowley (quartile) skewness coefficient.
The Pearson skewness (with the median) is defined as
\[\frac{3(\mu - \tilde{x})}{\sigma},\]where \(\mu\) is the mean, \(\tilde{x}\) is the median, and \(\sigma\) is the standard deviation. The mode-based version is \((\mu - \text{mode})/\sigma\), with the mode estimated by the half-sample mode (
pyhctsa.robust.bf_half_sample_mode()), which needs no bins.The Bowley skewness is defined as
\[\frac{Q_3 + Q_1 - 2Q_2}{Q_3 - Q_1},\]where \(Q_1\), \(Q_2\), and \(Q_3\) are the first, second (median), and third quartiles, respectively.
- Parameters:¶
- y : array-like¶
Input time series.
- what_skew : str, optional¶
Skewness measure to compute.
"pearson"(or"pearsonMedian"): Pearson skewness coefficient from the median."pearsonMode": Pearson skewness coefficient from the half-sample mode."bowley": Bowley (quartile) skewness coefficient.
Default is
"pearson".
- Return type:¶
float
Notes
The mode of a histogram depends on the number and edges of its bins, so the half-sample mode is used instead: closed-form, robust, and without a smoothing parameter.