I would like to do in a pipeline mathematical notion of linear regression on equity returns similar to how scipy.stats.linregress does getting
slope, intercept, p, r, error for each equity in the pipeline for the lookup window. In particular, I don't want to specify a target asset that RollingLinearRegressionOf Returns and linear_regression seem to require. Note: I am not interested in beta of a stock, I want pure mathematical definition of linear regression of a sequence of values. Is that possible in quantopian pipeline?
scipy.stats.linregress(x, y=None)[source]
Calculate a linear least-squares regression for two sets of measurements.
Parameters:
x, y : array_like
Two sets of measurements. Both arrays should have the same length. If only x is given (and y=None), then it must be a two-dimensional array where one dimension has length 2. The two sets of measurements are then found by splitting the array along the length-2 dimension.
Returns:
slope : float
slope of the regression line
intercept : float
intercept of the regression line
rvalue : float
correlation coefficient
pvalue : float
two-sided p-value for a hypothesis test whose null hypothesis is that the slope is zero.
stderr : float
Standard error of the estimated gradient.