You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH/DOC/UseCase: using models, OLS, GLM, discrete for equivalence and superiority testing #6403
Our models have good support for linear hypothesis and we can reuse those also for simpler cases like 2- or k-sample cases. plus we can control for confounders #2077 regression equivalent of simple, standalone hypothesis test
TOST is equivalent (at least in linear or r-test case) to checking whether a 2-alpha confidence interval is inside the equivalence margin. The confidence interval for parameters and linear combination is already available.
Hypothesis test with non-zero value and one sided alternative: This is the basic hypothesis test for score confidence intervals and for equivalence, inferiority and superiority tests.
Currently we don't allow for one-sided alternative in Results.t_testResults.t_test allow one sided option #1193
What is the effect/contrast of interest?
simple case is a linear/affine restriction on parameters, supported by current wald and t tests
hypothesis, linear/affine restriction on predictions similar to margins e.g. ENH: predictive margins versus teffects regression adjustment #3744
There should be an issue about allowing inference with several cases of predict, e.g. comparing prediction at average or average prediction for two cases of exog, e.g. treatment effect.
Because of the link function, this is not directly a comparison of parameters,
e.g. poisson mean for treated versus poisson mean of control.
I'm not sure what the status here is, predict cannot handle it, but margins has some support for discrete changes of a dummy/binary variable. (*)
(*) IIRC: margins ends up with a linearized version of the effect of a dummy using delta method to get variance of the difference in two predictions.
I guess we want something like an ATE using a parametric model and standard inference on it, including hypothesis with one-sided alternatives (or equivalence and similar).
Computing this is not difficult for linear models or for linpred, but it is in GLM/discrete.
I already had written TOST for one and 2 sample proportions binom_tost and proportions_ztost
(neither docstring has references), both just delegate to corresponding one-sided tests.
and the corresponding power function power_binom_tost, power_ztost_prop
nothing yet for Poisson.
The parameters in Logit, Poisson have interpretation as log ratios, so, I guess, in the simplest 1-parameter case (e.g. single treatment dummy), we could convert (multiplicative, e.g. 10%) equivalence margins on rates to equivalence margins on the parameter.
or in exp-form on the odds-ratio or intensity ratio. (test on equivalence in terms of or or ir)
idea for possible postestimation/inference for single parameter of interest (or a few)
In OLS we can absorb variables that are not of interest, so we only have the variables of interest in the regression model.
We cannot do that in GLM or other nonlinear models.
However, I think we can get a block diagonal cov_params (at least in the standard cases) when we orthogonalize the variables of interest versus the variables not of interest. We still have to include all variables, but I think the parameters for the orthogonalized variables should be the same as before (guessing on some equivalence to Frisch-Waug-Lovel or however).
AFAICS, this is the same as what we are doing in a score or conditional moment test for zero restrictions on some parameters, Only in this case we would transform exog.
This might have other use cases (maybe for sparse regressor in GLM). Current context is equivalence testing.
update: maybe not so easy,
We have weights in GLM, instead of x'x we have a weighted version with hessian_factor. That changes during optimization. So we might be able to do a weighted orthogonalization at the optimum, but we won't be able to orthogonalize only once during the optimization.
However, they "assume" or only treat the case of 2 independent regression coefficients, and then just apply standard equivalence testing on the difference.
This is a case that we usually don't have in a regression setting. It still just equivalent to a 2 sample t_test.
(I only looked at the section with the equivalence test, section 4, and didn't read whether they justify it.)
However, we can do that for a single (affine) constraint under testing using Results.t_test if that included one-sided tests, e.g. H0: b1 - b0 = d versus H: b1 - b0 < d` (which IIRC is the inferiority test when larger is better)
or we could orthogonalize [x0, x1] from the rest and reparameterize.
The above is for equivalence testing of parameters.
That still leaves equivalence testing of margins, prediction (potential outcomes), e.g. ATE
I have a PR with score confidence intervals for GLM, applicable to models that have fit_constrained and score_test methods.
It should be possible to use this for equivalence and superiority with a margin testing.
Using score test should be more accurate than wald test because it adjusts other parameter estimates to the non-zero null.
Confidence intervals can be used for rejection decision of an equivalence test, but we don't directly get a p-value.
And two tests at equivalence margins will be cheaper than finding limits of score (or profile likelihood) confint.
Activity
josef-pkt commentedon Jan 12, 2020
I already had written TOST for one and 2 sample proportions
binom_tostandproportions_ztost(neither docstring has references), both just delegate to corresponding one-sided tests.
and the corresponding power function
power_binom_tost,power_ztost_propnothing yet for Poisson.
The parameters in Logit, Poisson have interpretation as log ratios, so, I guess, in the simplest 1-parameter case (e.g. single treatment dummy), we could convert (multiplicative, e.g. 10%) equivalence margins on rates to equivalence margins on the parameter.
or in exp-form on the odds-ratio or intensity ratio. (test on equivalence in terms of
ororir)josef-pkt commentedon Jan 14, 2020
idea for possible postestimation/inference for single parameter of interest (or a few)
In OLS we can absorb variables that are not of interest, so we only have the variables of interest in the regression model.
We cannot do that in GLM or other nonlinear models.
However, I think we can get a block diagonal cov_params (at least in the standard cases) when we orthogonalize the variables of interest versus the variables not of interest. We still have to include all variables, but I think the parameters for the orthogonalized variables should be the same as before (guessing on some equivalence to Frisch-Waug-Lovel or however).
AFAICS, this is the same as what we are doing in a score or conditional moment test for zero restrictions on some parameters, Only in this case we would transform
exog.This might have other use cases (maybe for sparse regressor in GLM). Current context is equivalence testing.
update: maybe not so easy,
We have weights in GLM, instead of
x'xwe have a weighted version with hessian_factor. That changes during optimization. So we might be able to do a weighted orthogonalization at the optimum, but we won't be able to orthogonalize only once during the optimization.I found an article on my computer for equivalence testing of regression coefficients
Counsell, Alyssa, and Robert A. Cribbie. 2015. “Equivalence Tests for Comparing Correlation and Regression Coefficients.” British Journal of Mathematical and Statistical Psychology 68 (2): 292–309. https://doi.org/10.1111/bmsp.12045.
However, they "assume" or only treat the case of 2 independent regression coefficients, and then just apply standard equivalence testing on the difference.
This is a case that we usually don't have in a regression setting. It still just equivalent to a 2 sample t_test.
(I only looked at the section with the equivalence test, section 4, and didn't read whether they justify it.)
However, we can do that for a single (affine) constraint under testing using
Results.t_testif that included one-sided tests, e.g.H0: b1 - b0 = dversusH: b1 - b0 < d` (which IIRC is the inferiority test when larger is better)or we could orthogonalize [x0, x1] from the rest and reparameterize.
The above is for equivalence testing of parameters.
That still leaves equivalence testing of
margins, prediction (potential outcomes), e.g. ATEjosef-pkt commentedon Sep 29, 2021
I have a PR with score confidence intervals for GLM, applicable to models that have fit_constrained and score_test methods.
It should be possible to use this for equivalence and superiority with a margin testing.
Using score test should be more accurate than wald test because it adjusts other parameter estimates to the non-zero null.
Confidence intervals can be used for rejection decision of an equivalence test, but we don't directly get a p-value.
And two tests at equivalence margins will be cheaper than finding limits of score (or profile likelihood) confint.