Skip to content

WIP/ENH: add option null_prop_var in samplesize_proportions_2indep_onetail - #8676

Open
josef-pkt wants to merge 1 commit into
statsmodels:mainfrom
josef-pkt:samplesize_prop_2indep
Open

josef-pkt wants to merge 1 commit into
statsmodels:mainfrom
josef-pkt:samplesize_prop_2indep

Conversation

@josef-pkt

@josef-pkt josef-pkt commented Feb 16, 2023 •

Copy link
Copy Markdown
Member

closes #8675

This will not be in 0.14

No real theoretical justification, and might need other options in the future.

for example
Wang Chow use the same var or std under null and alternative in sample size formula.
My guess is that this corresponds to a wald test for proportions, which does not have good small sample properties.

Wang, Hansheng, and Shein-Chung Chow. “Sample Size Calculation for Comparing Proportions.” In Wiley Encyclopedia of Clinical Trials. John Wiley & Sons, Ltd, 2007. https://doi.org/10.1002/9780471462422.eoct005.

opposite direction
some articles add continuity correction to match more closely Fisher's exact test, which is conservative in small samples.
e.g.
last paragraph in note section with two references
https://search.r-project.org/CRAN/refmans/EnvStats/html/propTestPower.html

another article, Ury and Fleiss use the same var under null and alternative but add continuity correction
Ury, Hans K., and Joseph L. Fleiss. “On Approximate Sample Sizes for Comparing Two Independent Proportions with the Use of Yates’ Correction.” Biometrics 36, no. 2 (1980): 347–51. https://doi.org/10.2307/2529991.

@josef-pkt

Copy link
Copy Markdown
Member Author

I think I will add this to 0.14

"pooled" can be changed to "score" or similar in a backwards compatible way (as alias) when we add power for non-zero null.

@josef-pkt

Copy link
Copy Markdown
Member Author

I still cannot think of a (theoretical) justification for using either prop1 or prop2 for the null std.

R also has only the pooled version, no option for changing it.
Results match our current results.
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/power.prop.test.html

e.g.

> power.prop.test(p1=0.03, p2=0.02, power=0.8, strict=FALSE)

     Two-sample comparison of proportions power calculation 

              n = 3825.15
             p1 = 0.03
             p2 = 0.02
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

NOTE: n is number in *each* group

@josef-pkt

Copy link
Copy Markdown
Member Author

One possible justification could be as a bound, i.e. we take the worst of the three options.
The variance is larger as we get closer to prop=0.5.

here
p2 = 0.02
p1 = p2 + diff = 0.02 + 0.01 = 0.03

n1 = sm.stats.samplesize_proportions_2indep_onetail(0.01, 0.02, 0.8, null_var="prop1")
n2 = sm.stats.samplesize_proportions_2indep_onetail(0.01, 0.02, 0.8, null_var="prop2")
np = sm.stats.samplesize_proportions_2indep_onetail(0.01, 0.02, 0.8, null_var="pooled")
​
n1, n2, np 
(4337.0730837641095, 3292.2657351312073, 3825.1497221026225)

@josef-pkt josef-pkt added this to the 0.15 milestone Feb 24, 2023
@josef-pkt josef-pkt changed the title ENH: add option null_prop_var in samplesize_proportions_2indep_onetail WIP/ENH: add option null_prop_var in samplesize_proportions_2indep_onetail Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: add option for null_var or null_prop to samplesize_proportions_2indep_onetail

1 participant