statsmodels.regression.rolling.RollingWLS.fit#
- RollingWLS.fit(method='inv', cov_type='nonrobust', cov_kwds=None, reset=None, use_t=False, params_only=False)[source]#
Estimate model parameters
- Parameters:
- method{‘inv’, ‘lstsq’, ‘pinv’},
optional Method to use when computing the model parameters.
‘inv’ - use moving windows inner-products and matrix inversion. This method is the fastest, but may be less accurate than the other methods.
‘lstsq’ - Use the QR decomposition of each window, computed in batches, which has the same accuracy as numpy.linalg.lstsq. Windows that are close to rank deficient are estimated using numpy.linalg.lstsq.
‘pinv’ - Use the QR decomposition of each window, computed in batches. Windows that are close to rank deficient are estimated using numpy.linalg.pinv. This method matches the default estimator in non-moving regression estimators.
- cov_type{‘nonrobust’, ‘HCCM’, ‘HC0’},
optional Covariance estimator:
nonrobust - The classic OLS covariance estimator
HCCM, HC0 - White heteroskedasticity robust covariance
- cov_kwds
dict,optional Unused
- reset
int,optional Interval to recompute the moving window inner products used to estimate the model parameters when method is ‘inv’. Smaller values improve accuracy, although in practice this setting is not required to be set. The inner products are always recomputed at least once every
windowobservations.- use_tbool,
optional Flag indicating to use the Student’s t distribution when computing p-values.
- params_onlybool,
optional Flag indicating that only parameters should be computed. Avoids calculating all other statistics or performing inference.
- method{‘inv’, ‘lstsq’, ‘pinv’},
- Returns:
RollingRegressionResultsEstimation results where all pre-sample values are nan-filled.
Notes
The windows are estimated in batches using stacked linear algebra routines. The batches are sized so that the temporary arrays have a few MB, and so memory use does not depend on the number of observations beyond the arrays that hold the results. The heteroskedasticity-robust middle term
X'diag(e**2)Xis only computed when cov_type is ‘HCCM’ or ‘HC0’.