linearmodels.system.results.SystemResults.predict

SystemResults.predict(equations: dict[str, dict[str, ndarray | DataArray | DataFrame | Series]] | None = None, *, data: DataFrame | None = None, fitted: bool = True, idiosyncratic: bool = False, missing: bool = False, dataframe: bool = False) DataFrame | dict[source]

In- and out-of-sample predictions

Parameters:
equations: dict[str, dict[str, ndarray | DataArray | DataFrame | Series]] | None = None

Dictionary-like structure containing exogenous and endogenous variables. Each key is an equations label and must match the labels used to fit the model. Each value must be either a tuple of the form (exog, endog) or a dictionary with keys “exog” and “endog”. If predictions are not required for one of more of the model equations, these keys can be omitted.

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 returns will have the same size as the original input data before filtering missing values

dataframe: bool = False

Flag indicating to return output as a dataframe. If False, a dictionary is returned using the equation labels as keys.

Returns:

predictions – DataFrame or dictionary containing selected outputs

Return type:

{DataFrame, dict}

Notes

If equations and data are both None, in-sample predictions (fitted values) will be returned.

If data is not none, then equations must be none. Predictions from models constructed using formulas can be computed using either equations, 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.

When using exog and endog, the regressor array for a particular equation is assembled as [equations[eqn][“exog”], equations[eqn][“endog”]] where eqn is an equation label. These must correspond to the columns in the estimated model.