Math 365, Elementary Statistics

Chapter 4 : Random Variables

Satya Mandal

4.1 Random Variablesback to top

A random variable is a complete description of a numerical characteristic of the population. Among the examples would be (1) Weight of the fish population in a lake, (2) Number of typos in the textbooks used in KU, (3) GPA of the student population, (4) Delay in departure time of all the commercial flights originating from US. The following is a formal definition.

Definition. A random variable is a rule or a formula or a mechanism that associates a numerical value to each member of the the sample space S. So, given a member w of S, a variable X assigns a numerical value X(w) to w. For us, X(w) will be a characteristic (like height, weight, time, salary) of the population.

Animation 4.1.1
A random variable X represents population data (not sample data).

Example. Suppose the KU student population is under study. Therefore, sample space S is the whole collection of KU students population. A KU student is a sample unit. Following are some of random variables:

  1. Let G = the GPA of the students . Then G is a random variable. The GPA is the "characteristic" that G describes. So, given a student, G has a value. For example:
    G(Donald Smith) = 3.25,     G(Sam Donaldson) = 3.11,
    G(Karen Currie) = 3.89,     G(King Who) = 2.13
  2. Define Y as follows :

    Y(w) = 0 If w is Male   
    Y(w) = 1 If w is Female

    Then, Y is a random variable. We have, for example,
    Y(Donald Smith) = 0,     Y(Sam Donaldson) = 0,
    Y(Karen Currie) = 1,     Y(King Who) = 0
  3. Let Z= the total expenses of the students this year. Then Z is a random variable.
  4. Let H = height of the students. The H is a random variable. Here, H describes the HEIGHT-characteristic of the sample space.
  5. Let W= the weight of the students. Then W is a random variable.
  6. Let C = the number of course credit hours completed by the student. Then C is a random variable.
  7. Let T= Tuition paid by the students this year. Then T is a random variable.
  8. Similarly, given any other characteristic like annual income, distance from KU to the students' residence, a random variable can be defined for this sample space or population.

Definition. Random variables are classified to two different types: the continuous random variables and discrete random variables.

  1. If a random variable X can assume any numerical value over an interval, then it would be called a continuous random variable. The random variables H and W are continuous random variable.
  2. A random variable X is said to be a discrete random variable, if the possible values of X the variable can be written in a (finite or infinite) list:

    x1, x2, x3, ….

    In other words, a discrete random variable assumes only finitely many or countably infinitely many distinct values. In the above example, G, Y, C, T are discrete random variables.

Examples of Continuous and Discrete Variables

  1. The examples of continuous random variables are weight, length, volume, area, and time.
  2. For this course, most of the examples of discrete random variables would be the number of something—number of typos, number of road accidents, number of phone calls.
You may not need anything more than these examples of continuous and discrete random variables.

Two Examples.

  1. Let X be the number of wrong number calls you receive in a day. Then X is a discrete random variable.

  2. Let X be the waiting time before you receive the next wrong number call. Then X is a continuous random variable.



4.2 Probability Distributionback to top

A Random variable X represents a numerical feature (say weight) of the whole sample space (or the population). As far as statistics is concerned, the distribution of X (i.e. distribution of the values of X) is unknown. Goal of this course is to model (or make realistic hypotheses) and estimate the actual distribution of X.

First, we will be concerned with the discrete random variables.

The probability distribution of a random variable X is a table or a rule or a method that answers probability-related questions regarding X.


Definition. Suppose X is a discrete random variable that assumes the values

x1,x2, x3,….

The probability distribution of X can be described by giving

p(xi) = P(X = xi)

in a table or by a formula. This function p(xi) is called the probability function of X.

When the probability distribution of X is given in a table, it would look like the following:

Value
x
Probability
p(x)
x1 p(x1)
x2 p(x2)
x3 p(x3)

Properties of Probability function. Suppose X is a discrete random variable that assumes value

x1, x2, x3,

