Although the probability operator takes various types of arguments and operands, it always produces a value between 0 and 1. It can be shortened to prob to reduce keystrokes. There are three basic forms of the operator:
Each of the basic forms of the probability operator are described in detail below:
We would like to examine probabilties relating to two categorical variables: Sex and Political Party. There are two sexes: M=Male and F=Female; and three parties: D=Democrat, I=Independent and R=Republican. We first create a contingency table with row and column headings and populated with frequencies:
Table←↑'*DIR'('F' 3 2 4)('M' 8 9 12)
* D I R
F 3 2 4
M 8 9 12
We can now apply the basic rules of probability from the following table:
Rules of Probability (Summary) |
|||||
Term |
Symbol |
Condition |
Special Formula |
General Formula |
Primary Operation |
Complement (not A) |
A' |
None |
P(A') = 1 - P(A) |
- |
|
Union (A or B) |
A∪B |
Mutually Exclusive |
P(A∪B) = P(A) + P(B) |
P(A∪B) = P(A) + P(B) - P(A∩B) |
+ |
Intersection (A and B) |
A∩B |
Independent |
P(A∩B) = P(A)P(B) |
P(A∩B) = P(A)P(B|A) P(A∩B) = P(A) + P(B) - P(A∪B) |
× |
Conditional (A if B) |
A|B |
Independent |
P(A|B) = P(A) |
P(A|B) = P(A∩B)/P(B) |
|
Mutually Exclusive |
P(A|B) = 0 |
The syntax of the probability operator is:
[Event1] relationalFunction prob Table , Event2
Note that the comma is necessary to separate the array right operand Table from the right argument Event2.
What is the probability that a randomly selected student is not a Republican?
~ prob Table, 'R'
0.57895
What is the probability that a student is both Republican and male?
'R'
∧ prob Table, 'M'
0.31579
What is the probability that a student is either Republican or male?
'R'
∨ prob Table, 'M'
0.86842
What is the probability that a male student is a Republican?
'R'
| prob Table, 'M'
0.41379
When two events are independent, only the probabilities of the two individual events are needed, not the entire contingency table. In that case, the syntax is:
P(Event1) relationalFunction prob independent P(Event2)
What is the probability of selecting a spade from a deck of 52 cards?
Spade←13÷52
0.25
What is the probability of selecting an ace?
Ace←4÷52
0.076923
What is the probability of selecting the ace of spades?
Ace ∧ prob independent Spade
0.01923
What is the probability of selecting an ace or spade?
Ace ∨ prob independent Spade
0.30769
The left operand to the distribution form of the probability operator is a discrete or continuous distribution function with its parameter list as the left argument. The right operand is a relational function; the right argument is the value of interest. The syntax for the distribution form of the probability operator is:
[Parameters] distributionFunction prob relationalFunction Value
The parameters are optional for the normal and rectangular distributions, defaulting to 0 1. Some examples follow:
What is the probability of getting exactly two heads when three coins are tossed?
3 0.5 binomial prob = 2
0.375
What is the probability of getting at least two heads when three coins are tossed?
3 0.5 binomial prob ≥ 2
0.5
What is the probability that a standard normal random variable is less than 1.25?
normal prob < 1.25
0.89435
What is the probability that a person is between 70 and 74 inches tall, given that the mean height is 68 inches and the standard deviation is 3 inches?
68 3 normal prob between 70 74
0.22974