linearmodels.panel.results.PanelResults.predict

PanelResults.predict(exog: ndarray | DataArray | DataFrame | Series | None = None, *, data: DataFrame | None = None, fitted: bool = True, effects: bool = False, idiosyncratic: bool = False, missing: bool = False) DataFrame[source]

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)

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

effects: bool = False

Flag indicating whether to include estimated effects

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

Returns:

DataFrame containing columns for all selected output

Return type:

pandas.DataFrame

Notes

data can only be used when the model was created using the formula interface. exog can be used for both a model created using a formula or a model specified with dependent and exog arrays.

When using exog to generate out-of-sample predictions, the variable order must match the variables in the original model.

Idiosyncratic errors and effects are not available for out-of-sample predictions.