and let p(x) be the probability function. Then we have the following:

  1. 0 ≤ p(xi) ≤ 1.

  2. p(xi) = 1.


Definitions. Let X be a discrete random variable that assumes the values

x1, x2, x3, …

and p(x) be the probability function of X.
  1. Then the mean μ of X is defined as

    μ= xip(xi).

    The mean μ is also called the expected value of X and is denoted by E(X). The mean μ is also called the population mean.

  2. The variance σ2 of X is defined as

    σ2= Variance(X)= (xi-μ)2p(xi).


    Some simplification will show

    σ2= Variance(X)= xi2p(xi) - μ2.

    The variance σ2 is also called the population variance. If we take a large sample and compute the sample variance s2 then s2 will be an estimate for σ2.

  3. The standard deviation σ of X is defined as the positive square root of the variance of X.

    standard deviation of X= σ =Variance(X)

    The standard deviation σ is also called the population standard deviation.

Remark. As was mentioned above, a random variable X represents numerical characteristics of the population. Statistics has a place in life, only because the population is unknown and it needs to be modeled and estimated. In particular,

  1. The distribution of the random variable X would be unknown.
  2. The mean μ and standard deviation σ of X represent the population mean and the population standard deviation of the corresponding characteristic. If X represents the weight of the fish population in a lake, then the mean μ of X represents the mean weight of the fish population. Similarly, the standard deviation σ of X represents the standard deviation weight of the fish population.
  3. The mean μ and standard deviation σ would be normally unknown. Goal of this course would be to estimate them.
  4. As it happens in real life, under reasonable (realistic) assumptions about the population, mean μ and standard deviation σ would determine the complete distribution of X.

Example. Suppose you design a coin toss game . In this game, you give the opponent $3 if a head comes and you collect $1 if a tail comes. Let X be the money you receive. Then X assumes the values -3 and 1. You also have a loaded coin so that

P(H) = 1/9     P(T) = 8/9.

Then the probability distribution of X is given by

Value
x
Probability
p(x)
-3 1/9
1 8/9

So, the mean μ of X is given by

μ= xip(xi)= (-3)(1/9)+1(8/9)=5/9.

The variance is given by

σ2 = xi2p(xi) - μ2 =(-3)21/9 +128/9 - (5/9)2 =1.5802

The standard deviation is given by

σ =Variance(X) = 1.5802=1.2571.

Interpretation of mean μ of X:

  1. In this example, the mean μ tells us your average win per game if you play for a long time, which is 5/9 dollars per game. Similarly, the standard deviation σ=1.2571 dollars is a measure of variability (or uncertainty) of your win per game.

  2. Similarly, if Z represents the height of the KU student population, then the mean μ = E(Z) is the actual mean height of the KU student population. If we take a large sample from the KU student population and compute the sample mean, it should approximate μ.



The Calculator TI-84 would not be of much help for this section.

Problems on 4.2: Probability Distribution

Exercise 4.2.1. The number of passengers X in a car on a freeway has the following probability distribution.

X=x 1 2 3 4 5
p(x) 0.35 0.30 0.15 0.15 0.05

Find:

  1. the expected number of passengers in a car;
  2. the Variance σ2 of the number of passengers;
  3. the probability that the number of passengers in a car is at least 3.

Solution

Exercise 4.2.2. Karin is a plumber who works for 3 different employers. Employer A pays her $120 a day, employer B pays her $70 dollars a day, and employer C pays her $180 a day. She works for whoever calls her first. The probability that employer A calls her first is 0.30; the probability that employer B calls first is .20; and the probability that employer C calls her first is 0.40 (the probability that no one calls is .10). What is the expected income and variance of Karin per day?
Solution

Exercise 4.2.3. An insurance company sells a flight insurance policy at a flat rate of $500 per flight. If a policyholder dies in flight, the insurance company pays $100,000 to the survivors. The probability that a policyholder will die in flight is .003. What is the expected gain and variance of the company per sale?
Solution


