Repository navigation
Description
I have commented on this several times, but don't find a specific issue.
Currently wald tests and associated cov_params are integrated into the results classes. They cannot be reused outside of models.
We need a class that can compute hypothesis tests and other inference like conf_int based on mean of effects and their cov.
This will provide t_test and wald_test for, e.g., postestimation results, for which we compute the expected value and a (possibly vectorized) multivariate cov_effect.
AFAIR, there are applications for comparing predictions.
NonlinearDeltaCov is similar already, but it is for a given nonlinear, multivalued or vectorized function, and targeted to the current usecase of nonlinear wald tests and get_prediction.
What we need is a class (maybe Mixin class) that includes the functionality of LikelihoodModelResults t_test and wald_test, and conf_int, i.e. for linear constraints on effects that might be based on a nonlinear, multivalued function.
Not clear yet, vectorization:
AFAICS, NonlinearDeltaCov, has vectorized or joint hypothesis but not both, and only for equal to value hypotheses but not for arbitrary linear constraints (contrasts) like testing that two effects are equal.
t_test and wald_test are similar in that the first is vectorized for individual hypothesis (based on se and not on joint cov) and the second handles joint hypothesis based on cov.
Full vectorization would have a 2dim array of effects, rows are independent cases, columns represent a multivariate effect.
If cov(_effect) is common to all rows, then vectorization should be relatively straightforward (last axis is multivariate).
If covariance differs across rows, then it gets messy, more memory and joint hypothesis tests require vectorized linear algebra (vectorized quadratic forms).
related example
TreatmentEffectResults subclasses ContrastResults which essentially presents t_test results.
(however, "effects" in this case are linear dependent, i.e. we have 3 vectorized hypothesis on 2 underlying effects (ATE and POM0))
possible usecase to check:
get_prediction with multi-valued prediction, e.g. which="prob"
GMM with moment conditions for extra effects, and we want an inference class for the extra effects (base on estimated expected value an submatrix of cov_params)
linear constrast of two predictions: current _wald_nonlinear can compute effect and hypothesis for one effect, eg. difference between the two predictions, but does not compute the joint cov.
(This sounds a bit similar to treatment effect case, but for predictions and not for all extra moment conditions.)
Maybe related
vectorization of score test, i.e. we have "joint" versus "separate" option, but it computes the hypothesis test directly (like t_test and wald_test).
Aside: paired versus independent
Does correlation of "effects" correspond to "paired" version? (for linear constrasts) (might require more assumptions on specification)
e.g. #8784 evaluating out of sample predictions
Extra in-sample effects in GMM are or may be correlated.
risk ratio: is it average of ratio or ratio of average #2215 but that also has nonlinear effect E f(x, y) != f(E x, E y)
Activity