Hướng dẫn dùng binomial cdf trong PHP

Calculates any one parameter of the binomial
     distribution given values for the others.

                              Arguments

     WHICH --> Integer indicating which of the next four argument
               values is to be calculated from the others.
               Legal range: 1..4
               iwhich = 1 : Calculate P and Q from S,XN,PR and OMPR
               iwhich = 2 : Calculate S from P,Q,XN,PR and OMPR
               iwhich = 3 : Calculate XN from P,Q,S,PR and OMPR
               iwhich = 4 : Calculate PR and OMPR from P,Q,S and XN

     P The cumulation from 0 to S of the binomial distribution.
            [Probablility of S or fewer successes in XN trials each
            with probability of success PR.]
            Input range: [0,1].

     Q 1-P.
            Input range: [0, 1].
            P + Q = 1.0.

     S The number of successes observed.
            Input range: [0, XN]
            Search range: [0, XN]

     XN  The number of binomial trials.
              Input range: [0, +infinity].
              Search range: [1E-100, 1E100]

     PR  The probability of success in each binomial trial.
              Input range: [0,1].
              Search range: [0,1]

     OMPR  1-PR
              Input range: [0,1].
              Search range: [0,1]
              PR + OMPR = 1.0

     STATUS

Output

This will produce following result −

float[1]

Example

In the following example when which=3, calculate XN from [P, S, PR].

  • P is the cumulation from 0 to S of the binomial distribution. Input range: [0, 1] .

  • S is number of successes observed. Input range: [0,XN].

  • XN is number of binomial trials. Input range: [0, +infinity].

  • PR is the probability of success in each binomial trial. Input range: [0, 1].

Output

This will produce following result −

float[3]

Example

In the following example when which=4, calculate PR from [P, S, XN].

  • P is the cumulation from 0 to S of the binomial distribution. Input range: [0, 1] .

  • S is number of successes observed. Input range: [0,XN].

  • XN is number of binomial trials. Input range: [0, +infinity].

  • PR is the probability of success in each binomial trial. Input range: [0, 1].

Output

This will produce following result −

float[0.7]

Example

Following is an error case. In the following example which

Output

This will produce following result and a warning in logs PHP Warning: stats_cdf_binomial[]: Fourth parameter should be in the 1..4 range

bool[false]

Chủ Đề