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: power_proportions_2indep with value different of zero and different compare #8251
power_proportions_2indep does not support value different from equality.
Also, not compare option, which will become only relevant if non-zero null is supported.
I partially read Farrington and Manning 1990 again.
The main task is to add constrained parameter estimates as in score test. Using this as default extends the pooled estimate under the null and is backwards compatible.
Farrington and Manning also have the option of using the wald variance, which I guess is based on the proportions under the alternative.
It looks like this follows the same pattern as we have for poisson and negbin in PR #8166
F/M also have an estimate under fixed margins, but they mention that the samplesize or power estimates are not very good.
Aside: proportion has very few references
I cannot find anymore what I used to implement the power function.
The generic part is general in many references, but I don't know what the specific Binomial reference is (using the pooled estimate instead of (wald) props under alternative).
I guess the power for the equality test is also old and common.
e.g. Lachine 1981 Introduction to sample size determination and power analysis for clinical trials
eq. (12) but he uses fraction of total nobs instead of nobs_ratio, and sample size formula is for total nobs instead of nobs1.
(I had read it in the past, so it was one of the references, but not directly the one I implemented)
related #6721 refactoring, reorganizing proportions
need to go through the NCSS/PASS docs again
e.g.
Non-Zero_Null_Tests_for_the_Difference_Between_Two_Proportions.pdf
has examples for power for Farrington-Manning score test
and Chow, Shao, and Wang unpooled (i.e. wald) test
and similarly for ratio of proportions
Non-Unity_Null_Tests_for_the_Ratio_of_Two_Proportions.pdf
Can we reuse the test function with nobs1=1, nobs2=nobs_ratio, count1=prop1, count2=prop2 to get the nobs1-normalized null variance?
It think that should work, and we would not need to duplicate the code, or separate out into helper functions.
To using base nobs1=1 in test:
small sample corrections make var not linear in scale, i.e. var at base nobs does not directly scale up.
Consequently, we cannot use the one-tail sample size formula with var independent of nobs to compute required sample size.
The power computation will have to take into account that nobs normalized variance still depends on nobs.
In larger samples, the small sample corrections will be small and ignoring it will still give a good approximation.
For diff, this happens with methods agresti-caffo and with score, correction=True
e.g. comparing nobs-normalized variance for cases nobs=1 versus nobs=100 versus nobs=1000
here's the full version, all compare and methods, score only without correction
Variance for odds-ratio methods logit-adjusted and logit-smoothed and ratio method log-adjusted for nobs1=1 looks strange. They are very small compare to larger nobs1.
Activity
josef-pkt commentedon Feb 24, 2023
bump for 0.15
need to go through the NCSS/PASS docs again
e.g.
Non-Zero_Null_Tests_for_the_Difference_Between_Two_Proportions.pdf
has examples for power for Farrington-Manning score test
and Chow, Shao, and Wang unpooled (i.e. wald) test
and similarly for ratio of proportions
Non-Unity_Null_Tests_for_the_Ratio_of_Two_Proportions.pdf
see also #8676
check, implementation idea
Can we reuse the test function with
nobs1=1, nobs2=nobs_ratio, count1=prop1, count2=prop2to get the nobs1-normalized null variance?It think that should work, and we would not need to duplicate the code, or separate out into helper functions.
josef-pkt commentedon Feb 25, 2023
To using base nobs1=1 in test:
small sample corrections make var not linear in scale, i.e. var at base nobs does not directly scale up.
Consequently, we cannot use the one-tail sample size formula with var independent of nobs to compute required sample size.
The power computation will have to take into account that nobs normalized variance still depends on nobs.
In larger samples, the small sample corrections will be small and ignoring it will still give a good approximation.
For
diff, this happens with methods agresti-caffo and with score, correction=Truee.g. comparing nobs-normalized variance for cases nobs=1 versus nobs=100 versus nobs=1000
a simple solution would be two-step or iterative, using one of the other sample sizes as starting value for nobs1.
josef-pkt commentedon Feb 25, 2023
here's the full version, all compare and methods, score only without correction
Variance for odds-ratio methods logit-adjusted and logit-smoothed and ratio method log-adjusted for nobs1=1 looks strange. They are very small compare to larger nobs1.
josef-pkt commentedon Oct 20, 2025
just found by chance
SAS has power for Farrington-Manning proportions 2indep score test
https://documentation.sas.com/doc/en/statug/15.2/statug_power_details74.htm
we only have power for the z-test, but not for the other, preferred methods in both proportion and rates.