Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
usage of spearmanr function on factor against another factor as target

Hi,

I am trying to calculate the spearman correlation of each factor to Return, and I would like to calculate it per each asset.
(as opposed to calculating it against a particular asset). Like this:

r = Returns(mask=universe, window_length=PREDICTION_WINDOW+1)
f = MyFactor()
f_past = Factor_N_Days_Ago([f(mask=universe)], window_length=PREDICTION_WINDOW+1, mask=universe)
f_r_corr = f_past.spearmanr(target=r, correlation_length=MONTH)

Here MyFactor and Factor_N_Days_Ago are the factors I implemented (Factor_N_Days_Ago basically picks up the first row).

When I add f_r_corr to the pipeline, the backtester does not proceed, only to give out an "known error" message after a while.

Any idea why this is happening?

Thank you.