Random Variables in Mathematical or Applied Statisics
Random Variables in Mathematical or Applied Statisics
Random Variable
A random variable is essentially a random number. Random variables are upper case letters
and they can take on various values depending on the random outcome of an experiment. If
the random variable is given by a capital letter, the corresponding small letter denotes the
various values that the random variable can take on. Because the random variable depend on
the random outcomes of the experiment given in , the random variable is a function of .
Discreet random variable: A random variable X is discreet if it can take on a finite (or infinite
and countable) number of values, usually integers.
Events are often expressed as random variables in statistic, and we have to calculate
probabilities for these events (probability of the random variable).
Probability mass function: Suppose a random variable X can take on the values
(these values are known as mass points). The probability mass function (or frequency
function) of X is defined as the function such that: or
.
Properties of p: i)
ii) ∑
The probability mass function (frequency function) can be represented by a bar chart. The
height of each bar equals the probability of the corresponding value of the random variable.
Example 1
Sample space:
1
The values (mass points) that the random variable can take on is .
The values (mass points) that the random variable can take on is .
iii) Let the random variable Z denote the number of heads minus the number of tails.
The values (mass points) that the random variable can take on is .
2
Example 2
Two socks are selected at random from a drawer containing five brown socks and three
green socks. Let X be the random variable where X is the number of brown socks selected.
The values (mass points) that the random variable can take on is .
Example 3
and ∑
Thus, the given function can serve as the frequency function of the random variable with
values {1,2,3,4,5}.
There are many problems in which it is of interest to know the probability that the value of a
random variable is less than or equal to some real numbers.
3
Example 4 (continuation of Example 1)
Find
ii) and as
( )
Find the cdf of the total number of heads obtained in three tosses of a balanced coin.
Observe that this distribution is defined not only for the values taken on by the given
random variables, but for all real numbers. For example and .
Although the probabilities of getting “at most 1.7 heads” or “at most 100 heads” in three
tosses, may not be of real significance.
4
Example 6 (continuation of Example 2)
Find the cdf of the random variable X in the example about the socks.
The distribution function can also be used to obtain the mass function (frequency function).
The mass points are those points where the distribution “jumps” and the values of the mass
function at the respective mass points are equal the size of these “jumps”.
5
Example 8
Example 9
A Bernoulli random variable X only takes on values of 0 or 1 with the following probabilities:
6
2.1.2 Binomial Random Variable
Bernoulli trail: An experiment where only one of two outcomes are possible, a “success” and
a “failure”.
Assume now n repeated independent Bernoulli trails. Let denotes the number of
successes obtained from these n Bernoulli trails. is then said to be a binomial random
variable.
ii) Each trail results in one of two possible outcomes: success and failure.
iii) The probability of a success for a single trail is and the probability of a failure is
Example 10
Binomial probability mass function: Let denote the probability of success in a Bernoulli
trial. If is a binomial random variable, then the mass function of is given by:
( )
{
Proof: Consider one possible realization of success (and thus failures). The
probability of this realization is (from independence of Bernoulli trials and the multiplicative
rule):
The number of these realizations is ( ) seeing as there are ( ) ways of choosing success
from repeated trials. Therefore
( )
7
Properties of the binomial probability mass function:
i)
ii) ∑
Example 11
( ) ( )( ) ( )
ii) Find the probability of getting less than 2 heads in 12 flips of a coin.
( )( ) ( ) ( )( ) ( )
Or
[ ]
Example 12
i) Find the probability that 7 of 10 persons will recover from a tropical disease if we can
assume independence and the probability is 0.8 that any one of them will recover
from the disease.
( )
ii) Find the probability that at least 8 of 10 persons will recover from a tropical disease.
( ) ( )
( )
8
Note: Let be independent Bernoulli random variables with .
Then is a binomial random variable.
Assume repeated independent Bernoulli trials, where is the probability of success at each
trail. Let denote the number of repetitions until the first success is obtained. is called a
geometric random variable.
Therefore:
i)
ii) ∑
Example 13
If the probability is 0.75 that a applicant for a driver’s license will pass the road test on any
given try, what is the probability that an applicant will finaly pass the test of the 4th try?
Example 14
If the probability that a person exhibits side-effects as a result of a certain new drug is 0.02.
What is the probability that the fith person in a study of people that take the drug is the first
person to exhibit the effect?
Let be the number of people who take the medication until the first person exhibits side-
effects. Then is a geometric random variable with , and
9
Negative Binomial random variable
( )
1 2 3 4 - -- - - - - - k-1 k
The last trail is a success, and the remaining successes can be obtained from
repetitions in ( ) ways.
Example 15
The probability is 0.4 that a child exposed to a certain disease will catch it. What is the
probability that the tenth child exposed to the disease will be the third to catch it?
( ) ( )
Example 16
If a coin is tossed, what is the probability that with the 4 th toss we have observed 2 heads?
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )
10
Suppose a container holds balls, where of them are black and are white. Draw
balls simultaneously (without replacement). Let be the number of black balls drawn in this
way. We say that is a hypergeometric random variable with parameters and
( )( )
( )
.
Similar to the Binomial distribution but it only applies to sampling without replacement.
Consider a set of elements of which are successes and are failures.
Find the probability to obtain successes in trails: There are ( ) ways to choose of the
successes and there are ( ) ways to choose of the failures.
Therefore, there are ( ) ( ) ways to choose successes and failures, but there
are ( ) ways to choose of the elements in the set.
( )( )
Therefore, ( )
.
Example 17
Suppose that an urn contains 10 balls of which 6 are black and 4 are white. Let denote the
number of black balls drawn when taking 3 balls without replacement. Find .
( )( ) ( )( )
( ) ( )
Example 18
As part of an air-pollution survey, an inspector decides to examine the exhaust of six of the
company’s 24 trucks. If 4 of the company’s trucks emit excessive amounts of pollutants
what is the probability that none of them will be included in the inspector’s sample?
( )( )
( )
11
2.1.5 Poisson random variable
-
Poisson probability mass function: { with
parameter .
i)
ii) ∑
Proof:
∑ ∑ { }
Example 19
The average number of traffic accidents on the N12 between Potchefstroom and
Johannesburg is 2 per week. Assume that the number of accidents in a week follow a
Poisson distribution with .
The average number of accident per week is . Let X be the number of accidents
in a 1 week period.
ii) Calculate the probability that at most three accidents occur during a two week
period.
12
Example 20
A hospital switchboard receives emergency calls at a rate of 2 every 30 minutes. What is the
probability that there are at least 1 emergency call between 02:00 and 04:00 on a specific
day?
The average number of emergency calls in a 30 minute period is . During a two hour
period the average number of calls is equal to 8.
The Poisson distribution can be derived as the limit of a binomial distribution as the number
of trails, , approaches infinity and the probability of success on each trail, , approaches
zero in such a way that . The binomial frequency function is
( ) ( ) ( ) ( )
As
, therefore ( ) .
( )
( )( )( ) ( )
( )
( )
Proof: Let ( ) then ( )
( )
L'Hospital
13
Therefore and
Therefore
( ) ( ) ( ) ( ) which is the
Poisson frequency function.
Note: Suppose is binomial with parameters and , then it follows from above that as
becomes large and small (with ):
∑ ( ) ∑ ∑
Example 21
Suppose that 3% of the screws manufactured by a machine are defective. The screws are
packed into boxes which can hold 50 screws each. Use the Poisson approximation to
calculate the probability that a certain box will contain less than 4 defective screws.
Let X be the number of screws that are defective, then X is a binomial random variable with
and . We want to calculate :
[ ]
14
2.2 Continuous random variables
Continuous random variables take on values on a continuous scale, such as heights, weights
and length of life of a particular product.
These variables can take on infinitely many values corresponding to points on a line interval.
If you try to assign a positive probability to each of these uncountable values, the
probabilities will no longer sum to 1, as with discreet random variables. A different
approach should therefore be used to generate the probability distribution for a continuous
random variable.
For a continuous random variable the role of the frequency function is taken by the density
function (pdf) .
i)
ii) ∫
iii) ∫
The density function of a continuous random variable is given by a smooth curve as follows:
0.04 0.04
0.035 0.035
0.03 0.03
0.025 0.025
0.02
𝑓 𝑥 0.02
0.015 0.015
0.01 0.01
0.005 0.005
0 0
-20 -10 0 10 20 30 40 50 60 -20 -10 0 10 20 30 40 50 60
a b
Consider the probability that x equals some particular value, say . Since there are no area
above a single point ( ) in the probability distribution for a continuous random variable,
our definition implies that the probability is 0.
Therefore
15
Cumulative distribution function: The cdf of a continuous random variable is defined just as
it was in the discrete case:
There exists a one-to-one relationship between distribution functions and density funtions:
i) ∫ (by definition)
ii)
∫ ∫ ∫
Example 22
Find and ( ).
i) ∫
[ ] ( )
Therefore .
ii) ( ) ∫ [ ] ( )
Example 23
Find the cdf of the random variable X in the previous example, and use it to re-evaluate
( ).
i) ∫ ∫ [ ]
ii) ( ) ( ) ( )
16
Example 24
a) Find
∫ [ ] [ ]
∫ [ ]
Example 25
i) ∫ [ ]
ii) ∫ ( )[ ]
Example 26
a) Find
∫ [ ] [ ( )]
[ ]
b) Find
∫ [ ]
[ ( )] [ ]
17
∫ [ ] [ ] [ ]
[ ]
[ ]
Uniform distribution
A uniform random variable on the interval [0, 1] is a model for what we mean when we say
“choose a number at random between 0 and 1”. Any real number in the interval is a
possible outcome.
f(x)
0 1
Example 27
( ) ∫ ∫ [ ]
( ) ∫ ∫ [ ]
18
1/(b-a)
a b
∫ ∫ [ ] for
F(x)
1
0 1
∫ ∫ [ ] for
a b
Example 28
At a particular hospital a study is done over a long period of time (covering many patients)
and it is found that the distribution of “time of death” is uniform over the course of a day
for a random unknown patient.
i) What is the probability that a random patient dies before 8am on the day of their
death?
[ ]
ii) What is the probability that a random patient dies during visiting hours, if visiting
hours are 10am to noon?
19
iii) What is the probability that a random patient dies during visiting hours, if visiting
hours are 10am to noon and 6pm to 9pm?
iv) What is the probability that a random patient dies at exactly midnight?
pth Quantiles: The pth quantile of a df is defined as the number such that
( ) therefore
Exponential distribution
The Exponential distribution is used to model continuous random variables such as waiting
times (for example at a supermarket till) and lifetimes associated with electronic
components.
20
2.5
1.5
𝑓 𝑥
0.5
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
x
i)
ii) ∫ [ ]
∫ [ ]
Therefore {
0.9
0.8
0.7
0.6
𝜆𝑥
𝐹 𝑥 𝑒
F(x)
0.5
0.4
0.3
0.2
0.1
0
0 5 10 15 20 25 30
x
Then by definition
21
Thus
( )
( )
Suppose that the lifetime ( ) of, say, an electronic component is to be modelled. Suppose
also that the component has already lasted for a certain period of time , and that now we
want to determine the probability that the component will last for at least another time
units, that is, we want to calculate .
s s+t
∫ [ ]
∫ [ ]
Also
∫ [ ]
Therefore, .
Example 29
Suppose that the amount of time taken for a light bulb to burn out is exponentially
distributed with a mean of 10 hours, . A person enters a room where a light bulb has
already been burning for three hours. The person would like to work for five hours in the
room. What is the probability that the person will get their work done before the light bulb
expires?
∫ [ ]
22
Example 30
A petrol station in a remote town gets very few customers. The time between two
successive customers arriving is exponentially distributed, with an average of 2 hours
between customers. Suppose a customer has just left the petrol station. The average of an
exponential distribution is therefore is this example.
ii) What is the probability that no customers arrive for at least 3 hours?
( )
iii) What is the probability that the next customer arrives in 1 to 2 hours’ time?
∫ [ ] or
iv) What is the probability that the next customer arrives within 10 minutes?
( )
( ) ( ) or ( ) ∫
v) If no customers arrived at the petrol station for 4 hours, what is the probability that
no customers arrive in the next 5 hours either?
Gamma distribution
ii) ( ) √
23
Density function of the Gamma random variable: A Gamma random variable has the
following density function:
i)
Normal distribution
Density function of the Normal random variable: A continuous random variable X is normally
distributed with parameters and if it has the following density function:
is called the mean and it is a measure of location, is called the standard deviation and it
is a measure of spread.
The cdf cannot be evaluated in close form (the integral over the pdf cannot be evaluated
explicitly).
The normal density is symmetric about and it has a bell-shape (see Figure 2.13, Rice, p.
55).
Beta distribution
Density function of the Beta random variable: A continuous random variable X is beta
distributed with parameters and if it has the following density function:
24
The beta density is useful for modelling random variables that are restricted to the interval
[0,1].
To illustrate techniques for solving such a problem, we first develop some useful facts about
the normal distribution.
Proof: ( ) ( )
( )
( )
√ √
Therefore
Result:
Then .
But and ( )
Thus and .
√
( ) ( )
( ) ( ) ( ) ( )
25
Where is the distribution function of a random variable.
We read the probabilities of the standard normal distribution from the standard normal
table.
[ ]
Proposition B, Rice p. 62: Let X be a continuous random variable with density function
and let where is a differentiable, monotonic function. Then the density function
of Y is given by:
( ) | |
( ) ( ) ( ) ( )
( )( )
26
( ) | | ( )
Example 31
( ) ( )
( )
( )
( ) | |
( )
Example 32
( ) | |
27