class_docstr: A Factor that performs an ordinary least-squares regression predicting the
  columns of a given Factor from either the columns of another
  Factor/BoundColumn or a slice/single column of data.
  
  Parameters
  ----------
  dependent : catalyst.pipeline.factors.Factor
      The factor whose columns are the predicted/dependent variable of each
      regression with `independent`.
  independent : catalyst.pipeline.slice.Slice or catalyst.pipeline.Factor
      The factor/slice whose columns are the predictor/independent variable
      of each regression with `dependent`. If `independent` is a Factor,
      regressions are computed asset-wise.
  independent : catalyst.pipeline.Term with a numeric dtype
      The term to use as the predictor/independent variable in each
      regression with `dependent`. This term may be a Factor, a BoundColumn
      or a Slice. If `independent` is two-dimensional, regressions are
      computed asset-wise.
  regression_length : int
      Length of the lookback window over which to compute each regression.
  mask : catalyst.pipeline.Filter, optional
      A Filter describing which assets (columns) of `dependent` should be
      regressed against `independent` each day.
  
  See Also
  --------
  :func:`scipy.stats.linregress`
  :meth:`Factor.linear_regression`
  :class:`catalyst.pipeline.factors.RollingLinearRegressionOfReturns`
  
  Notes
  -----
  Most users should call Factor.linear_regression rather than directly
  construct an instance of this class.
class_docstr_tok: ["A","Factor","that","performs","an","ordinary","least-squares","regression","predicting","the","columns","of","a","given","Factor","from","either","the","columns","of","another","Factor\/BoundColumn","or","a","slice\/single","column","of","data",".","Parameters","--","--","--","--","--","dependent",":","catalyst.pipeline.factors.Factor","The","factor","whose","columns","are","the","predicted\/dependent","variable","of","each","regression","with","`","independent","`",".","independent",":","catalyst.pipeline.slice.Slice","or","catalyst.pipeline.Factor","The","factor\/slice","whose","columns","are","the","predictor\/independent","variable","of","each","regression","with","`","dependent","`",".","If","`","independent","`","is","a","Factor",",","regressions","are","computed","asset-wise",".","independent",":","catalyst.pipeline.Term","with","a","numeric","dtype","The","term","to","use","as","the","predictor\/independent","variable","in","each","regression","with","`","dependent","`",".","This","term","may","be","a","Factor",",","a","BoundColumn","or","a","Slice",".","If","`","independent","`","is","two-dimensional",",","regressions","are","computed","asset-wise",".","regression_length",":","int","Length","of","the","lookback","window","over","which","to","compute","each","regression",".","mask",":","catalyst.pipeline.Filter",",","optional","A","Filter","describing","which","assets","(","columns",")","of","`","dependent","`","should","be","regressed","against","`","independent","`","each","day",".","See","Also","--","--","--","--",":","func",":","`","scipy.stats.linregress","`",":","meth",":","`","Factor.linear_regression","`",":","class",":","`","catalyst.pipeline.factors.RollingLinearRegressionOfReturns","`","Notes","--","--","-","Most","users","should","call","Factor.linear_regression","rather","than","directly","construct","an","instance","of","this","class","."]
code: def compute(self, today, assets, out, dependent, independent):
      alpha = out.alpha
      beta = out.beta
      r_value = out.r_value
      p_value = out.p_value
      stderr = out.stderr
  
      def regress(y, x):
          regr_results = linregress(y=y, x=x)
          # `linregress` returns its results in the following order:
          # slope, intercept, r-value, p-value, stderr
          alpha[i] = regr_results[1]
          beta[i] = regr_results[0]
          r_value[i] = regr_results[2]
          p_value[i] = regr_results[3]
          stderr[i] = regr_results[4]
  
      # If `independent` is a Slice or single column of data, broadcast it
      # out to the same shape as `dependent`, then compute column-wise. This
      # is efficient because each column of the broadcasted array only refers
      # to a single memory location.
      independent = broadcast_arrays(independent, dependent)[0]
      for i in range(len(out)):
          regress(y=dependent[:, i], x=independent[:, i])
  
imports: from numpy import broadcast_arrays
  from scipy.stats import linregress, pearsonr, spearmanr
  from catalyst.errors import IncompatibleTerms
  from catalyst.pipeline.factors import CustomFactor
  from catalyst.pipeline.filters import SingleAsset
  from catalyst.pipeline.mixins import SingleInputMixin
  from catalyst.pipeline.sentinels import NotSpecified
  from catalyst.pipeline.term import AssetExists
  from catalyst.utils.input_validation import expect_bounded, expect_dtypes
  from catalyst.utils.numpy_utils import float64_dtype, int64_dtype
  from .technical import Returns
label_desc: Use image node_id 2 for calling the RollingLinearRegression obj's underlying member method code with example usage: obj.compute(today, assets, out, dependent, independent) without return types