smooth.AutoADAM.rstandard

AutoADAM.rstandard()

Return standardised residuals.

Residuals are scaled by distribution-specific estimates of their scale, corrected for degrees of freedom df = nobs - nparam. The standardisation formula depends on the fitted distribution:

  • dnorm: (e - ē) / √(n/df))

  • dlaplace: e / σ · n/df

  • ds: (e - ē) / · n/df)²

  • dgnorm: (e - ē) / (σ^β · n/df)^(1/β), β = shape

  • dlnorm: exp((log(e) + σ²/2 - mean(·)) / √(n/df)))

  • dinvgauss / dgamma: e / ē

For a correctly specified model the result should be approximately distributed as the standardised version of the fitted distribution. Mirrors R’s rstandard.adam().

Returns:

Standardised residuals, length nobs.

Return type:

NDArray

Raises:

ValueError – If the model has not been fitted yet.

See also

rstudent

Leave-one-out studentised residuals.

outlierdummy

Outlier detection based on standardised residuals.

Examples

>>> model = ADAM(model="AAN")
>>> model.fit(y)
>>> std_res = model.rstandard()
>>> # For a well-specified normal model, std_res ≈ N(0, 1)
>>> abs(std_res.mean()) < 0.1
True

Parent Class: AutoADAM