Re: How to get probability of chi-sqares distribution?



In article <ef3ebd5.2@xxxxxxxxxxxxxxxxxxxxxxx>, Tab
<jilingerandtab@xxxxxxx> wrote:

Thank you Peter and Roger:

What I don't understand is:
func = @(x)chi2pdf(x,21);
p1=quad(func, 0, 114);

it returns a value of 1.

func = @(x)chi2pdf(x,21);
p=quad(func, 0, 1514);

It returns a value of
5.5235e-011.

I think that in the latter case, the integration range is bigger than
that of the former one. Should the latter case return a value no less
than the former one?

Thank you again
Tab
-----------------------
Peter has told you why that is, Tab. What it amounts to is this (as I
understand it.) When you give such a large range as 0 to 1514, 'quad'
first chooses a set of uniformly-spaced values of x over that range to
determine some of the characteristics of the integrand's variation. What
it finds is that all the values are zero or almost zero, since it misses
that very short interval near the left side where essentially all the
important density values are located. Hence 'quad' decides the integral
is, to all intents and purposes, zero. With the narrower limits 0 to 114,
'quad' manages to catch one or more significant non zero values at the
left and then begins centering its attention on them. Thus it obtains an
accurate integral value.

Probably what you would need to avoid this pitfall is a way of informing
'quad' how finely divided its first set of integrand evaluations should be
so as to be sure not to miss the location of significant values. Have you
tried using other quadrature functions such as 'quad8' or 'quadl', perhaps
with tight tolerance settings?

Roger Stafford
.



Relevant Pages

  • Re: How to get probability of chi-sqares distribution?
    ... When you give such a large range as 0 to 1514, 'quad' ... it finds is that all the values are zero or almost zero, ... The first four points are large enough that the approximation QUAD uses ... For the case where the rightmost limit of integration is 1514, ...
    (comp.soft-sys.matlab)
  • Re: function handle
    ... However, QUAD calls your function with a vector, ... element-by-element multiplication. ... always return values between zero and one but it does not. ... I suspect the limits of integration you're using is the cause of the ...
    (comp.soft-sys.matlab)
  • Re: Guaranteed precision at numerical integration?
    ... > integration tool such as quad to fail any tolerance you choose. ... zero, except for what is effectively a delta function ...
    (comp.soft-sys.matlab)
  • Re: The Usage of Quad Function
    ... I need to use quad to do a integration ... function y = Pixel (t_real, sigma, P0) ... as written you're dividing by 2 and multiplying by sigma.^2, which explains the zero. ... The reason is that QUAD will evaluate your function at more than one value of t at a time, and it expects your function to compute the integrand elementwise. ...
    (comp.soft-sys.matlab)
  • Re: This is What Einstein Actually Did.
    ... |>|>| during this race is zero, ... |>|>velocity, you stupid cunt, and the velocity is zero. ... |>We know that already, neither does Phuckwit Duck. ... you'll never understand integration. ...
    (sci.physics.relativity)