def ols(**kwargs):

    if (kwargs.get('cluster') is not None and
            kwargs.get('nw_lags') is not None):
        raise ValueError(
            'Pandas OLS does not work with Newey-West correction '
            'and clustering.')

    pool = kwargs.get('pool')
    if 'pool' in kwargs:
        del kwargs['pool']

    window_type = kwargs.get('window_type')
    window = kwargs.get('window')

    if window_type is None:
        if window is None:
            window_type = 'full_sample'
        else:
            window_type = 'rolling'
    else:
        window_type = common._get_window_type(window_type)

    if window_type != 'full_sample':
        kwargs['window_type'] = common._get_window_type(window_type)

    y = kwargs.get('y')
    x = kwargs.get('x')

    panel = False
    if isinstance(y, DataFrame) or (isinstance(y, Series) and
                                    isinstance(y.index, MultiIndex)):
        panel = True
    if isinstance(x, Panel):
        panel = True

    if window_type == 'full_sample':
        for rolling_field in ('window_type', 'window', 'min_periods'):
            if rolling_field in kwargs:
                del kwargs[rolling_field]

        if panel:
            if pool is False:
                klass = NonPooledPanelOLS
            else:
                klass = PanelOLS
        else:
            klass = OLS
    else:
        if panel:
            if pool is False:
                klass = NonPooledPanelOLS
            else:
                klass = MovingPanelOLS
        else:
            klass = MovingOLS

    return klass(**kwargs)
Transform the data using the linear model.
dataset/ETHPy150Open pydata/pandas/pandas/stats/interface.py/ols--crossover with--dataset/ETHPy150Open mne-tools/mne-python/mne/decoding/base.py/LinearModel.transform