Re: Calculating cumulative probability



On Feb 15, 10:53 am, "Roger Stafford"
<ellieandrogerxy...@xxxxxxxxxxxxxxxxxxxxxx> wrote:
"Roger Stafford" <ellieandrogerxy...@xxxxxxxxxxxxxxxxxxxxxx> wrote in
message <fp24vh$49...@xxxxxxxxxxxxxxxxxx>...



  Since you know X and Y to be independent random variables, your desired
probability can be expressed as the iterated integral:

 P(k) = integral, 0 to inf, (integral, y to y+k, f(x)*g(y) dx) dy

where f(x) and g(y) are the respective probability density functions of X and
Y.  
That is: the integral from 0 to infinity of the integral from y to y+k of the
product f(x)*g(y), first with respect to x and then with respect to y.  (I would
not have used the term "cumulative probability" to describe this particular
probability, however.)  Unfortunately, matlab's 'dblquad' is unable to
evaluate
a double integral in this form where the inner limits of integration depend
on
the outer variable.

  I can see two possibilities for numerically calculating this using matlab.  
First, if you already know the cumulative distribution of X as a function, F
(x),
the above can then be directly expressed as the single integral:

 integral, 0 to inf, (F(y+k)-F(y))*g(y) dy

by direct substitution of F(y+k)-F(y) for the inner integral after factoring
out
the g(y).  Any of the matlab single quadrature functions can be used for
this:
'quad', 'quad8', etc.

  The other possibility is to make a change of variable.  Define

 u = x - y

Then the iterated integral can be converted to the form

 integral, 0 to inf, integral, 0 to k, f(u+y)*g(y) du dy

(Note that the Jacobian in this case is just 1.)  This is in a form that can be
used by 'dblquad' since the inner limits are independent of y values.  This is
the method you should use if you know only the two probability density
functions.

  Note that each of these forms requires a separate numerical integration
for
each desired value of k.  There is always the possibility that, depending on
the functions, f(x) and g(y), there may exist an analytic solution to these
integrals using the 'int' function of the Symbolic Toolbox, but the odds are
heavily against this I would think.

Roger Stafford

-------
  I should have warned you that matlab's numerical quadrature functions
cannot actually accept infinite limits.  in your problem you will have to use a
finite limit that is sufficiently large to encompass all the areas with significant
probability densities, but not so large as to confuse the routine into taking
too few samples of the integrands in the critical areas to attain the needed
accuracy.  These routines don't seem to be particularly robust in this regard.  
You'll have to experiment with them a bit.

Roger Stafford- Hide quoted text -

- Show quoted text -

Another way is to hit it with the sledge hammer: Monte Carlo
simulation.
Sample, say, a million from each distribution, then do a 2-D histogram
on the results.
Repeat this many times and use allstats (from the File Exchange) to
calculate the statistics for each bin in the histogram.
When the standard errors for each bin in the histogram reduce to an
acceptable level, you're done.
.



Relevant Pages

  • Re: THE RADIUS OF THE ELECTRON?
    ... because the integrals turn out to be integrals of orthogonal functions. ... probability in a non infinitesimal region. ... Time dependent or time-independent Schroedinger equation? ...
    (sci.physics)
  • Re: calculus of conditional probability?
    ... Does anyone have a textbook they can suggest for a bio ... >let's say the integrals are like... ... >and pis a conditional probability. ... Try to visualize on a plane:rectangles areas,strips areas, ...
    (sci.stat.math)
  • =?iso-8859-1?q?Parallel_execution_of_an_integral_approach_of_the_passage_to_the_security_der
    ... Parallel execution of an integral approach of the passage to the ... multiple integrals gotten discretizing the interval of the time under ... the box of derivatives financial. ... discretized of the density of the probability is needed to generate ...
    (sci.math)
  • Re: help evaluating definite integral
    ... > above is a special case of one of the integrals known as Dirichlet ... What is the probability that the red dots ... Conditioning on the position, p, of the black dot, the chance that all ...
    (sci.math)
  • Re: Concept of measure in undergraduate mathematics.
    ... >understanding limits with or without deltas and epsilons. ... >Taylor's Introduction to Measure and Probability and all was made clear. ... the earliest use of integration ... A Lebesgue extension requires the measure ...
    (sci.math)