code: def _linear_regression(X, y, n, lag):
      sumx = 0
      sumx2 = 0
      sumxy = 0
      sumy = 0
      for i in range(lag, n + lag):
          sumx += X[i]
          sumx2 += X[i] * X[i]
          sumxy += X[i] * y[i]
          sumy += y[i]
  
      denom = n * sumx2 - sumx * sumx
      if denom == 0:
          return 0, 0
  
      return (n * sumxy - sumx * sumy) / denom, (
          sumy * sumx2 - sumx * sumxy
      ) / denom
  
imports: import math
  import numpy
  from sktime.utils.numba.njit import njit
label_desc: Use image node_id 12 for calling a global function with example usage: _linear_regression(X, y, n, lag) and returns: unknown,  unknown, int,  int