### Abstract

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.### Theory

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 x_{i }belonging
to my hypothesis, the probability of the (observed) event E given this point
(or case) x_{i}. That is to say, f(x)= P(E|x). Then, the program
executes the following summation S_{1}= ∑_{i} P(x_{i})f(x_{i}).
Thus, S_{1 }is the area of my hypothesis H. S_{1}=P(H)P(E|H).
For each x_{i }belonging to H and H, p(x_{i}) is a constant k;
k=1/n where n indicates the number of x_{i}. 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 x_{i }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 g_{1 }and g_{2}. Then, I have to input g_{1
}as the value for the lower bound and g_{2} 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

- PifferBayesBeta.R 894 Bytes

## License

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.