statsmodels.regression.rolling.RollingWLS¶

class statsmodels.regression.rolling.RollingWLS(endog, exog, window=None, weights=None, min_nobs=None, missing='drop')[source]

Rolling Weighted Least Squares

Parameters
endogarray_like

A 1-d endogenous response variable. The dependent variable.

exogarray_like

A nobs x k array where nobs is the number of observations and k is the number of regressors. An intercept is not included by default and should be added by the user. See statsmodels.tools.add_constant.

windowint

Length of the rolling window. Must be strictly larger than the number of variables in the model.

weightsarray_like, optional

A 1d array of weights. If you supply 1/W then the variables are pre- multiplied by 1/sqrt(W). If no weights are supplied the default value is 1 and WLS results are the same as OLS.

min_nobs

Minimum number of observations required to estimate a model when data are missing. If None, the minimum depends on the number of regressors in the model. Must be smaller than window.

missingstr

Available options are ‘drop’, ‘skip’ and ‘raise’. If ‘drop’, any observations with nans are dropped and the estimates are computed using only the non-missing values in each window. If ‘skip’ blocks containing missing values are skipped and the corresponding results contains NaN. If ‘raise’, an error is raised. Default is ‘drop’.

statsmodels.regression.linear_model.WLS

WLS estimation and parameter testing.

Notes

Tested against WLS for accuracy.

Results may differ from WLS applied to windows of data if this model contains an implicit constant (i.e., includes dummies for all categories) rather than an explicit constant (e.g., a column of 1s).

Examples

>>> from statsmodels.regression.rolling import RollingWLS
>>> from statsmodels.datasets import longley

>>> rolling_params = mod.fit(params_only=True)

 fit([method, cov_type, cov_kwds, reset, …]) Estimate model parameters. from_formula(formula, data, window[, …]) Create a Model from a formula and dataframe.