Difference between revisions of "Custom continuous distributions"
Line 8: | Line 8: | ||
==Cumdist(p, r, i)== | ==Cumdist(p, r, i)== | ||
− | Specifies a continuous probability distribution as an array of cumulative probabilities, | + | Specifies a continuous probability distribution as an array of cumulative probabilities, «p», for an array of corresponding outcome values, «r». The values of «p» must be non decreasing and should start with 0 and end with 1. The values of «r» must also be be non decreasing over their common index. If «p» is an index of «r», or «r» is an index of «p», or if both have the same single index, the correspondence is clear and so you can omit «i». Otherwise, if «p» or «r» have more than one index, you must specify the common index «i» to link «p» and «r». |
− | By default, it fits the cumulative distribution using piecewise cubic monotonic interpolation between the specified points, so that the PDF is also continuous. If you set the optional parameter '''Smooth''' to False, it uses piecewise linear interpolation for the CDF, so that the PDF is piecewise uniform. | + | By default, it fits the cumulative distribution using piecewise cubic monotonic interpolation between the specified points, so that the PDF is also continuous. If you set the optional parameter '''Smooth''' to False, it uses piecewise linear interpolation for the CDF, so that the PDF is piecewise uniform. See also [[Cumdist]](). |
'''Library:''' Distribution | '''Library:''' Distribution | ||
Line 16: | Line 16: | ||
'''Example:''' | '''Example:''' | ||
− | <code>Variable Array_b :=</code> | + | :<code>Variable Array_b :=</code> |
− | + | :{| class="wikitable" | |
− | {| class="wikitable" | ||
! colspan="3" | Index_a ▶ | ! colspan="3" | Index_a ▶ | ||
|- | |- | ||
Line 30: | Line 29: | ||
|} | |} | ||
− | <code>Variable Array_x :=</code> | + | :<code>Variable Array_x :=</code> |
− | + | :{| class="wikitable" border="1" | |
− | {| class="wikitable" border="1" | ||
! colspan="3"| Index_a ▶ | ! colspan="3"| Index_a ▶ | ||
|- | |- | ||
Line 44: | Line 42: | ||
|} | |} | ||
− | <code>CumDist(Array_b, Array_x) →</code> | + | :<code>CumDist(Array_b, Array_x) →</code> |
[[File:Chapter15_25.png]] | [[File:Chapter15_25.png]] | ||
==Probdist(p, r, i)== | ==Probdist(p, r, i)== | ||
− | Specifies a continuous probability distribution as an array of probability densities, | + | Specifies a continuous probability distribution as an array of probability densities, «p», for an array of corresponding values, «r». The values of «r» must be increasing. The probability densities «p» must be non-negative. It normalizes the densities so that the total probability integrates to 1. |
− | Usually the first and last values of | + | Usually the first and last values of «p» should be 0. If not, it assumes zero at ''2r<sub>1</sub> - R<sub>r</sub> (or 2r<sub>n</sub> - r<sub>n-1</sub>). |
− | Either | + | Either «r» must be an index of «p», or «p» and «r» must have an index in common. If «p» or «r» have more than one index, you must specify the index «i» to link «p» and «r». |
− | It produces the density function using linear interpolation between the points on the density function (quadratic on CDF). | + | It produces the density function using linear interpolation between the points on the density function (quadratic on CDF). See also [[Probdist]](). |
'''Library:''' Distribution | '''Library:''' Distribution | ||
Line 61: | Line 59: | ||
'''Example:''' | '''Example:''' | ||
− | <code>Variable Array_r :=</code> | + | :<code>Variable Array_r :=</code> |
− | + | :{| class="wikitable" | |
− | {| class="wikitable" | ||
! colspan="6" | Index_a ▶ | ! colspan="6" | Index_a ▶ | ||
|- | |- | ||
Line 81: | Line 78: | ||
|} | |} | ||
− | <code>Variable Array_p :=</code> | + | :<code>Variable Array_p :=</code> |
− | {| class="wikitable" | + | :{| class="wikitable" |
! colspan="6" | Index_a ▶ | ! colspan="6" | Index_a ▶ | ||
|- | |- | ||
Line 100: | Line 97: | ||
|} | |} | ||
− | <code>Probdist(Array_p, Array_r) → </code> | + | :<code>Probdist(Array_p, Array_r) → </code> |
[[File:Chapter15_26.png]] | [[File:Chapter15_26.png]] |
Revision as of 03:54, 31 December 2015
These functions let you specify a continuous probability distribution by specifying any number of points on its cumulative or density function.
Cumdist(p, r, i)
Specifies a continuous probability distribution as an array of cumulative probabilities, «p», for an array of corresponding outcome values, «r». The values of «p» must be non decreasing and should start with 0 and end with 1. The values of «r» must also be be non decreasing over their common index. If «p» is an index of «r», or «r» is an index of «p», or if both have the same single index, the correspondence is clear and so you can omit «i». Otherwise, if «p» or «r» have more than one index, you must specify the common index «i» to link «p» and «r».
By default, it fits the cumulative distribution using piecewise cubic monotonic interpolation between the specified points, so that the PDF is also continuous. If you set the optional parameter Smooth to False, it uses piecewise linear interpolation for the CDF, so that the PDF is piecewise uniform. See also Cumdist().
Library: Distribution
Example:
Variable Array_b :=
Index_a ▶ 1 2 3 0 0.6 1.0
Variable Array_x :=
Index_a ▶ 1 2 3 10 20 30
CumDist(Array_b, Array_x) →
Probdist(p, r, i)
Specifies a continuous probability distribution as an array of probability densities, «p», for an array of corresponding values, «r». The values of «r» must be increasing. The probability densities «p» must be non-negative. It normalizes the densities so that the total probability integrates to 1.
Usually the first and last values of «p» should be 0. If not, it assumes zero at 2r1 - Rr (or 2rn - rn-1).
Either «r» must be an index of «p», or «p» and «r» must have an index in common. If «p» or «r» have more than one index, you must specify the index «i» to link «p» and «r».
It produces the density function using linear interpolation between the points on the density function (quadratic on CDF). See also Probdist().
Library: Distribution
Example:
Variable Array_r :=
Index_a ▶ 1 2 3 4 5 6 0 0.4 0.2 0.5 0.2 0
Variable Array_p :=
Index_a ▶ 1 2 3 4 5 6 10 15 20 25 30 35
Probdist(Array_p, Array_r) →
See Also
Enable comment auto-refresher