linearmodels.panel.model.PooledOLS.predict

PooledOLS.predict(params: ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...], *, exog: PanelData | ndarray | DataArray | DataFrame | Series | None = None, data: PanelData | ndarray | DataArray | DataFrame | Series | None = None, eval_env: int = 1, context: Mapping[str, Any] | None = None) → DataFrame[source]

Predict values for additional data.

Parameters:
params: ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...]

Model parameters (nvar by 1).

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

Exogenous regressors (nobs by nvar). The containers are those of exog in the model. A list or a tuple raises a TypeError that names exog.

data: PanelData | ndarray | DataArray | DataFrame | Series | None = None

Values to use when making predictions from a model constructed from a formula.

eval_env: int = 1

Depth of the stack to use when evaluating formulas. The default is 1. It is not used if context is provided.

context: Mapping[str, Any] | None = None

The variables that the formula can use, by name. If not provided, it is captured at the depth eval_env.

Returns:

Fitted values from supplied data and parameters.

Return type:

pandas.DataFrame

Raises:
  • ValueError – If data is provided and the model was not created using a formula, if both exog and data are provided, if neither is provided, or if exog does not have as many columns as there are parameters.

  • TypeError – If exog is a container that is not supported, e.g., a list or a tuple.

Notes

Changed in version 7.1: Calling without exog and data raises a ValueError. It raised an AssertionError.

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