Lecture 15 Introduction to Random Variables
Download
Report
Transcript Lecture 15 Introduction to Random Variables
Random Variables
Random Variable
A variable is a quantity whose value
changes. (compared with constant)
A random variable is also a variable
but its value must be the outcome of an
experiment.
Also, its value must be numeric.
Random variable
Definition:
A random variable is a numerical description of
the outcome of an experiment.
Example:
X=number of heads after tossing a fair coin 100 times
Y=number of 6’s after rolling a fair die 100 times
Z=number of A’s in this class.
A=amount of time you spent watching tv every week.
Types of random variable
Discrete random variable:
A random variable assuming either finite
number of values or an infinite sequence of
values.
Continuous random variable:
A random variable assuming any numerical
value in an interval or collecting of
intervals.
Discrete random variable
Example:
Counts:
Numeric value for qualitative variable:
gender, occupation,
Ordinal variable:
1=not satisfactory at all, 2=somewhat
dissatisfactory, 3=somewhat satisfactory,
4=very satisfactory
Continuous random variable
Example:
Interval and ratio variables: income, time spent,
length, weight, distance, etc.
*** sometimes, a continuous random variable could
be used as a discrete one.
Example: income: 1=less than 40K, 2=40K—60K,
3=60K—80K, 4=80K—100k, 5=100K+
*** also, the line between continuous and discrete
is not always clear. (ex. units used in description
or rounding).
How to describe random
variables
Example:
x
1
2
3
4
5
f(x)
0.2
0.2
0.2
0.2
0.2
Probability Distribution
It is more often called:
probability density
function, or PDF.
From the PDF, we can
see whether the sample
points are equally likely
or not.
Example:
X=outcome of rolling a
fair die
X
1
2
3
4
5
6
probability
1/6
1/6
1/6
1/6
1/6
1/6
Conditions for a valid PDF
PDF is not just a table of numbers, it
has to satisfy some conditions to be a
valid one:
1. f(x) must be non-negative.
2. the sum of f(x) for all x in the sample
space must be ONE.
Example 1
x
f(x)
1
0
2
1.5
3
0.3
4
0.1
Example 2
x
f(x)
-2
0.3
0
0.2
1
0.4
2
0.1
Example 3
x
f(x)
-2
0.6
-1
0.1
0
0.1
1
0
2
0.1
Example 4
x
f(x)
-2
-0.2
-1
0.5
0
0.2
1
0.4
2
0.1
Another look at rolling dies
When all the sample points in the
sample space have equal probability,
we call this kind of probability
distribution discrete uniform
probability function.
If there are n sample points and all the
points are equally likely, then the
probability of each point is: 1/n.
Ways to describe discrete
random variables
PDF is always a way to describe a
random variable.
There are also other ways:
Expected value (mean)
Variance
Expected Value
Previously, we know that the mean is
the sum over the number of cases.
BUT, that is under the assumption that
all the points are equally likely.
What if they are not?
Expected value
Suppose X is a discrete random
variable and p(x) is its pdf, then its
mean and variance are:
Mean:
Expected value
In example 2 above,
the mean of x is:
-0.6+0+0.4+0.2=0
x
f(x)
xf(x)
-2
0.3
-0.6
0
0.2
0
1
0.4
0.4
2
0.1
0.2
Properties of the expected
value
E(X+Y)=E(X)+E(Y)
E(X+c)=E(X)+c
E(aX+bY)=aE(X)+bE(Y)
Again, using
numbers in example
2, let Y=X+2, then
E(Y)=0+.4+1.2+0.4
=2=E(X)+2
Y
f(Y) Yf(Y)
0
0.3
0
2
0.2
0.4
3
0.4
1.2
4
0.1
0.4