Exercise 4.2.4. The following table gives the proportion of credit hours that earned grades F, D, C, B and A in KU:

grade ABCDF
proportion .15 .35 .30 .15 .05

Let X represent the points earned for grades A,B,C,D and F. Write down the probability distribution of X and compute the mean (or the ex- pected value E(X)) and the standard deviation.

Solution:
We have X = 0, 1, 2, 3, 4 respectively, when the grades are F, D, C, B, A. Therefore, the distribution of X is given by

x 01234
p(x) .05 .15 .30 .35 .15
Now, the mean μ is given by

μ = xip(xi) = 0 *.05 + 1 * .15 + 2 *.30 + 3 * .35 + 4 * .15 = 2.4

The variance σ2 =

x2ip(xi) - μ2 =02*.05+12.15+22.30+32*.35+42*2-(2.4)2 =1.14

The square root of the variance is the standard deviation. So, the stan- dard deviation Sq-rt(1.14) = 1.0677.


For some additional problems on random variables click HERE.

4.3 The Bernoulli and Binomial Experimentsback to top

There are many random variables that we encounter fairly often. The first one that we discuss is called a Bernoulli random variable.


Definition. There are many statistical experiments that have only two outcomes. In such cases, the outcomes may be called a success or a failure. So the sample space is

S={s,f}.

Here s means success and f means failure.

Such an experiment is called a Bernoulli trial. Given a Bernoulli trial, we can define a random variable as

X = 1 if success
X = 0 if failure


If the probability P(success) = p then we have P(failure) = 1-p. So, the probability distribution of a Bernoulli random variable is given by

Value
x
Probability
p(x)
0 1-p
1 p

The mean of X is

μ = 0(1-p)+1p = p.

The variance of X is

σ2 = xi2p(xi) - μ2 = (0.(1-p)+1p) -p2 = p-p2 = p(1-p).

Note that the variance σ2 =(probability of success)*(probability of failure).

The standard deviation of X is

σ =p(1-p)


Examples of Bernoulli random experiment (or trial) would be

  1. Testing an item (a lamp) in a factory for defectiveness. Here, if the item were defective, the outcome of the experiment would be called a "success".
  2. A medical test, like a test for pregnancy. If the woman were pregnant, the outcome of the experiment would be called a success.
  3. Tossing a coin. Head is a "success".


Binomial Random Variable


Definition. An interesting statistical experiment is a combination of n "identical and independent" Bernoulli trials. Such an experiment is called a binomial experiment. More formally, given a positive integer n and a number p with 0 ≤ p ≤ 1 a binomial(n,p) experiment (or B(n,p) experiment) is characterized as follows:

  1. A binomial experiment consists of n identical and independent Bernoulli trials.
  2. The probability of success in each trial remains fixed and is equal to p.


Definition. Given a B(n,p)-experiment, let

X = total number of successes in these n trials.

Then X is called a binomial (n,p)-random (or B(n,p)-random) variable. Following are some important facts about a B(n,p)-random variable X. ( We will not try to prove them in this course.)

  1. X can assume values 0,1,…,n. The probability distribution is given by

    p(r) = P(X = r) = P(r success) = nCr pr(1-p)n-r


    where r runs through 0,1,2,…,n.


  2. The mean of X is

    μ = E(X) = np.


    Note, the

    mean =μ = (number of trial)*(probability of success in each trial).

  3. The variance of X is

    σ2 = Variance(X) = np(1-p).


  4. Note, the

    variance =σ2 = (number of trial)*(probability of success in each trial)*(probability of failure in each trial).

  5. The standard deviation of X is

    σ =np(1-p)


Following shows the graph of the probability function of a binomial random variable. It also computes probabilities.


Animation 4.3.1
  1. Try to drag one of the pink line on one of the two bars.
  2. By draging these pink bars you can input the n and p.
  3. To find probability, input lower and upper limit on the right side and click or drag on the bar.
    (Use only TI-84 for homework.)
  4. Note, how the graphs maintain a Bell Shape.

