quantlab.model.evaluation.rank_autocorrelation_series#
- quantlab.model.evaluation.rank_autocorrelation_series(pred, lag=1)[source]#
Return each row’s rank correlation with the row
lagrows before, NaN where there is none.The prediction’s own persistence, as the factor report’s
rank_autocorrelation: rowtis the cross-sectional rank IC ofpred[t]againstpred[t - lag]on the symbols finite in both. The firstlagrows have no earlier row and are NaN, as is a row skipped by the rank IC. A signal whose order changes little from bar to bar (values near 1) needs little trading to follow.- Parameters:
- predarray_like
A 2-D
[T, S]panel of predictions.- lagint, default 1
How many rows back each row is compared with; at least 1.
- Returns:
- np.ndarray
A float64 array of length
T.
- Raises:
- ValueError
If
predis not 2-D orlagis below 1.
Examples
The second row swaps the top two of the first:
>>> rank_autocorrelation_series([[1.0, 2.0, 3.0, 4.0], [1.0, 2.0, 4.0, 3.0]]) array([nan, 0.8])