Template:ConfidenceInterval: Difference between revisions

From HorizonXI Wiki
m (removed whitespaces in output)
(+/- even for extreme cases to increase readability)
Line 4: Line 4:
-->|<!--
-->|<!--
if less than three success registered, use "rule of 3" for the upper bound
if less than three success registered, use "rule of 3" for the upper bound
-->{{#ifexpr: {{{1}}} <= 3 and {{{1}}} >= 0 |+{{#expr: 100* 3/{{{2}}} round {{{digits|1}}}}}<!--
-->{{#ifexpr: {{{1}}} <= 3 and {{{1}}} >= 0 |+/-{{#expr: 100* 3/{{{2}}} round {{{digits|1}}}}}<!--
-->|<!--
-->|<!--
if nearly all draws end in successes, use "rule of 3" for the lower bound
if nearly all draws end in successes, use "rule of 3" for the lower bound
-->{{#ifexpr: {{{1}}} >= ({{{2}}} - 3) and {{{1}}} <= {{{2}}} |-{{#expr: 100* 3/{{{2}}} round {{{digits|1}}}}}<!--
-->{{#ifexpr: {{{1}}} >= ({{{2}}} - 3) and {{{1}}} <= {{{2}}} |+/-{{#expr: 100* 3/{{{2}}} round {{{digits|1}}}}}<!--
-->|<!--
-->|<!--
-->}}<!--
-->}}<!--

Revision as of 20:56, 22 August 2023


Usage

Calculates the 95% confidence interval for inputs k successes on n total number of draws. Returns a percentage value without % sign with one decimal (if more or less digits are desired, use the digits argument).

{{ConfidenceInterval|k|n}}
  • 50 success on 100 draws represents a success rate of (50+/-9.8)%
  • 250 success on 500 draws represents a success rate of (50+/-4.4)%
  • 50 success on 500 draws represents a success rate of (10+/-2.62962)% (displaying up to 5 digits with the digits argument here).
  • 100 success on 100 draws represents a success rate of (100+/-3)%
  • 0 success on 100 draws represents a success rate of (0+/-3)%
  • 4765 success on 4765 draws represents a success rate of (100+/-0.1)%
  • 0 success on 365 draws represents a success rate of (0+/-0.8)%
  • 100 success on 10 draws represents a success rate of (1000)% (this is a case where the confidence interval makes no sense, thus it is not reported if k > n).