CTU-Bern / presize

Precision Based Sample Size Calculation
https://ctu-bern.github.io/presize/
GNU General Public License v3.0
15 stars 13 forks source link

condition > 1 warning if passing multiple `conf.width`s to `prec_prop` #94

Closed aghaynes closed 1 year ago

aghaynes commented 2 years ago

Describe the bug warning re condition > 1 if passing multiple conf.widths to prec_prop

To Reproduce

> prec_prop(p = .36, conf.width = c(0.07, 0.08, 0.09, 0.1, 0.11))

     sample size for a proportion with Wilson confidence interval. 

     p      padj        n conf.width conf.level       lwr       upr
1 0.36 0.3607440 718.9930       0.07       0.95 0.3257440 0.3957440
2 0.36 0.3609716 549.6552       0.08       0.95 0.3209716 0.4009716
3 0.36 0.3612296 433.5577       0.09       0.95 0.3162296 0.4062296
4 0.36 0.3615177 350.5139       0.10       0.95 0.3115177 0.4115177
5 0.36 0.3618361 289.0708       0.11       0.95 0.3068361 0.4168361

NOTE: padj is the adjusted proportion, from which the ci is calculated.

Warning messages:
1: In prec_prop(p = 0.36, conf.width = c(0.07, 0.08, 0.09, 0.1, 0.11)) :
  more than one method was chosen, 'wilson' will be used
2: In if (conf.width < min(p)) { :
  the condition has length > 1 and only the first element will be used

Expected behavior No warning