Binomial calculator based on continuous hypothesis testing: there is no such a thing as a discrete hypothesis.


We present R code to compute the posterior probability based on continuous (instead of traditionally discrete) hypotheses (intervals), when the point-hypotheses have equal probabilities because prior probabilities are unknown.



This program computes the posterior probability of any hypothesis H (with unknown prior probability) chosen by the investigator. This hypothesis is a continuous interval of points which are all the infinite possible cases that constitute my hypothesis. This program creates a function f(x) which associates to each point xi belonging to my hypothesis, the probability of the (observed) event E given this point (or case) xi. That is to say, f(x)= P(E|x). Then, the program executes the following summation S1= ∑i P(xi)f(xi). Thus, S1 is the area of my hypothesis H. S1=P(H)P(E|H). For each xi belonging to H and H, p(xi) is a constant k; k=1/n where n indicates the number of xi. n indicates the accuracy of the program, with higher values producing more accurate results. We set n=10^7 as default value as the increase in accuracy above this value (in our opinion) is not large enough to justify an increase in CPU time. Ignoring the phenomenon, we assigned to each point xi the same probability (1/10^7).
To inform R about my hypothesis, I need to input the range of this hypothesis, that is the lower and upper bound. For example, I need to find out the probability that my ability to predict the future price of an equity index is comprised between g1 and g2. Then, I have to input g1 as the value for the lower bound and g2 as the value for the upper bound.

The program divides the area of hypothesis H by the total area, which is equal to the area of H+¬H.

Our hypothesis is continuous and not discrete. In fact, if a hypothesis is a numerable set of points, then for any f(x) the probability of this hypothesis will always be null, which gives rise to  a paradox. Thus, a hypothesis must correspond to a non-numerable set of points (i.e. cases)that is, it must have cardinality c. So the hypothesis correspond to one or more intervals whose upper and lower bounds I have to assign each time. The program computes the probability of one interval each time it is run. When the hypothesis comprises many intervals, the program will have to be run multiple times.

To run the code in R, type: source(“PifferBayesBeta.R”) in the console and follow the command prompt.



Additional Assets


This article and its reviews are distributed under the terms of the Creative Commons Attribution 4.0 International License, which permits unrestricted use, distribution, and redistribution in any medium, provided that the original author and source are credited.