linearmodels.iv.model._OLS¶
-
class linearmodels.iv.model._OLS(dependent: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...], exog: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...], *, weights: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...] | None =
None)[source]¶ Compute OLS estimates when required.
Private class used when model reduces to OLS. Should use the statsmodels version when needing a supported public API.
- Parameters:¶
- dependent: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...]¶
Dependent variable (nobs by 1).
- exog: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...]¶
Exogenous regressors (nobs by nexog).
- weights: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...] | None =
None¶ Observation weights used in estimation. The weights must be strictly positive and finite. They are rescaled to have a mean of 1. A NaN weight is missing, and its observation is dropped. The default is to weight all observations equally.
See also
statsmodels.regression.linear_model.OLSOrdinary least squares.
statsmodels.regression.linear_model.GLSGeneralized least squares.
Notes
Uses IV2SLS internally by setting endog and instruments to None. Uses IVLIML with kappa=0 to estimate OLS models.
Rows are paired by position. An input that carries labels (a pandas Series or DataFrame with an index other than the default 0, 1, …, n-1, or an xarray DataArray with coordinates) must use the same index, in the same order, as
dependent, so that a value cannot be attached to the wrong observation. AValueErroris raised if the index ofexogorweightsdiffers from the index ofdependent. Either reindex the input to the index ofdependent, or callto_numpy()to pair its values by position. NumPy arrays and pandas objects with a default index do not carry labels and are always paired by position. Ifdependentdoes not carry labels, the inputs that do must use the same index as the first ofexogandweightsthat does. The same rule applies toclusterspassed tofit. Dates and time deltas are compared by value, so that the same dates at different resolutions, e.g.,datetime64[us]anddatetime64[ns], are the same labels.Methods
estimate_parameters(x, y, z, kappa)Parameter estimation without error checking.
fit(*[, cov_type, debiased])Estimate model parameters.
from_formula(formula, data, *[, weights, ...])Create a model from a formula.
predict(params, *[, exog, endog, data, eval_env])Predict values for additional data.
resids(params)Compute model residuals.
wresids(params)Compute weighted model residuals.
Properties
Formula used to create the model.
Flag indicating the model includes a constant or equivalent.
Locations of observations with missing values.
Locations of observations included in estimation.