Use of Calculators (TI-84):
Computing Binomial Probability:
  1. Suppose X is B(12, .6) random variable.
    To compute P(X=4), do the following. a) Press 2nd and then Distr (VARS) b) Scroll down to binomialpdf and ENTER d) type in "12, .6, 4)" and ENTER.
    TI will give the answer.
  2. To compute P(2 ≤ X ≤ 7), find P(X=2), P(X=3), P(X=4), P(X=5), P(X=6), P(X=7) as above and then add.
  3. Use at least four decimal points.


In "binomilapdf", cdf stands for probability density function. (It was not proper for them to use the word "density".)
binomilacdf function in TI-84:

Again, suppose X is aB(12, .6) random variable. To compute P(X is at mosr 8) = P(0 ≤ X ≤ 8) do the following. a) Press 2nd and then Distr (VARS) b) Scroll down to binomialcdf and ENTER d) type in "12, .6, 8)" and ENTER. TI will give the answer.

In "binomilacdf", cdf stands for cummulative density function. (It was not proper for them to use the word "density".)


Problems on 4.3: Binomial Experiments

Exercise 4.3.1. Let X be a B(6,.3)-random variable. Find P(X = 2). Also find the probability that X is at least 2.
Solution

Solution by TI-84:
Here n=5, p=.3. We use TI-84 :
P(X=2)= binomialpdf(6,.3,2)=.324135

Exercise 4.3.2. According to a report entitled "Pediatric Nutrition Surveillance" published by Centers for Disease Control (CDC), 18 percent of children younger than 2 years had anemia in 1997. On a particular day, a pediatrician examined 11 children.

  1. What is the probability that none will have anemia?
  2. What is the probability that exactly 5 will have anemia?
  3. What is the probability that all will have anemia?
  4. Compute the expectation and variance of the number of children with anemia.
  5. What is the probability that at least 7 will have anemia?

Solution

Solution by TI-84:
Here n=11, p=.18. X= Number of children with anemia. X is B(11, .18) random variable. We use TI-84 :

  1. probability that none will have anemia=
    P(X=0)= binomialpdf(11,.18,0)=.1127
  2. probability that exactly 5 will have anemia=
    P(X=5)= binomialpdf(11,.18, 5)=.0265
  3. probability that all will have anemia=
    P(X=11)= binomialpdf(11,.18, 11)=0 (approximately)
  4. Expected number of children with anemia= E(X)=μ=np=11*.18=1.98.
    Variance(X)= σ2=np(1-p)=11*.18*(1-.18)=1.6236;
  5. probability that at least 7 will have anemia = P(X=7 or more)
    =P(X=7) +P(X=8) +P(X=9) +P(X=10) +P(X=11)
    =binomialpdf(11,.18, 7)+binomialpdf(11,.18, 8)+ binomialpdf(11,.18, 9)+binomialpdf(11,.18, 10)+binomialpdf(11,.18, 11)
    =.0010213525

    Alternately,
    probability that at least 7 will have anemia
    = P(X=7 or more) =1 - P(0 ≤ X ≤ 6)
    = 1-binomialcdf(11,.18, 6)= 1-.9989786475 =.0010213525

Exercise 4.3.3. A gardener planted 15 seeds. The probability that a seed will germinate is 0.1.

  1. What is the probability that exactly 3 seeds will germinate?
  2. What is the probability that exactly 4 seeds will germinate?
  3. What is the probability that exactly 9 seeds will germinate?
  4. Compute the expected number of seeds that will germinate.
  5. Compute the standard deviation of the number of seeds that will germinate.
  6. What is the probability that at most 4 seeds will germinate?

Solution

