2

A python-based BER confidence level calculator is being developed for a GNU Radio OOT. From reference 1, the confidence level is calculated by the equation https://www.keysight.com/main/editorial.jspx?ckey=1481106&id=1481106&nid=-11143.0.00&lc=eng&cc=LV

However, reference 2 calculates the confidence level by using the formula: ref 2

The first question is about the two formulas. Why are they different? I did try to implement both of them. The first version is pretty straightforward. However, the exponential and the factorial operations in the second formula caused an "OverflowError: math range error" problem. How do we deal with this?

import math
def confidence_level(N,ber,E):
    sum = 0.0;
    for k in range(0,E):
        sum += math.pow(N*ber,k)/math.factorial(k);
    cl = 1.0 - math.exp(-N*ber)*sum;
    print cl;

confidence_level(1.80e+10, 1.0e-6, 6350);

Reference 1: https://www.keysight.com/main/editorial.jspx?ckey=1481106&id=1481106&nid=-11143.0.00&lc=eng&cc=LV

Reference 2: https://www.jitterlabs.com/support/calculators/ber-confidence-level-calculator

EDIT It seems like the first formula reduces to CL = 1 - exp(-NErrors) since BER = NErrors/NBits. For BPSK modulation with Eb/No = 7 dB, the 100% confidence level is obtained after 14 errors have been detected, which doesn't seem to be accurate.

NBits: 1600 NErrs: 1 BER: 6.2500E-04 CL: 6.3212E-01

NBits: 3200 NErrs: 1 BER: 3.1250E-04 CL: 6.3212E-01

NBits: 4800 NErrs: 3 BER: 6.2500E-04 CL: 9.5021E-01

NBits: 8000 NErrs: 6 BER: 7.5000E-04 CL: 9.9752E-01

NBits: 9600 NErrs: 6 BER: 6.2500E-04 CL: 9.9752E-01

NBits: 11200 NErrs: 8 BER: 7.1429E-04 CL: 9.9966E-01

NBits: 12800 NErrs: 8 BER: 6.2500E-04 CL: 9.9966E-01

NBits: 14400 NErrs: 9 BER: 6.2500E-04 CL: 9.9988E-01

NBits: 16000 NErrs: 9 BER: 5.6250E-04 CL: 9.9988E-01

NBits: 17600 NErrs: 10 BER: 5.6818E-04 CL: 9.9995E-01

NBits: 19200 NErrs: 12 BER: 6.2500E-04 CL: 9.9999E-01

NBits: 20800 NErrs: 12 BER: 5.7692E-04 CL: 9.9999E-01

NBits: 22400 NErrs: 12 BER: 5.3571E-04 CL: 9.9999E-01

NBits: 24000 NErrs: 14 BER: 5.8333E-04 CL: 1.0000E+00

NBits: 25600 NErrs: 16 BER: 6.2500E-04 CL: 1.0000E+00

NBits: 27200 NErrs: 18 BER: 6.6176E-04 CL: 1.0000E+00

NBits: 28800 NErrs: 18 BER: 6.2500E-04 CL: 1.0000E+00

Community
  • 1
  • 1

1 Answers1

1

Why are the formulas different?

Formula 1 can be used only if you have zero errors (i.e. E=0). In that case, it is equivalent to formula 2.

Formula 2 can be used to compute the confidence level no matter how many errors you have observed.

How do we deal with the overflow?

The term e^(-N*BER_s) * sum(...) in the second equation is the poisson cumulative distribution function with parameters lambda = N*BER_s and k = E. Conveniently, this function is implemented in the scipy.stats module. Thus, we can compute the confidence level as follows:

from scipy.stats import poisson
def confidence_level(N, BER_s, E):
    return 1 - poisson.cdf(E, N*BER_s)

For your values (N=1.80e+10, BER_s=1.0e-6, E=6350), this function returns 1.0. Thus, you can be 100% confident, that the true BER of your test is less than 1.0e-6.

jkm
  • 109
  • 4
  • Thanks for a clear explanation. I have tried the code you listed above. Since BER = E/N, I used the formula CL = 1 - poisson.cdf(E, E). The results, however, seem to converge to 0.5 instead of 1.0. Given (N = 6.44E+08, E = 3.27E+07, BER = 5.0663E-02), the confidence level is 4.9995E-01. Am I missing something? – Moses Browne Mwakyanjala Aug 08 '19 at 12:37
  • Yes, you shouldn't use BER_s = E/N, but rather set the maximum acceptable BER as BER_s before the measurement. For instance, you could say: "I want to test if the true BER is less than 1e-6". Then you would perform the measurement, from which you get N and E. Afterwards, calling `confidence_level(N, 1e-6, E)` will tell you the probability that the true BER of the experiment (which we can't know) is less than 1e-6. – jkm Aug 12 '19 at 08:09