linearmodels.system.results.SystemResults.predict

SystemResults.predict(equations=None, *, data=None, fitted=True, idiosyncratic=False, missing=False, dataframe=False)[source]

In- and out-of-sample predictions

Parameters
equationsdict

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.

dataDataFrame

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

fittedbool

Flag indicating whether to include the fitted values

idiosyncraticbool

Flag indicating whether to include the estimated idiosyncratic shock

missingbool

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

dataframebool

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

Returns
predictions{DataFrame, dict}

DataFrame or dictionary containing selected outputs

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.

Return type

Union[DataFrame, dict]