Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Random Variable
Outcome of random experiment can be
Categorical or Numerical
However, we often want to represent outcomes as
numbers.
Random variable is a function that associates a
unique numerical value with every outcome of an
experiment.
Discrete vs. Continuous
Random Variable
Discrete
Binomial
Continuous
Uniform
Normal
t
F
χ2
Discrete Random Variable
Discrete random variable, X, is a random
variable with a finite or countable number of
possible outcomes.
Notation:
X = discrete random variable,
k = a number that the discrete random variable
could assume,
P(X=k) is the probability that the random
variable X equals k.
Probability Distribution Function
The probability distribution function (pdf) for a
discrete random variable X is a table or rule that
assigns probabilities to the possible values of X.
X
x1
x2
x3
P(X)
P(X= x1) = p1
p2
p3
…
…
Example:
X – Number of Times Go Out (per week)
X
0
1
2
3
4
5
6
7
Total
P(X=k)
0.074
0.167
0.287
0.213
0.120
0.083
0.019
0.037
1.000
Probability Distribution
Two main conditions:
The sum of all the individual probabilities (p1,
p2, …) must equal to 1.
The individual probabilities must be between 0
and 1.
Probability histogram can be used to display the
distribution for a discrete random variable
Use x-axis to represent the values or outcomes
and y-axis for the corresponding probabilities.
Cumulative Distribution
Cumulative distribution function (cdf) for r.v. X
is a rule that provides the cumulative probabilities
P(X≤k), i.e., the probabilities that X is less than or
equal to k.
X
x1
x2
x3
…
P(X)
P(X= x1) = p1
P(X≤x2)=
p 2 + p1
p2 + p1 +p3
…
Example
A psychology experiment on the behavior of
young children involves placing a child in a
designed area with 5 toys.
Over a fixed time period various observations
were made, including the number of toys the child
plays with.
Example:
Based on many kids, the following probability
distribution was determined:
X=# toys
0
1
2
3
4
P(X=k)
0.03
0.16
0.3
0.23
0.17
P(X=5) =
5
?
Example:
Based on many kids, the following probability
distribution was determined:
X=# toys
0
1
2
3
4
P(X=k)
0.03
0.16
0.3
0.23
0.17
5
0.11
P(X=5) = 1 – (0.03 + 0.16 +0.3 +0.23 +0.17) =
= 1 – 0.89 = 0.11
Example:
X=#
Cumulative Distribution of X
0
1
2
3
4
5
0.03
0.03+0.16
0.19+0.3
0.72
0.89
1
=0.19
=0.49
toys
P(X)
What is the probability that a randomly chosen kid
will play with at most 2 toys?
P(X<=2) = P(X=0) + P(X=1) +P(X=2)
Example:
X=#
Cumulative Distribution of X
0
1
2
3
4
5
0.03
0.03+0.16
0.19+0.3
0.72
0.89
1
=0.19
=0.49
toys
P(X)
What is the probability that a randomly chosen kid
will play with at most 2 toys?
P(X<=2) =0.03+0.16 + 0.3 = 0.49
Example:
X=#
Cumulative Distribution of X
0
1
2
3
4
5
0.03
0.03+0.16
0.19+0.3
0.72
0.89
1
=0.19
=0.49
toys
P(X)
What is the probability that a randomly chosen kid
will play with at least 3 toys?
P(X>=3) =
Example:
X=#
Cumulative Distribution of X
0
1
2
3
4
5
0.03
0.03+0.16
0.19+0.3
0.72
0.89
1
=0.19
=0.49
toys
P(X)
What is the probability that a randomly chosen kid
will play with at least 3 toys?
P(X>=3) = [use complement rule] = 1-P(X<=2)
= 1-0.49 = 0.51
Example:
Given the child has played with at least 3 toys,
what is the probability this child will play with all
5 toys?
X=# toys
0
1
2
3
4
P(X=k)
0.03
0.16
0.3
0.23
0.17
Event of interest: X=5
P(X=5|X>=3) = (X=5 and X>=3)/P(X>=3)
5
0.11
Condition X>=3
Example:
Given the child has played with at least 3 toys,
what is the probability this child will play with all
5 toys?
X=# toys
0
1
2
3
4
P(X=k)
0.03
0.16
0.3
0.23
0.17
5
0.11
Event of interest: X=5
Condition X>=3
P(X=5|X>=3) = (X=5 and X>=3)/P(X>=3) =
P(X=5)/ P(X>=3) = 0.11/0.51 =0.2156
Example:
X – Number of Times Go Out (per week)
X
0
1
2
3
4
5
6
7
P(X=k)
0.074
0.167
0.287
0.213
0.120
0.083
0.019
0.037
Given that a student goes
out at least 2 times per week,
what is the probability that
goes out 5 or more times per
week?
Event of interest: X>=5
Condition X>=2
P(X>=5| X>= 2) = ?
Example:
X – Number of Times Go Out (per week)
Event of interest: X>=5
Condition X>=2
X
0
1
2
3
4
5
6
7
P(X=k)
0.074
0.167
0.287
0.213
0.120
0.083
0.019
0.037
1) P(X>=5| X>= 2) =
P(X>=5 and X>=2)/P(X>=2)
2) P(X>=2) = 1-(P(X=0) +
P(X=1)) = 1 –(0.074+0.167)
= 1- 0.241 = 0.759
Example:
X – Number of Times Go Out (per week)
Event of interest: X>=5
Condition X>=2
X
0
1
2
3
4
5
6
7
P(X=k)
0.074
0.167
0.287
0.213
0.120
0.083
0.019
0.037
1) P(X>=5| X>= 2) =
P(X>=5 and X>=2)/P(X>=2)
2) P(X>=2) = 0.759
3) P(X>=5 and X>=2) =
P(X>=5) =
0.083+0.019+0.037 =0.139
4) P(X>=5| X>= 2) =
= 0.139/ 0.759 = 0.1831
Expected Value
Expected value, E(X), of a random variable X is
the mean value in the sample space of possible
outcomes (= population mean).
Expected value is interpreted as the mean value
that would be obtained from an infinite (total)
number of observations on the random variable.
Expected Value
Probability distribution function (pdf) of X.
X
x1
x2
x3
P(X)
P(X= x1) = p1
p2
p3
…
…
Example:
X=# toys
0
1
2
3
4
P(X=k)
0.03
0.16
0.3
0.23
0.17
5
0.11
What is the expected number of toys played with?
E(X) = 0*0.03 + 1*.16 + 2*0.3 + 3*0.23 +4*0.17 +
5*0.11 = 2.68 toys
Note: we never round E(X)! E(X) may not be value that
ever expected on a single random outcome. Instead, it
is the average over the long run.
Example:
X – Number of Times Go Out (per week)
X
0
1
2
3
4
5
6
7
P(X=k)
0.074
0.167
0.287
0.213
0.120
0.083
0.019
0.037
E(X) = ?
Example:
X – Number of Times Go Out (per week)
X
0
1
2
3
4
5
6
7
P(X=k)
0.074
0.167
0.287
0.213
0.120
0.083
0.019
0.037
E(X) = 0*0.074 + 1*0.167
+2*0.287 + 3*0.213 + 4*0.12
+5*0.083 +6*0.019 +7*0.037
= 2.648 times
Standard Deviation (std)
Probability distribution function (pdf) of X.
X
x1
x2
x3
P(X)
P(X= x1) = p1
p2
p3
…
…
Example (μ =E(X) = 2.68 toys)
X=# toys
0
1
2
X-μ
-2.68
-1.68
-.68
(X-μ)2
7.182
P(X=k)
0.03
0.16
0.3
(X-μ)2
0.215
P(X=k)
3
4
5
0.23
0.17
0.11
Example:
X – Number of Times Go Out (per week)
X
0
1
2
3
4
5
6
7
P(X=k)
0.074
0.167
0.287
0.213
0.120
0.083
0.019
0.037
Std(X) = sqrt( 0^2*0.074
+1^2*0.167 + 2^2 *0.287
+ 3^2*0.213 + 4 ^2*0.12
+5^2*0.083 +6^2*0.019
+7^2*0.037 – 2.648^2) =
Example: Different strategies sampling 2
out of numbers {1,2,3}:
Sampling WITHOUT replacement,
Order IS important
Number of Samples = 6
(1,2)
(2,1)
(3,1)
(1,3)
(2,3)
(3,2)
Example: Different strategies sampling 2
out of numbers {1,2,3}:
Sampling WITHOUT replacement,
Order IS NOT important
Number of Samples = 3
(1,2)
(1,3)
(2,3)
Usually, sample without replacement, thereby
ensuring the sample is comprised of different
individuals!
Permutations
When sampling from the population WITHOUT
replacement of the subjects and the order of
sampled individuals IS important, the number of
different arrangements, permutations of n
subjects from a population of size N:
where N! = [N factorial] =1*2*3*…*(N-1)*N
0! = 1
Example: Permutations
Locker combination (order is important)
comprised of 3 distinct digits. Compute the
number of different locker combination .
N = _____________
n = ______________
P(N_n) = N!/(N-n)! =
Example: Permutations
Locker combination (order is important)
comprised of 3 distinct digits. Compute the
number of different locker combination .
N = 10
n=3
P(N _ n) = N!/(N-n)! = 10!/(10-3)! =
= (1*2*…*7*8*9*10)/ (1*2*…*7) = 720
Permutations
Simple Properties
General Formula
Combinations
When sampling from the population WITHOUT
replacement of the subjects and the order of
sampled individuals IS NOT important, the
number of different samples, combinations of n
subjects from a population of size N:
Example
Consider sampling 3 students from a class of 10
people.
Compute the number of different samples.
In this situation there will be no replacement, and
the order of students in a sample is not important.
N = _____________
n = ______________
C(N choose n) = N!/n!(N-n)! =
Example
Consider sampling 3 students from a class of 10
people.
Compute the number of different samples.
N =10
n=3
C(N choose n) = N!/n!(N-n)! =10!/(3!7!) =
=8*9*10/(2*3) = 120
Combinations
Simple Properties
General Formula