Difference between revisions of "Documentation/How Tos/Calc: PROB function"
From Apache OpenOffice Wiki
< Documentation | How Tos
(Initial content) |
m (→Example:) |
||
Line 23: | Line 23: | ||
<tt>'''PROB({3; 4; 5; 6}; {0.2; 0.4; 0.3; 0.1}; 4)'''</tt> | <tt>'''PROB({3; 4; 5; 6}; {0.2; 0.4; 0.3; 0.1}; 4)'''</tt> | ||
− | : returns <tt>'''0.4'''</tt>, the probability for <tt>'''4'''</tt> | + | : returns <tt>'''0.4'''</tt>, the probability for <tt>'''4'''</tt>. |
=== See also: === | === See also: === | ||
[[Documentation/How_Tos/Calc: Statistical functions|'''Statistical functions''']] | [[Documentation/How_Tos/Calc: Statistical functions|'''Statistical functions''']] |
Revision as of 04:34, 1 May 2008
PROB
Returns a result from a list of probabilities.
Syntax:
PROB(values; probabilities; start; end)
- values is a range or array of numbers (possibly unordered).
- probabilities is a range or array of numbers of the same size as values, indicating the corresponding probability (>0 and <=1) of each value in values occurring. The numbers in probabilities must sum to 1 exactly.
- PROB finds all values which are between start and end inclusive and returns the sum of their corresponding probabilities.
- end may be omitted, in which case PROB returns the probability corresponding to start (or 0 if start is not present in values).
Example:
PROB({3; 4; 5; 6}; {0.2; 0.4; 0.3; 0.1}; 4; 6)
- returns 0.8, the sum of the probabilities for 4, 5 and 6.
PROB({2.2; 5; 1}; {0.5; 0.3; 0.2}; 0; 3)
- returns 0.7, the sum of the probabilities for 1 and 2.2.
PROB({3; 4; 5; 6}; {0.2; 0.4; 0.3; 0.1}; 4)
- returns 0.4, the probability for 4.