Presentation is loading. Please wait.

Presentation is loading. Please wait.

SE-280 Dr. Mark L. Hornick Numerical Integration.

Similar presentations


Presentation on theme: "SE-280 Dr. Mark L. Hornick Numerical Integration."— Presentation transcript:

1 SE-280 Dr. Mark L. Hornick Numerical Integration

2 SE-280 Dr. Mark L. Hornick 2 In the PSP, definite integrals of the t-distribution are used to calculate the significance of a correlation and the prediction interval of an estimate. Requirement: Integrate an arbitrary f(x) from a to b The problem is that there is no (simple) closed-form solution for the integral of the t-distribution function.

3 SE-280 Dr. Mark L. Hornick 3 When is Numerical Integration needed? Analytic solution F(x) is not always practical

4 SE-280 Dr. Mark L. Hornick 4 Numerical Integration Approach Fit polynomial (or something else) to f(x) All at once In discrete segments Polynomial degree can vary Integrate resulting polynomial(s) Using well-known formulas

5 SE-280 Dr. Mark L. Hornick 5 Integration Example

6 SE-280 Dr. Mark L. Hornick 6 Zeroth-Order Fit h

7 SE-280 Dr. Mark L. Hornick 7 Zeroth-Order Fit hh f0f0 f2f2 f1f1

8 SE-280 Dr. Mark L. Hornick 8 Zeroth-Order Fit h Note: Sometimes “w” is used instead of “h” for step width.

9 SE-280 Dr. Mark L. Hornick 9 First-Order Fit (trapezoidal rule) hh f0f0 f2f2 f1f1

10 SE-280 Dr. Mark L. Hornick 10 First-Order Fit (contd.)

11 SE-280 Dr. Mark L. Hornick 11 Second-Order Fit h f0f0 f2f2 f1f1 h Parabolic curve

12 SE-280 Dr. Mark L. Hornick 12 Simpson’s Rule Simpson’s 1/3 rule: parabolic segments Coefficients First and last terms: 1 Odd terms: 4 Even terms: 2 n must be even

13 SE-280 Dr. Mark L. Hornick 13 In all these methods, we must choose an appropriate step size. A small step size generally gives a better fit, but takes longer to calculate and may increase round-off error. A large step size is usually less accurate, but faster to compute.

14 SE-280 Dr. Mark L. Hornick 14 Often the best choice is to iterate to the "right" step size. Choose # of segments (n 1 ) Calculate integral (save as p a ) Calc new segments (n j = 2*n j-1 ) |p b - p a | < e Calculate integral (save as p b ) Set p a = p b Done (answer = p b ) "e" is the desired result precision "h" is derived from "n", the number of segments Yes No

15 SE-280 Dr. Mark L. Hornick 15 Distributions are important statistical functions that we often need to integrate numerically, since no closed-form solution exists. Normal Distribution: The probability density function for a large sample size Its integral represents a cumulative probability over some range (more on that in a later).


Download ppt "SE-280 Dr. Mark L. Hornick Numerical Integration."

Similar presentations


Ads by Google