def S_nw_panel(xw, weights, groupidx):
 nlags = (len(weights) - 1)
 S = (weights[0] * np.dot(xw.T, xw))
 for lag in range(1, (nlags + 1)):
  (xw0, xwlag) = lagged_groups(xw, lag, groupidx)
  s = np.dot(xw0.T, xwlag)
  S += (weights[lag] * (s + s.T))
 return S

def S_nw_panel ( xw , weights , groupidx ) : nlags = ( len ( weights ) - 1 ) S = ( weights [ 0 ] * np . dot ( xw . T , xw ) ) for lag in range ( 1 , ( nlags + 1 ) ) : ( xw0 , xwlag ) = lagged_groups ( xw , lag , groupidx ) s = np . dot ( xw0 . T , xwlag ) S += ( weights [ lag ] * ( s + s . T ) ) return S
inner covariance matrix for hac for panel data no denominator nobs used no reference for this .