linearmodels.panel.results.RandomEffectsResults.predict¶
-
RandomEffectsResults.predict(exog: PanelData | ndarray | DataArray | DataFrame | Series | None =
None, *, data: DataFrame | None =None, fitted: bool =True, effects: bool =False, idiosyncratic: bool =False, missing: bool =False) DataFrame¶ In- and out-of-sample predictions.
- Parameters:¶
- exog: PanelData | ndarray | DataArray | DataFrame | Series | None =
None¶ Exogenous values to use in out-of-sample prediction (nobs by nexog). The containers are those of
exogin the model. A list or a tuple raises aTypeErrorthat namesexog. If neither exog nor data is provided, the in-sample values are returned.- 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. The default is True. Only used for in-sample values.
- effects: bool =
False¶ Flag indicating whether to include estimated effects. The default is False. Only used for in-sample values.
- idiosyncratic: bool =
False¶ Flag indicating whether to include the estimated idiosyncratic shock. The default is False. Only used for in-sample values.
- 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. The default is False.
- exog: PanelData | ndarray | DataArray | DataFrame | Series | None =
- Returns:¶
DataFrame containing columns for all selected output.
- Return type:¶
- Raises:¶
ValueError – If both exog and data are provided, if no in-sample output is selected, or if effects or idiosyncratic is requested for out-of-sample predictions.
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.