Inference strategies and standard errors¤
infer delegates to an explicit hypothesis-test strategy and, when needed, an
explicit covariance estimator. This separation keeps the workflow clear about
what inferential assumptions are being used after fitting.
Hypothesis testing¤
glmax.AbstractTest
glmax.AbstractTest
¤
Abstract base for inference strategies used by infer(fitted, inferrer=...).
Subclasses implement test to compute test statistics and p-values
from a glmax.FittedGLM. The stderr estimator is passed in so
strategies can choose whether to use it.
__init__(self)
¤
Initialize self. See help(type(self)) for accurate signature.
test(self, fitted: glmax.FittedGLM, stderr: glmax.AbstractStdErrEstimator) -> glmax.InferenceResult
¤
Compute inferential summaries from a fitted GLM.
Concrete strategies may use the injected covariance estimator or ignore it if the statistic is computed directly from fit artifacts.
Arguments:
fitted: fittedglmax.FittedGLMnoun.stderr:glmax.AbstractStdErrEstimator; concrete strategies call it only if needed.
Returns:
glmax.InferenceResult with fields (params, se, stat, p).
glmax.WaldTest(glmax.AbstractTest)
¤
Wald (z/t) coefficient hypothesis test.
Computes per-coefficient test statistics \(z_j = \hat{\beta}_j / \operatorname{SE}(\hat{\beta}_j)\) and two-sided p-values. Here \(\hat{\beta}_j\) is the fitted coefficient for term \(j\) and \(\operatorname{SE}(\hat{\beta}_j)\) is its estimated standard error. Uses a \(t_{n-p}\) reference distribution for Gaussian models and \(\mathcal{N}(0, 1)\) for all others, where \(n\) is the number of observations and \(p\) is the number of coefficients.
Standard errors are obtained from the injected
glmax.AbstractStdErrEstimator.
__init__(self)
¤
Initialize self. See help(type(self)) for accurate signature.
glmax.ScoreTest(glmax.AbstractTest)
¤
Per-coefficient MLE-point score-style statistic built from fit artifacts.
Computes the per-coefficient score statistic directly from score_residual,
glm_wt, and the Fisher-information diagonal without calling stderr.
The resulting statistic is normalised with a standard normal reference
distribution. This is an MLE-point diagnostic, not a restricted-model Rao
score test.
se is set to NaN because no standard error carrier is exposed. Callers
relying on glmax.InferenceResult.se downstream must handle NaN
when using this inferrer.
__init__(self)
¤
Initialize self. See help(type(self)) for accurate signature.
Standard-Error estimators¤
Covariance estimators are separate strategy objects so the same fitted noun can be paired with different error models.
glmax.AbstractStdErrEstimator
glmax.AbstractStdErrEstimator
¤
Abstract base for covariance estimators used by infer(fitted, stderr=...).
Subclasses implement covariance to return a (p, p) covariance matrix for
\(\hat{\beta}\). The matrix is consumed by glmax.AbstractTest
strategies to compute standard errors and test statistics.
__init__(self)
¤
Initialize self. See help(type(self)) for accurate signature.
covariance(self, fitted: glmax.FittedGLM) -> jax.Array
¤
Estimate the covariance matrix for fitted.result.params.beta.
The returned matrix estimates \(\widehat{\operatorname{Cov}}(\hat{\beta})\), where \(\hat{\beta}\) is the fitted coefficient vector.
Arguments:
fitted: fittedglmax.FittedGLMnoun.
Returns:
Covariance matrix
\(\widehat{\operatorname{Cov}}(\hat{\beta})\), shape (p, p).
glmax.FisherInfoError(glmax.AbstractStdErrEstimator)
¤
Fisher-information covariance estimator.
Reconstructs the expected Fisher information from fit artifacts and inverts it.
Default estimator used by WaldTest.
__init__(self)
¤
Initialize self. See help(type(self)) for accurate signature.
glmax.HuberError(glmax.AbstractStdErrEstimator)
¤
Huber-White sandwich covariance estimator.
Computes the heteroskedasticity-robust "meat-bread" sandwich estimator \(\hat{\mathrm{Cov}}(\hat\beta) = B \, M \, B\) where \(B = \hat\phi \, \mathcal{I}^{-1}\) and \(M = X^\top \mathrm{diag}(\hat{s}_i^2) X\) with per-observation score contributions \(\hat{s}_i = w_i r_i / \hat\phi\).
__init__(self)
¤
Initialize self. See help(type(self)) for accurate signature.