1. Joined
    06 Mar '12
    Moves
    625
    28 May '16 07:096 edits
    I know the required equation for this from the output of my computer program but what I want is the algebraic derivation of it, which I don't yet have;

    The equation for the probability mass of the random discrete variable x in a binomial distribution can be expressed as;

    P(x | p, x≤n) = C(n, x) p^x (1 – p)^(n – x)
    ( x, n ∈ ℕ
    p ∈ [0, 1] )

    where:
    n is the number of Bernoulli trials conducted to form the distribution.
    x is a possible total number of yes results from that n number of Bernoulli trials.
    p is the probability of a yes result from each of the Bernoulli trials.
    C(n, x) = n!/( x!(n – x)! ) n, x ∈ ℕ
    and is an application of the binomial coefficient.

    (see https://en.wikipedia.org/wiki/Binomial_distribution )


    But suppose we didn't actual know what the value of p is here but we do know that all its possible values of p within [0, 1] are equally likely i.e. the probability density of p is:

    probability_density(p | 0 ≤ p ≤ 1) = 1 else 0

    ( So this is a probability density OF a probability; what I like to call a 'meta-probability' )
    So how to algebraically derive the the probability mass of an x value given the above condition?
    Here we are treating x as the constant (because we know the x we are currently considering) and p as if it was the random variable along a continuous distribution from 0 to 1.

    I have made a computer program to find out that uses a numerical approach to get ever closer approximations and its output clearly shows the answer is that the probability mass of x given these conditions is this simple continuous distribution equation of:

    P(x | 0≤x≤n) = 1 / (n + 1)

    which also intuitively looks about right to me. The problem here is that I don't yet see how to algebraically show it.
    I assume the derivation would involve an integral but all the ones I tried so far somehow don't seem to work.
  2. Joined
    06 Mar '12
    Moves
    625
    28 May '16 08:26
    bad edit:
    The "C(n, x) = n!/( x!(n – x)! ) n, x ∈ ℕ " was supposed to be:

    C(n, x) = n!/( x!(n – x)! )
    where n, x ∈ ℕ
  3. Joined
    06 Mar '12
    Moves
    625
    28 May '16 09:064 edits
    Forgot to mention:

    As I said, I checked this with a computer program using a numerical method. But that numerical method works by getting the approximation of;

    P(x|n) = lim{t → ∞} (( ∑[i=0, t] P(x | p=i/t, x≤n) ) / t )
    = lim{t → ∞} (( ∑[i=0, t] C(n, x) (i/t)^x (1 – (i/t))^(n – x) ) / t )
    = 1/(n + 1) (according to the program's output)
    where i, t, x, n ∈ ℕ

    This works by getting the average of P(x) as t increases (thus as the range of evenly-speed p values increases).
    Don't know if that helps.
  4. Joined
    06 Mar '12
    Moves
    625
    28 May '16 13:39
    Originally posted by humy
    Forgot to mention:

    As I said, I checked this with a computer program using a numerical method. But that numerical method works by getting the approximation of;

    P(x|n) = lim{t → ∞} (( ∑[i=0, t] P(x | p=i/t, x≤n) ) / t )
    = lim{t → ∞} (( ∑[i=0, t] C(n, x) (i/t)^x (1 – (i/t))^(n – x) ) / t )
    = 1/(n + 1) (according to the program's output)
    where i, t, ...[text shortened]... s t increases (thus as the range of evenly-speed p values increases).
    Don't know if that helps.
    bad edit:

    "evenly-speed" should be "evenly-spread"
  5. Standard memberDeepThought
    Losing the Thread
    Cosmopolis
    Joined
    27 Oct '04
    Moves
    78641
    28 May '16 17:14
    Originally posted by humy
    I know the required equation for this from the output of my computer program but what I want is the algebraic derivation of it, which I don't yet have;

    The equation for the probability mass of the random discrete variable x in a binomial distribution can be expressed as;

    P(x | p, x≤n) = C(n, x) p^x (1 – p)^(n – x)
    ( x, n ∈ ℕ
    p ∈ [0, 1 ...[text shortened]... derivation would involve an integral but all the ones I tried so far somehow don't seem to work.
    You want to show that:

    P(m | 0≤m≤n) = 1 / (n + 1)

    where I'm using your notation, but replacing x with m throughout.

    Given:

    P(m | p, m≤n) = C(n, m) p^m (1 – p)^(n – m)

    and

    probability_density(p | 0 ≤ p ≤ 1) = 1 else 0

    What I think you have to do is integrate the probability over p using the constant density as a weighting:

    P(m | 0≤m≤n) = Integral in range [0, 1] dp probability_density(p) P(m | p, m≤n)

    = C(n, m) Integral in range [0, 1] dp p^m (1 – p)^(n – m)
    = C(n, m) I(n, m)

    I(n, m) = Integral in range [0, 1] dp p^m (1 - p)^(n - m)

    We can do the integral for m = 0, when the integrand is (1 - p)^N and it integrates simply to give 1/(1 + n).

    I(n, 0) = 1/(1 + n)

    Use integration by parts to get the recurrence relation:

    I(n, m) = [m/(N - m + 1)] I(N, m - 1)

    Working out the product we get:

    I(n, m) = 1/C(N, m) I(N, 0) = 1/((1 + n)C(n, m))

    So:

    P(m | 0≤m≤n) = C(n, m) I(n, m) = 1/(1 + n)
  6. Joined
    06 Mar '12
    Moves
    625
    28 May '16 18:284 edits
    Originally posted by DeepThought
    You want to show that:

    P(m | 0≤m≤n) = 1 / (n + 1)

    where I'm using your notation, but replacing x with m throughout.

    Given:

    P(m | p, m≤n) = C(n, m) p^m (1 – p)^(n – m)

    and

    probability_density(p | 0 ≤ p ≤ 1) = 1 else 0

    What I think you have to do is integrate the probability over p using the constant density as a weighting:
    ...[text shortened]... m) = 1/C(N, m) I(N, 0) = 1/((1 + n)C(n, m))

    So:

    P(m | 0≤m≤n) = C(n, m) I(n, m) = 1/(1 + n)
    fantastic! You are sure better at maths than I am.

    I take it what you mean by;

    " C(n, m) Integral in range [0, 1] dp p^m (1 – p)^(n – m) "

    is, using m for x in your notation, the same as:

    C(n, m) * ∫[0, 1] p^m (1 – p)^(n – m) dp

    That was the very first integral I tried but somehow must have done it all wrong because I just got nonsense when I tried it so I had assumed I made a conceptual error somewhere with that. Now I think I actually started on the right track after all but then went all wrong after that point.

    I don't yet get your "...recurrence relation" thing but I will study this and I am sure one way or another I will be able to give a satisfactory explanation of it in my book so, cheers.
  7. Standard memberDeepThought
    Losing the Thread
    Cosmopolis
    Joined
    27 Oct '04
    Moves
    78641
    28 May '16 20:18
    Originally posted by humy
    fantastic! You are sure better at maths than I am.

    I take it what you mean by;

    " C(n, m) Integral in range [0, 1] dp p^m (1 – p)^(n – m) "

    is, using m for x in your notation, the same as:

    C(n, m) * ∫[0, 1] p^m (1 – p)^(n – m) dp

    That was the very first integral I tried but somehow must have done it all wrong because I just got nonsense when I ...[text shortened]... ne way or another I will be able to give a satisfactory explanation of it in my book so, cheers.
    Yes, that is what I meant - I was being lazy and not looking up the unicode for an integral sign. I was trying to produce a proof by induction but ended up with a direct method. I'll fill out the working for the integration:

    I(m, n) = ∫[0, 1] p^m (1 – p)^(n – m) dp

    Integration by parts is based on the identity:

    ∫[0, 1] u(x) dv(x) = ∫[0, 1] d(u(x)v(x)) - ∫[0, 1] v(x) du(x)
    =(u(1)v(1) - u(0)v(0)) - ∫[0, 1] v(x) du(x)

    If u(p) = p^m then du = m p^(m-1) dp

    If dv(p) = (1 - p)^(n-m) dp then v(p) = -(1 - p)^(n - m + 1)/(n - m + 1)

    So:

    I(n, m) = (p^m (1 - p)^(n - m + 1)/(n - m + 1))|[0, 1] - ∫[0, 1] m p^(m - 1) (-1)(1 - p)^(n - m + 1)/(n - m + 1)

    In the first term when p = 0 then p^m = 0, except when m = 0. When p = 1 (1 - p) ^(n - m + 1) = 0. So the first term is zero for all m st 0 < m < n + 1. We are left with:

    I(n, m > 0) = [m/(n - m + 1)] ∫[0, 1] p^(m - 1) (1 - p)^(n - m + 1)

    The integral on the right hand side is just I(n, m - 1), so we have:

    I(n, m) = (m / (n - m + 1)) I(n, m - 1)

    since this is true for all values of m in the range [1, N] we also have:

    I(n, m - 1) = (m - 1)/(n - m + 2) I(n, m - 2)
    ...
    I(n, 1) = 1/(n - 1 + 1) I(n, 0) = I(n, 0)/n

    So we can recursively substitute these expressions until we have I(n, 0) on the right hand side:

    I(n, m) = (m/(n - m + 1))((m - 1)/(n - m + 2)) I(n, m - 2)
    = (m/(n - m + 1))((m - 1)/(n - (m - 1) + 1)). ... 1/n) I(n, 0)
    = (m (m - 1) ... 1)/[(n - m + 1)(n - m + 2) . ... n] I(n, 0)
    = [m! (n - m)! / n!] I(n, 0)
    = I(n, 0)/C(n, m)

    let x = (1 - p)

    I(n, 0) = ∫[0, 1] (1 - p)^n dp = ∫[x = 1, x = 0] x^n -dx = ∫[0, 1] x^n dx = 1/(1 + n)

    So we have the result:

    I(n, m) = 1/[(n + 1) C(n,m)]
  8. Standard memberDeepThought
    Losing the Thread
    Cosmopolis
    Joined
    27 Oct '04
    Moves
    78641
    30 May '16 22:23
    Originally posted by humy
    fantastic! You are sure better at maths than I am.

    I take it what you mean by;

    " C(n, m) Integral in range [0, 1] dp p^m (1 – p)^(n – m) "

    is, using m for x in your notation, the same as:

    C(n, m) * ∫[0, 1] p^m (1 – p)^(n – m) dp

    That was the very first integral I tried but somehow must have done it all wrong because I just got nonsense when I ...[text shortened]... ne way or another I will be able to give a satisfactory explanation of it in my book so, cheers.
    If I was better at maths I'd have noticed that your integral:

    I(N,m) = ∫[0, 1] p^m (1 – p)^(n – m) dp

    Is the Euler Beta Function, given by:

    B(x, y) = ∫[0, 1] t^(x - 1) (1 – t)^(y - 1) dt

    with:

    I(N, m) = B(m + 1, N - m + 1)

    The Euler Beta function for positive integer arguments is (x - 1)!(y - 1)!/(x + y - 1)! which gives us the desired result.

    https://en.wikipedia.org/wiki/Beta_function
  9. Joined
    06 Mar '12
    Moves
    625
    31 May '16 07:281 edit
    Originally posted by DeepThought
    If I was better at maths I'd have noticed that your integral:

    I(N,m) = ∫[0, 1] p^m (1 – p)^(n – m) dp

    Is the Euler Beta Function, given by:

    B(x, y) = ∫[0, 1] t^(x - 1) (1 – t)^(y - 1) dt

    with:

    I(N, m) = B(m + 1, N - m + 1)

    The Euler Beta function for positive integer arguments is (x - 1)!(y - 1)!/(x + y - 1)! which gives us the desired result.

    https://en.wikipedia.org/wiki/Beta_function
    thanks for that. I think I might use this Euler Beta Function often so I better study it at some time.
Back to Top