PDF_TO_CDF Name
PDF_TO_CDF Purpose
This function estimates a cumulative distribution function from a given
probability density function.
Category
Statistics
Calling Sequence
Result = PDF_TO_CDF( Xpdf, Pdf ) Input
Xpdf: A vector of type floating point containing the location of the
values in Pdf.
Pdf: A vector of type floating point containing the probability density
function values.
Keyword Parameters
INTERPOLATE: A vector of type floating point containing the location to
calculate the values in Result. The default is halfway between the
values in Xpdf.
LSQUADRATIC: If set the interpolation is done using a least squares
quadratic fit. The default is a linear interpolation.
NORMALISE: If set the a normalised CDF (i.e. running from 0 to 1) is
returned. The default is to not normalise.
QUADRATIC: If set the interpolation is done by fitting a quadratic. The
default is a linear interpolation.
SPLINE: If set theinterpolation is done by fitting a cubic spline. The
default is a linear interpolation.
Output
Result: A vector of type floating point containing the cumulative
distribution function values calculated from Pdf at the positions in
XCDF.
XCDF: A vector of type floating point containing the location of the
values in Result.
Uses
-
Procedure
This function calculates the CDF values by summing over the preceding PDF
values. Example
Define the PDF values and where they are.
pdf = [ 0.1, 0.25, 0.3, 0.25, 0.1 ]
xpdf = [ 0., 1., 2., 4., 5. ]
Calculate the CDF.
result = pdf_to_cdf( xpdf, pdf, xcdf=xcdf )
result should be [ 0.1, 0.35, 0.65, 0.9, 1.0 ].
xcdf should be [ 0.5, 1.5, 3., 4.5, 5.5 ].
Modification History
Written by: Daithi Stone, 2003-07-21
Modified: DAS, 2003-09-25 (added Xpdf input, INTERPOLATE, LSQUADRATIC,
QUADRATIC, SPLINE keywords, XCDF output)
Modified: DAS, 2011-04-13 (added NORMALISE keyword; modified
documentation format)