Solution by TI-84:
Here n=15, p=.1. X= Number of seed that will germinate. X is B(15, .1) random variable. We use TI-84 :

  1. probability that exactly 3 seeds will germinate=
    P(X=3)= binomialpdf(15,.1, 3)=.1285
  2. exactly 4 seeds will germinate=
    P(X=4)= binomialpdf(15,.1, 4)=.0428
  3. exactly 9 seeds will germinate=
    P(X=9)= binomialpdf(15,.1, 9)=2.6599*10-6).
  4. Expected number of seeds that will germinate= E(X)=μ=np=15*.1=1.5
    Standard deviation of X=σ= np(1-p) = 15*.1*(1-.1) =1.6119
  5. probability that at most 4 seeds will germinate = P(X=4 or less)
    =P(X=0) +P(X=1) +P(X=2) +P(X=3) +P(X=4)
    =binomialpdf(15, .1, 0)+binomialpdf(15, .1, 1)+ binomialpdf(15, .1, 2)+binomialpdf(15, .1, 3)+binomialpdf(15, .1, 4) =.9873

    Alternately,
    probability that at most 4 seeds will germinate = P(X=4 or less)
    = P(0 ≤ X ≤ 4)
    = 1-binomialcdf(15,.1, 4)= .9873.

Exercise 4.3.4. In a particular county, 60 percent of the population is Hispanic.

  1. What is the probability that a jury of 12 will have exactly 6 Hispanic members?
  2. What is the probability that a jury of 12 will have more than 6 Hispanic members?

Solution

Solution by TI-84:
Here n=12, p=.6. X= Number of Hispanic juries. X is B(15, .6) random variable. We use TI-84 :

  1. probability that will be exactly 6 Hispanic members =
    P(X=6)= binomialpdf(12, .6, 6)=.1766
  2. probability that a jury of 12 will have more than 6 Hispanic members
    =P(7 ≤ X ≤ 12) =1-P(0 ≤ X ≤ 6)
    =1-P(0 ≤ X ≤ 6)= 1-binomialcdf(12, .6, 6)
    =1-.3347914423 =.6652085577

Exercise 4.3.5. From the hiring statistics of a corporation (say IBM), it is known that for every 4 interviews they give, they make 1 job offer. Suppose that the corporation interviews 8 candidates each time it comes to campus. What is the mean and standard deviation of the number of job offers made each time?
Solution

Solution by TI-84:
Here n=8, p=.25. X= Number of job that will be offered each time. X is B(8. .25) random variable. We use TI-84 :

  1. Expected number of jobs offered = E(X)=μ=np=8*.25=2
  2. Standard deviation of X=σ= np(1-p) = 8*.25*(1-.25)=1.2247


Remark. In the some of the problems above, sometimes we had to add only less than 10 terms with the binomialpdf function. In a real life situation, one may have to add a large number of such terms. In those cases, it is better to use binomialcdf function. Following are some such problems.


Exercise 4.3.5. It is believed proportion of voters (in a county) who vote by absentee ballot is p=.18. You sample 725 voters.

  1. Compute the mean μ and standard deviation σ of the number of absentee votes among these 725.
  2. What is the probability that at least 160 in this sample will vote by absentee ballot?
  3. Compute the probability that the number of absentee votes among these 725 would be at least 120 and at most 150.

Solution by TI-84:
Here n=725, p=.18. X= Number of absentee votes among this sample of 725. X is a B(725, .18) random variable. We use TI-84 :

  1. Expected number of absentee votes = E(X)=μ=np=725*.18=130.5
    Standard deviation of X=σ= np(1-p) = 725*.18*(1-.18)=10.3446.
  2. probability that at least 160 will vote by absentee ballot
    = P(160 ≤ X ) = 1- P( 0 ≤ X ≤159 )
    =1 -binomialcdf(725, .18, 159) = 1-.9969=.0031.
  3. probability that the number of absentee votes would be at least 120 and at most 150
    =P( 120 ≤ X ≤150 ) = P(X ≤150 ) - P(X ≤119)
    = binomialcdf(725, .18, 150) - binomialcdf(725, .18, 119)
    =.9718-.1435=.8283.

