Skip to main content

Linear Approximations of Probability Density Functions

  • Chapter
  • First Online:
Computational Probability Applications

Abstract

We develop a method for approximating the PDF of a continuous random variable with a piecewise-linear function. Four algorithms for choosing the endpoints of the linear segments are compared. The approximation is applied to estimating the convolution of two independent random variables.

This original paper uses many aspects of APPL in order to make approximations to certain random variable algebra operations that do not have closed-form solutions. By making linear approximations of PDFs, APPL can then do operations such a Convolution, Product, and Transform in order to approximate probability distribution of the new random variable. APPL’s ability to define piecewise functions allows simpler linear piecewise functions to be used to approximate the true PDFs. Furthermore, the optimal placement of the segments can be embedded in the APPL explorations.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 109.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Brutman, L. (1998). Lebesgue functions for polynomial interpolation: A survey. Annals of Numerical Mathematics, 4, 111–127.

    Google Scholar 

  2. Nguyen, N. C., Patera, A. T., & Peraire, J. (2007). A “best points” interpolation method for efficient approximation of parameterized functions. International Journal for Numerical Methods in Engineering, 73(4), 521–543.

    Article  Google Scholar 

  3. Rivlin, T. J. (1981). An introduction to the approximation of functions. New York: Dover.

    Google Scholar 

  4. Smith, S. J. (2006). Lebesgue constants in polynomial interpolation. Annales Mathimaticae et Informaticae, 3, 109–123.

    Google Scholar 

  5. Stewart, J. (1999). Calculus: Early transcendentals (4th ed.). Belmont: Brooks/Cole Publishing Company.

    Google Scholar 

  6. Wolfram, S. (2008). Approximate functions and interpolation. Wolfram Mathematica Documentation Center, Wolfram Research. http://reference.wolfram.com/mathematica/tutorial/.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Lawrence M. Leemis .

Editor information

Editors and Affiliations

Appendix: APPL Code for ApproximateRV

Appendix: APPL Code for ApproximateRV

The following APPL code shows the complete algorithm for fitting linear PDF approximations to a continuous PDF.

#

#  ApproximateRV returns an approximate continuous pdf with

#                n - 1 segments

#  INPUTS:  OrigRV   -> a random variable in APPL format

#           npoints  -> any integer >= 3

#

#  OUTPUTS  ApproxRV -> the approx. random variable with npoints - 1

#                       linear segments approaching the original

#                       random variable

#

> ApproximateRV := proc(OrigRV :: list(list),

>   npoints :: {positive, integer})

> local i, n, nsegments, ApproxRV, leftend, rightend, supportsize, X,

>       ns, pdflist, newseg, area, fX, pdflist2, xlist, C, eqns,

>       vars, ans, j, range, tmpeqn, eqspc;

> if (nargs <> 2) then

>   print(‘ERROR(ApproximateRV): This proc requires 2 arguments‘):

>   RETURN():

> fi:

> nsegments := npoints - 1;

> if (nsegments < 2) then

>   print(‘ERROR(ApproximateRV): Second parameter must be > 2‘):

>   RETURN():

> fi:

> X := PDF(OrigRV);

#

#  Calculate the new support

#

> if (X[2][1] = -infinity) then

>   leftend := IDF(X, 1 / 100)

> else

>   leftend := X[2][1]

> fi;

> supportsize := nops(X[2]);

> if (X[2][supportsize] = infinity) then

>   rightend := IDF(X, 99 / 100)

> else

>   rightend := X[2][supportsize]

> fi;

#

#  Calculate equal spacing for initial solutions for x1, x2, ..., xn

#

> eqspc := [leftend];

> for i from 1 to nsegments - 1 do

>   eqspc := [op(eqspc), eqspc[i] + (rightend - leftend)

>            * (1 / (npoints - 1))];

> od;

> eqspc := [op(eqspc), rightend];

#

#  Formulate equations and format for fsolve

#

> eqns := [];

> xlist := [seq(xlist[i],i = 1 .. npoints)];

> xlist[1] := leftend;

> vars := [];

> for i from 2 to npoints do

>   tmpeqn := int(((((X[1][1](xlist[i]) - X[1][1](xlist[i - 1]))) /

>            (xlist[i] - xlist[i - 1])) * (x - xlist[i - 1]) +

>            X[1][1](xlist[i - 1]) - X[1][1](x)) ^ 2,

>            x = xlist[i - 1] .. xlist[i]) = C;

>   eqns := [op(eqns), tmpeqn];

>   vars := [op(vars), xlist[i] = eqspc[i]];

> od;

> eqns := [op(eqns), xlist[npoints] = rightend];

> vars := [op(vars), C = 0.01];

> range := [];

> for i from 1 to nops(vars) do

>   if (i < nops(vars)) then

>     range := [op(range), lhs(vars[i]) = leftend .. rightend];

>   else

>     range := [op(range) , lhs(vars[i]) = 0..1];

>   fi;

> od;

> ans := [op(fsolve({op(eqns)}, {op(vars)}))];

> for i from 1 to nops(ans) do

>   for j from 1 to nops(ans) do

>     if (lhs(ans[j]) = xlist[i]) then

>       xlist[i] := rhs(ans[j]);

>     fi;

>     if (lhs(ans[j]) = C) then

>       C := rhs(ans[j]);

>     fi;

>   od;

> od;

> ns := xlist;

#

#  Calculate the segments of the PDF

#

> pdflist := [];

> for i from 1 to nsegments do

>   newseg := (PDF(X, ns[i + 1]) - PDF(X, ns[i]))

>             / (ns[i + 1] - ns[i]) *(x - ns[i])

>             + PDF(X, ns[i]);

>   pdflist := [op(pdflist), unapply(newseg, x)]

> od;

#

#  Normalize the PDF so that it integrates to 1

#

> area := 0;

> fX := [pdflist, ns, ["Continuous", "PDF"]];

> for i from 1 to nsegments do

>   area := area + evalf(int(fX[1][i](y),

>           y = fX[2][i] .. fX[2][i + 1])):

> od:

> pdflist2 := [];

> for i from 1 to nsegments do

>   newseg := fX[1][i](x) / area;

>   pdflist2 := [op(pdflist2), unapply(newseg, x)]

> od;

> ApproxRV := [pdflist2, ns, ["Continuous", "PDF"]];

> RETURN(ApproxRV);

> end:

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing Switzerland

About this chapter

Cite this chapter

McDaniel, L.S., Glen, A.G., Leemis, L.M. (2017). Linear Approximations of Probability Density Functions. In: Glen, A., Leemis, L. (eds) Computational Probability Applications. International Series in Operations Research & Management Science, vol 247. Springer, Cham. https://doi.org/10.1007/978-3-319-43317-2_10

Download citation

Publish with us

Policies and ethics