Documentation/Calc Functions/PROB

    From The Document Foundation Wiki

    Function name:

    PROB

    Category:

    Statistical Analysis

    Summary:

    Calculates the probability that a sample of a discrete random variable lies within a specified range, based on a supplied probability mass function.

    Syntax:

    PROB(Data; Probability; Start[; End])

    Returns:

    Returns a real number in the range [0, 1], which is the probability that a sample value will lie within the specified range.

    Arguments:

    Data is an array of real numbers containing all the possible values of the discrete random variable. This argument can take the form of an explicit cell range, the name of a named range, the name of a database range, or an inline constant array. The numbers in Data need not be in any specific order and individual values can appear more than once.

    Probability is an array of real numbers containing the probability associated with the value of the discrete random variable at the corresponding position within Data. Each entry should be in the range [0, 1] and should be expressed as a percentage or a decimal fraction. The dimensions of Probability must be identical to those of Data and the sum of all numbers in Probability must be less than or equal to 1.0.

    Start is a real number, or a reference to a cell containing that number, which is the lower limit of the interval whose probabilities are to be summed.

    End is a real number, or a reference to a cell containing that number, which is the upper limit of the interval whose probabilities are to be summed. If End is omitted, PROB sets it equal to Start.

    The following conditions and errors may arise:

    • If Data and Probability do not have the same dimensions, then PROB reports a value not available error (#N/A).
    • If any cell in either Data or Probability is empty, or contains non-numeric data, then PROB reports an invalid argument error (Err:502).
    • The values in Data need not be sorted. However, their associated probabilities must lie in the corresponding locations within Probability.
    • Multiple occurrences of the same value may appear in Data. When this occurs, the corresponding entries in Probability are added together to give the overall probability for that value.
    • If any value in Probability is less than 0 or greater than 1, then PROB reports a #VALUE! error.
    • If the sum of all values in Probability is not equal to 1, then PROB reports a #VALUE! error.
    • If either Start or End is non-numeric, then PROB reports a #VALUE! error.
    • While it is anticipated that normally End will be greater than or equal to Start, PROB reacts to the opposite being true by interchanging the two values.

    Additional details:

    • PROB finds all entries in Data that are between Start and End (inclusive) and returns the sum of their corresponding entries in Probability.

    Examples:

    Worked example

    The following table shows sample data that is used in the examples that follow.

      A B
    1 Data Probability
    2 195 0.02
    3 151 0.03
    4 148 0.15
    5 189 0.05
    6 183 0.15
    7 154 0.55
    8 148 0.05
    Formula Description Returns
    =PROB(A2:A8; B2:B8; 160; 190) Here the function returns the total probability for all outcomes in the range [160, 190]. Note that if the order of the Start and End arguments were reversed, as in the formula =PROB(A2:A8; B2:B8; 190; 160), PROB returns the same result. 0.2
    =PROB(A2:A8; B2:B8; 160; 170) Here the function finds no values in the Data argument that lie within the range [160, 170]. 0
    =PROB(A2:A8; B2:B8; 148) Here the function returns the probability associated with the value 148. Note that 148 appears twice in the Data argument and PROB sums the two probabilities in cells B4 and B8. 0.2
    =PROB(A2:A8; B2:B8; 180) Here the function finds no entry for 180 in the Data argument. 0
    =PROB(A2:A8; B2:B8; 140; 200) Here the function sums the probabilities for all possible outcomes. 1
    =PROB(A2:A8; B2:B8; 140; 185) Here the function calculates the cumulative probability for all values in the specified range (that is 148, 151, 154, and 183). 0.93

    Other examples

    Formula Description Returns
    =PROB({1; 2; 3; 4; 5; 6}; D1:D6; 1; 4) where cells D1:D6 all contain the same formula =1/6. Here the function calculates the probability that a single roll of a fair die (all outcomes equally likely) will give a 1, 2, 3, or 4. 0.666666666666667
    =PROB({1; 2; 3; 4; 5; 6}; D1:D6; 1; 4) where cells D1:D6 contain the values 0.175, 0.165, 0.16, 0.16, 0.165, and 0.175 respectively. Here the function calculates the probability that a single roll of an unfair die will give a 1, 2, 3, or 4 (based on a probability mass function indicating that all outcomes are not equally likely). 0.66.

    Related LibreOffice functions:

    None

    ODF standard:

    Section 6.18.63, part 2

    Related (or similar) Excel functions:

    PROB