Exercise 4.3.6. About 27 percent of the population take flu shots. You are in a class of 750 students.

  1. Compute the mean μ and standard deviation σ of the number students who took a flu shot.
  2. compute the probability that at most 200 would have taken a flu shot.
  3. Compute the probability that between 190 and 215 students would have taken a flu shot.

Solution by TI-84:
Here n=750, p=.27. X= Number of students in this class who took the flu shot. X is a B(750, .27) random variable. We use TI-84 :

  1. Expected number = E(X)=μ=np=750*.27 = 202.5
    Standard deviation of X=σ= np(1-p) = 750*.27*(1-.27)=12.1583.
  2. probability that at at most 200 would have taken a flu shot
    = P(X ≤ 200 ) =binomialcdf(750, .27, 200) =.4371
  3. probability that between 190 and 215 students would have taken a flu shot
    =P( 190 ≤ X ≤ 215 ) = P(X ≤215 ) - P(X ≤ 189)
    = binomialcdf(750, .27, 215) - binomialcdf(750, .27, 189)
    = .8573 - .1423= .715

Exercise 4.3.7. It is believed that 35 percent of the population in a county shop in health food market. If you sample 800 individuals, what is the probability that at least 400 would shop in health food market?

  1. Compute the mean μ and standard deviation σ of the number those in this sample who shop in health food market.
  2. compute the probability that at least 300 in this sample shop in health food market..
  3. Compute the probability that between 270 and 315 shop in in health food market.

Solution by TI-84:
Here n=800, p=.35. X= Number of shop in health food market. X is a B(750, .27) random variable. We use TI-84 :

  1. Expected number = E(X)=μ=np=800*.35= 280
    Standard deviation of X=σ= np(1-p) = 800*.35*(1-.35)=13.4907
  2. probability that at least 300 in this sample shop in health food market
    = P(X ≤ 300 ) = 1- P( X ≤ 299 )
    =1 -binomialcdf(800, .35, 299) = 1-.9253= .0747
  3. probability that between 270 and 315 shop in in health food market
    =P( 270 ≤ X ≤ 315 ) = P(X ≤ 315 ) - P(X ≤ 169)
    = binomialcdf(800, .35, 315) - binomialcdf(800, .35, 169)
    = .9955 - 7.4088*10-18 = .9955 (approx).
    If we ask your answer in parcent, the answer is 99.55.

Exercise 4.3.8. It is known that 78 percent of the microwave ovens last more that five years. A SQC inspector sampled 600 microwaves.

  1. Compute the mean μ and standard deviation σ of the number of microwave ovens in this sample that would last more that five years.
  2. Compute the probability that at least 470 in this sample microwave ovens would last more that five years.
  3. Compute the probability that between 460 and 480 of microwaves in this sample would last more than five years.

Exercise 4.3.9. It is known that a vaccine may cause fever as side effect, after one takes the shot. The producer of the vaccine claims that only 11 percent of those who take the shot experience such side effects. You sample 978 individuals who took the shot.

  1. Compute the mean μ and standard deviation σ of the number of those this sample who would get a fever as side effect.
  2. Compute the probability that at least 100 in this sample would get a fever as side effect.
  3. Compute the probability that between 95 and 120 would get a fever as side effect.


Remark. When the number of trials n in a binomial experiment is too large (say more than 1000) TI-84 fails. We will provide a remedy to this problem in Lesson 5. Following variation of the above demonstrate that TI-84 fails.


Exercise 4.3.10. It is known that a vaccine may cause fever as side effect, after one takes the shot. The producer of the vaccine claims that only 11 percent of those who take the shot experience such side effects. You sample 1000 individuals who took the shot.

  1. Compute the mean μ and standard deviation σ of the number of those this sample who would get a fever as side effect.
  2. Compute the probability that at least 110 in this sample would get a fever as side effect.
  3. Compute the probability that between 105 and 135 would get a fever as side effect.


back to top