fresiduals

fresiduals(model, type='function', y=None)

Computes functional residuals for a fitted model.

This function can return the full functional residuals as distribution-like objects, or it can return point-based residuals derived from them (surrogate or probability-scale).

Parameters

Name Type Description Default
model object A fitted model object from the statsmodels library. required
type str The type of residual to compute. One of {“function”, “surrogate”, “probscale”}, by default “function”. 'function'
y np.ndarray The observed response variable. If not provided, it will be extracted from the model object. None

Returns

Name Type Description
Union[List[FunctionalResidual], np.ndarray] - If type="function", a list of FunctionalResidual objects, one for each observation. - If type="surrogate" or type="probscale", a NumPy array of the calculated point residuals.

Raises

Name Type Description
ValueError If the specified type is not valid.