17 Replies Latest reply: Dec 21, 2016 7:13 PM by Charles Demarest RSS

    Cumulative binomial distribution in equation editor

    Charles Demarest

      Hi, I am new to Qlik Sense and was not able to figure out how to calculate cumulative binomial distribution in the equation editor.  I would like to have this value in a table.

       

      Qlik sense does not have discrete binomial distribution function either, but that can be calculated using existing functions as per below:

       

      combin(n,x)*pow(0.05,x)*pow(0.95,n-x)

       

      n and x are integers representing the number of observations and the number of statistical test exceedences at a 95% confidence interval.  The above formula works for discrete outcomes, for example, the probability of having exactly 5 out of 100 results be exceedences (n=100 and x=5 plugged into above), however, what I want is the cumulative probability of 5 or fewer exceedences, which would be the above with (n=100, x=0) + (n=100, x=1) + ... + (n=100, x=5).  It would seem like this could be achieved with a loop, but this does not seem to be available in the editor or an ability to create it in a custom function, something like:

       

      cbd = 0

      for i= 0 to x

      cbd = cbd + combin(n,i)*pow(0.05,i)*pow(0.95,n-i)

      next i

       

      Any help with this would be appreciated