linearmodels.iv.results.IVResults.predict

IVResults.predict(exog: ndarray | DataArray | DataFrame | Series | None = None, endog: ndarray | DataArray | DataFrame | Series | None = None, *, data: DataFrame | None = None, fitted: bool = True, idiosyncratic: bool = False, missing: bool = False) DataFrame

In- and out-of-sample predictions

Parameters:
exog: ndarray | DataArray | DataFrame | Series | None = None

Exogenous values to use in out-of-sample prediction (nobs by nexog)

endog: ndarray | DataArray | DataFrame | Series | None = None

Endogenous values to use in out-of-sample prediction (nobs by nendog)

data: DataFrame | None = None

DataFrame to use for out-of-sample predictions when model was constructed using a formula.

fitted: bool = True

Flag indicating whether to include the fitted values

idiosyncratic: bool = False

Flag indicating whether to include the estimated idiosyncratic shock

missing: bool = False

Flag indicating to adjust for dropped observations. If True, the values returned will have the same size as the original input data before filtering missing values. If False, then missing observations will not be returned.

Returns:

DataFrame containing columns for all selected outputs

Return type:

pandas.DataFrame

Notes

If exog, endog and data are all None, in-sample predictions (fitted values) will be returned.

If data is not none, then exog and endog must be none. Predictions from models constructed using formulas can be computed using either exog and endog, which will treat these are arrays of values corresponding to the formula-process data, or using data which will be processed using the formula used to construct the values corresponding to the original model specification.