Upload
others
View
78
Download
0
Embed Size (px)
Citation preview
Random variables
Ignacio Cascos Depto. Estadística, Universidad Carlos III 1
2
Outline1. Definition of randomvariable2. Discrete and continuous randomvariables
� Discrete randomvariables (probabilitymassfunctionand cdf)
Ignacio Cascos Depto. Estadística, Universidad Carlos III 2
(probabilitymassfunctionand cdf)� Continuos randomvariables
(density mass function and cdf)
3. Characteristic features of a randomvariable� Location, scatter and shape parameters� Independent randomvariables
Definition of random variable
A random variableassesses a real number to
each possible outcome of the random experiment.
Ignacio Cascos Depto. Estadística, Universidad Carlos III 3
each possible outcome of the random experiment.
It is randombecause we do not know its value
before carrying out the random experiment.
Definition of random variable� Definition. A random variableX is a mapping
X: E → IR, where E is the sample space associated with a random experiment.
Ignacio Cascos Depto. Estadística, Universidad Carlos III 4
e1
e3
e2
X (e3) X (e2) X (e1)
X
IR
Definition of random variable� The eventsare now of the type X∈A,
where A is a subset of IR.Their probabilities are P(X∈A) = P({ e∈E: X(e)∈A}).
Ignacio Cascos Depto. Estadística, Universidad Carlos III 5
Properties:
1. P(X∈A) ≥ 0 ;
2. P(X∈IR) = 1 ;
3. if A1, A2,…⊂IR satisfy Ai∩Aj= ∅ for i ≠ j,
thenP(X∈∪i= 1,∞ Ai)=Σi= 1,∞ P(X∈Ai) .
Outline1. Definition of randomvariable2. Discrete and continuous randomvariables
� Discrete randomvariables (probabilitymassfunctionand cdf)
Ignacio Cascos Depto. Estadística, Universidad Carlos III 6
(probabilitymassfunctionand cdf)� Continuos randomvariables
(density mass function and cdf)
3. Characteristic features of a randomvariable� Location, scatter and shape parameters� Independent randomvariables
Discrete and continuous random variablesThe rangeof a random variable is the set of values that
it can assume.
� A random variable is discreteif its range is finite or denumerable.
Ignacio Cascos Depto. Estadística, Universidad Carlos III 7
denumerable.� Examples: number of defective items, number of rolls of a
die until a 5 occurs.
� A random variable is continuousif its range contains an interval.� Example: battery life.
Discrete random variablesGiven a discrete random variable X, its probability mass function assigns to each possible value of the variablethe probability that X assumes such a value.
p: IR → [0,1]
Ignacio Cascos Depto. Estadística, Universidad Carlos III 8
p: IR → [0,1]
x → p(x) = P(X=x)
It satisfies that 0 ≤ p(x) ≤ 1 for every x and if X assumes
n different possible values x1,…,xn , thenΣi p(xi) = 1.
We have P(X∈A) = Σxi∈A p(xi) .
Discrete random variablesLet X be the number of heads
after tossing 3 times a fair
coins. The probability mass
function of X is:
Funcion de probabilidad
0.25
0.30
0.35
Probability mass function
Ignacio Cascos Depto. Estadística, Universidad Carlos III 9
function of X is:
0 1 2 3
numero motores averiados
prob
abili
dad
0.00
0.05
0.10
0.15
0.20
0.25
x p(x) = P(X=x)
0 0.125
1 0.375
2 0.375
3 0.125
Discrete random variablesThe cumulative distribution function (cdf)of Xat x is the probability that X is smaller or equal to x.
≤
Ignacio Cascos Depto. Estadística, Universidad Carlos III 10
F(x) = P(X ≤ x)1. limx→ −∞ F(x) = 0 ;2. limx→ ∞ F(x) = 1 ;3. F is nondecreasing ;4. F is right-continuous.
Discrete random variablesThe cumulative
distribution function of
a discrete random
0.8
1.0
Funcion de distribucioncdf
Ignacio Cascos Depto. Estadística, Universidad Carlos III 11
a discrete random
variable is stepwise,
F(x) = P(X ≤ x)
= Σxi ≤ x p(xi) -1 0 1 2 3 4
0.0
0.2
0.4
0.6
numero motores averiados
prob
abili
dad
pro
bab
ility
Continuous random variablesSince the range of a continuous random variable is not
denumerable, an expression like Σi p(xi) = 1 makes no sense.
Histogram for the lifetime of 10000 batteries.
Ignacio Cascos Depto. Estadística, Universidad Carlos III 12
Histogram of duracion
duracion
Den
sity
0 2 4 6 8
0.0
0.2
0.4
0.6
0.8
Histogram of duracion
duracion
Den
sity
0 2 4 6 8
0.0
0.2
0.4
0.6
0.8
Histogram for the lifetime of 10000 batteries.
Continuous random variablesFunction f describes the
curve drawn together
with the histogram on
0.8
1.0
Ignacio Cascos Depto. Estadística, Universidad Carlos III 13
with the histogram on
the right. We have
P(2 ≤ X ≤ 4) ≈ ∫24 f(x)dx
where X is the lifetime of
a battery. 0 2 4 6 8
0.0
0.2
0.4
0.6
dens
idad
den
sity
Continuous random variablesThe density mass functionf describes the probability
distribution of a continuous random variable. It satisfies:
1. f(x) ≥ 0 ;
Ignacio Cascos Depto. Estadística, Universidad Carlos III 14
1. f(x) ≥ 0 ;
2. ∫−∞+∞ f(x)dx = 1 .
3. We haveP(a ≤ X ≤ b) = ∫ab f(x)dx .Given X continuous r.v., it satisfies
� P(X = a) = 0 ;
� P(a ≤ X ≤ b) = P(a < X ≤ b) = P(a ≤ X < b) = P(a < X < b)
Continuous random variablesIn order to compute the cumulative distribution Function (cdf) of a continuous random variable, we must integrate its density mass function,
≤ ∫
Ignacio Cascos Depto. Estadística, Universidad Carlos III 15
F(x) = P(X ≤ x) = ∫−∞x f(t)dt
1. limx→ −∞ F(x) = 0 ;2. limx→ ∞ F(x) = 1 ;3. F is nondecreasing ;4. F is continuous .
Continuous random variablesSince the cumulative distribution
function is a primitive of the
density mass function, deriving
the cdf, we obtain the density
Mean1
Exponential Distribution
cum
ula
tive
pro
bab
ility
0,8
1
Ignacio Cascos Depto. Estadística, Universidad Carlos III 16
the cdf, we obtain the density
mass function,
f(x) = dF(x)/dx .
We are working with
f(x) = e−x if x > 0
F(x) = 1− e−x if x > 0x
cum
ula
tive
pro
bab
ility
-1 0 1 2 3 4 5 6 7 80
0,2
0,4
0,6
Outline1. Definition of randomvariable2. Discrete and continuous randomvariables
� Discrete randomvariables (probabilitymassfunctionand cdf)
Ignacio Cascos Depto. Estadística, Universidad Carlos III 17
(probabilitymassfunctionand cdf)� Continuos randomvariables
(density mass function and cdf)
3. Characteristic features of a randomvariable� Location, scatter and shape parameters� Independent randomvariables
Mathematical expectation or meanThe expecationor mean(µ) of a random variable
is a central point with respect to its distribution
� X discrete, µ = E[X] = ∑xip(xi)
Ignacio Cascos Depto. Estadística, Universidad Carlos III 18
� X discrete, µ = E[X] = ∑xip(xi)
� X continuous, µ = E[X] = ∫ xf(x)dx
Properties: Given X,Yand two real numbers, a,b
1. E[a+bX] = a+bE[X] ;
2. E[X+Y] = E[X]+E[Y] .
Mathematical expecation or meanGiven a functiong: IR → IR, the expectation of
randomvariable g(X) can be computed as
Ignacio Cascos Depto. Estadística, Universidad Carlos III 19
� X discrete, E[g(X)] = ∑g(xi)p(xi)
� X continuous, E[g(X)] = ∫ g(x)f(x)dx
MedianThe medianof a random variable X is a value Me
such that
≥ ≥ ≥
Ignacio Cascos Depto. Estadística, Universidad Carlos III 20
F(Me) ≥ 1/2 ; P(X ≥ Me) ≥ 1/2
If X is a continuous r.v., then F(Me) = 1/2.
QuantilesFor 0 < α < 1, the α-quantileof random variable X is a
value xα such that the probability of X being not greater
than xα is, at least, α and the probability of X being not
−α
Ignacio Cascos Depto. Estadística, Universidad Carlos III 21
smaller than xα is, at least, 1−α.
F(xα) = P(X ≤ xα) ≥ α ; P(X ≥ xα) ≥ 1−α Percentilesand quartilesare defined in a similar way
Pa = xa/100 ; Qi = P25i
where1 ≤ a ≤ 99 and 1 ≤ i ≤ 3 .
Scatter parametersThe varianceof a random variable X is given by
σ2 = Var[X] = E[(X−E[X])2]
� X discrete, σ2 = Var[X] = ∑(xi−µ)2 p(xi)
Ignacio Cascos Depto. Estadística, Universidad Carlos III 22
� X discrete, σ2 = Var[X] = ∑(xi−µ)2 p(xi)
� X continuous, σ2 = Var[X] = ∫ (x−µ)2 f(x)dx
The standard deviationis the (positive) square
root of the variance, σ = (Var[X])1/2 .
Scatter parametersProperty. Var[X] = E[X2]−E[X]2 = E[X2]−µ2
Given a,b∈IR and a random variable X, we have
Ignacio Cascos Depto. Estadística, Universidad Carlos III 23
the following properties of the variance
1. Var[b] = 0 ;
2. Var[aX] = a2Var[X] ;
3. Var[aX+b] = a2Var[X] .
Shape parametersDescribe features from the distribution of a r.v.
different from location and scatter
k-th moment about the origin, m = E[Xk]
Ignacio Cascos Depto. Estadística, Universidad Carlos III 24
k-th moment about the origin, mk = E[Xk]
k-th moment about the mean, µk = E[(X−µ)k]
� Skewness. Skew = µ3/σ3
� Kurtosis. Kurt = µ4/σ4−3
Independent random variablesTwo random variables X and Yare independent
if for any A,B⊂IR,
P((X∈A)∩(Y∈B)) = P(X∈A)P(Y∈B)
Ignacio Cascos Depto. Estadística, Universidad Carlos III 25
P((X∈A)∩(Y∈B)) = P(X∈A)P(Y∈B)
Equivalently, for any x,y∈IR
P((X ≤ x)∩(Y ≤ y)) = P(X ≤ x)P(Y ≤ y)
Property. If X and Yare independent,
Var[X+Y] = Var[X]+Var[Y]
Example(solidmissilefuel)An important factor in solid missile fuel is the particle size.
Significant problems occur if the particle sizes are too large.
From production data in the past, it has been determined that
the particlesize (X micrometers) distribution is the particlesize (X micrometers) distribution is
characterized by
Ignacio Cascos Depto. Estadística, Universidad Carlos III 26
>
=otherwise0
1 if)(
2 xxkxfX
Example(solidmissilefuel)� Compute the value of k so that fX(x) is a valid density
function.
� Find the cumulative distribution function FX(x).
� What size x is exceeded by 50% of the particles?� What size x is exceeded by 50% of the particles?
� What is the probability that the size of a random particle from the manufactured fuel exceeds 4 micrometers?
� What is the probability that the size of a random particle from the manufactured fuel is lower than 5 if we know that it exceeds 4 micrometers?
Ignacio Cascos Depto. Estadística, Universidad Carlos III 27