You are on page 1of 11

Outline

1. Definition of random variable


2. Discrete and continuous random variables
Discrete random variables (probability mass function and cdf)
Continuos random variables (density mass function and cdf)

Random variables

3. Characteristic features of a random variable


Location, scatter and shape parameters

4. Transformations of random variables


5. Random vectors
Joint distribution and independence
Characteristic features, covariance matrix

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Definition of random variable

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Definition of random variable

A random variable assesses a real number to


each possible outcome of the random experiment.

Definition. A random variable X is a mapping


X: E IR, where E is the sample space
associated with a random experiment.
X

e1

It is random because we do not know its value


before carrying out the random experiment.

e2
e3
X (e3)

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Ignacio Cascos

X (e2)

Depto. Estadstica, Universidad Carlos III

X (e1)

IR
4

Definition of random variable

Outline
1. Definition of random variable
2. Discrete and continuous random variables

The events are now of the type XA,


where A is a subset of IR.

Discrete random variables (probability mass function and cdf)


Continuos random variables (density mass function and cdf)

Their probabilities are P(XA) = P({eE: X(e)A}).


Properties:
1.
P(XA) 0 ;
2.
P(XIR) = 1 ;
3.

3. Characteristic features of a random variable


Location, scatter and shape parameters

4. Transformations of random variables


5. Random vectors

if A1, A2,IR satisfy AiAj= for i j,

Joint distribution and independence


Characteristic features, covariance matrix

then P(Xi=1, Ai)=i=1, P(XAi) .


Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Discrete and continuous random variables

Examples: number of defective items, number of rolls of a


die until a 5 occurs.

A random variable is continuous if its range contains


an interval.
Example: battery life.
Depto. Estadstica, Universidad Carlos III

Depto. Estadstica, Universidad Carlos III

Discrete random variables


Given a discrete random variable X, its probability mass
function assigns to each possible value of the variable
the probability that X assumes such a value.
p: IR [0,1]

The range of a random variable is the set of values that


it can assume.
A random variable is discrete if its range is finite or
denumerable.

Ignacio Cascos

Ignacio Cascos

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(XA) = xiA p(xi) .
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Discrete random variables

Discrete random variables

Let X be the number of heads


after tossing 3 times a fair
coins. The probability mass
function of X is:

The cumulative distribution function (cdf) of X


at x is the probability that X is smaller or equal
to x.

F(x) = P(X x)

0.375

0.05

0.20

p(x) = P(X=x)
0.125

0.375

0.125

0.15

x
0

0.00

probabilidad

0.25

0.30

0.35

Probability
function
Funcion demass
probabilidad

0.10

2.
3.
0

Ignacio Cascos

limx F(x) = 0 ;
limx F(x) = 1 ;
F is nondecreasing ;
F is right-continuous.

1.

4.

numero motores averiados

Depto. Estadstica, Universidad Carlos III

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

10

Continuous random variables

The cumulative
distribution function of
a discrete random
variable is stepwise,

Since the range of a continuous random variable is not


denumerable, an expression like i p(xi) = 1 makes no sense.

0.8

1.0

Funcion de distribucion
cdf

0.6

Histogram for the lifetime of 10000 batteries.


Histogram of duracion

0.2

0.2

numero motores averiados

0.0

0.0

-1

Ignacio Cascos

0.4

Density

0.4

Density

0.0

F(x) = P(X x)
= xi x p(xi)

0.2

0.6

0.6

0.8

0.8

Histogram of duracion

0.4

probability
probabilidad

Discrete random variables

Depto. Estadstica, Universidad Carlos III

11

Ignacio Cascos

4
duracion

Depto. Estadstica, Universidad Carlos III

4
duracion

12

Function f describes the


curve drawn together
with the histogram on
the right. We have
P(2 X 4) 24 f(x)dx
where X is the lifetime of
a battery.

The density mass function f describes the probability


distribution of a continuous random variable. It satisfies:

Ignacio Cascos

0.8

1.0

Continuous random variables

0.6

1.
0.4

2.

0.2

3.

f(x) 0 ;

+ f(x)dx = 1 .
We have P(a X b) = ab f(x)dx .

Given X continuous r.v., it satisfies

0.0

density
densidad

Continuous random variables

P(X = a) = 0 ;
P(a X b) = P(a < X b) = P(a X < b) = P(a < X < b)

Depto. Estadstica, Universidad Carlos III

13

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

14

Continuous random variables

Continuous random variables

In order to compute the cumulative distribution


Function (cdf) of a continuous random variable,
we must integrate its density mass function,
F(x) = P(X x) = x f(t)dt

Since the cumulative distribution


function is a primitive of the
density mass function, deriving
the cdf, we obtain the density
mass function,
f(x) = dF(x)/dx .

2.
3.
4.

limx F(x) = 0 ;
limx F(x) = 1 ;
F is nondecreasing ;
F is continuous .

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

We are working with


f(x) = ex if x > 0
F(x) = 1 ex if x > 0
15

Ignacio Cascos

cumulative probability

1.

Exponential Distribution
1

Mean
1

0,8
0,6
0,4
0,2
0
-1 0

Depto. Estadstica, Universidad Carlos III

16

Outline

Mathematical expectation or mean

1. Definition of random variable


2. Discrete and continuous random variables

The expecation or mean () of a random variable


is a central point with respect to its distribution

Discrete random variables (probability mass function and cdf)


Continuos random variables (density mass function and cdf)

X discrete, = E[X] = xip(xi)

3. Characteristic features of a random variable

X continuous, = E[X] = xf(x)dx


Properties: Given X,Y and two real numbers, a,b
1. E[a+bX] = a+bE[X] ;
2. E[X+Y] = E[X]+E[Y] .

Location, scatter and shape parameters

4. Transformations of random variables


5. Random vectors
Joint distribution and independence
Characteristic features, covariance matrix
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

17

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

18

Mathematical expecation or mean

Median

Given a function g: IR IR, the expectation of


random variable g(X) can be computed as

The median of a random variable X is a value Me


such that

F(Me) 1/2 ; P(X Me) 1/2

X discrete, E[g(X)] = g(xi)p(xi)


X continuous, E[g(X)] = g(x)f(x)dx

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

If X is a continuous r.v., then F(Me) = 1/2.

19

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

20

Quantiles

Scatter parameters

For 0 < < 1, the -quantile of 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
smaller than x is, at least, 1.

The variance of a random variable X is given by


2 = Var[X] = E[(XE[X])2]

F(x) = P(X x) ; P(X x) 1


Percentiles and quartiles are defined in a similar way
Pa = xa/100 ; Qi = P25i
Depto. Estadstica, Universidad Carlos III

21

Scatter parameters

Depto. Estadstica, Universidad Carlos III

22

Describe features from the distribution of a r.v.


different from location and scatter

Given a,bIR and a random variable X, we have


the following properties of the variance
1. Var[b] = 0 ;
2. Var[aX] = a2Var[X] ;
3. Var[aX+b] = a2Var[X] .
Depto. Estadstica, Universidad Carlos III

Ignacio Cascos

Shape parameters

Property. Var[X] = E[X2]E[X]2 = E[X2]2

Ignacio Cascos

X continuous, 2 = Var[X] = (x)2 f(x)dx


The standard deviation is the (positive) square
root of the variance, = (Var[X])1/2 .

where1 a 99 and 1 i 3 .
Ignacio Cascos

X discrete, 2 = Var[X] = (xi)2 p(xi)

23

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/43
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

24

Example (Flange thickness)

Outline

The thickness of a flange on an aircraft component, X in mm, has


the following density mass function

1. Definition of random variable


2. Discrete and continuous random variables
Discrete random variables (probability mass function and cdf)
Continuos random variables (density mass function and cdf)

200( x 0.95) if 0.95 < x < 1.05


f X (x
( x) =
0
otherwise

3. Characteristic features of a random variable


Location, scatter and shape parameters

Determine the cumulative distribution function of flange


thickness.
Determine the proportion of flanges that exceeds 1.02 mm.
What thickness is exceeded by 90% of the flanges?
Determine the mean and variance of flange thickness.
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

4. Transformations of random variables


5. Random vectors
Joint distribution and independence
Characteristic features, covariance matrix
25

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Transformations of random variables

Transformations of random variables

Given a random variable X and a function


g: IR IR, we want to describe the distribution
of the random varaible Y=g(X).

If X is a discrete random variable,

FY(y) = P(Y y) = P(g(X) y) = P(X Ay) ,


where Ay = {x: g(x) y}.
It often happens that the set Ay can be fully
described in a simple way.
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

27

26

FY(y) = P(Y y) = P(g(X) y)


= g(xi) y pX(xi) .
Further, the probability mass function of Y is

pY(y) = P(Y = y) = P(g(X) = y)


= g(xi) = y pX(xi) .
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

28

Transformations of random variables

Outline

If g is continuous and increasing

1. Definition of random variable


2. Discrete and continuous random variables

FY(y) = P(g(X) y) = P(X g1(y)) = FX(g1(y))


In general, given X continuous r.v. and Y=g(X)
with g injective and derivable, the density mass
function of Y satisfies

Discrete random variables (probability mass function and cdf)


Continuos random variables (density mass function and cdf)

3. Characteristic features of a random variable


Location, scatter and shape parameters

4. Transformations of random variables


5. Random vectors
Joint distribution and independence
Characteristic features, covariance matrix

fY (y) = fX (x) |dx/dy|


Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

29

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

30

Joint distribution of a random vector

Discrete random vectors

Given X and Y two random variables in the same


sample space E, the mapping
(X,Y) : E IR2
is a bivariate random vector.
The joint cumulative distribution function of
(X,Y) at (x,y) is given by

Given two discrete random variables X and Y,


the random vector (X,Y) is discrete and its joint
probability mass function is given by
p(x,y) = P(X = x , Y = y).
It satisfies:

FX,Y(x,y) = P(X x , Y y) = P((X x)(Y y))

1.
2.

p(x,y) 0
xyp(x,y) = 1

Joint cumulative distribution function


F(x0,y0) = P(X x0 , Y y0) = xx yy p(x,y)
0

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

31

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

32

Continuous random vectors

Marginal distributions

For X and Y continuous rvs, the random vector (X,Y)


is continuous and its joint density function f(x,y) satisfies
1.

f(x,y) 0 ;

2.

f(x,y)dxdy = 1 .

The distribution of each of the components of


a random vector alone is referred to as
marginal distribution.

Joint cumulative distribution function


F(x0,y0) = P(X x0 , Y y0) = f(x,y)dydx
x0

y0

That satisifes
P(a X b , c Y d) = abcd f(x,y)dydx
f(x,y) = 2F(x,y)/xy
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

33

Marginal distributions

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Independent random variables

Discrete variables. Given X and Y whose joint


probability mass function is denoted as p(x,y),

Two random variables X and Y are independent


if for any A,BIR,

pX(x) = P(X=x) = yP(X=x,Y=y) = yp(x,y)


pY(y) = P(Y=y) = xP(X=x,Y=y) = xp(x,y)

P((XA)(YB)) = P(XA)P(YB)
Equivalently, for any x,yIR

Continuous variables. Given X and Y whose joint


density mass function is denoted as f(x,y),
+
fX(x) = f(x,y)dy
+
fY(y) = f(x,y)dx

P((X x)(Y y)) = P(X x)P(Y y)


Property. If X and Y are independent,
Var[X+Y] = Var[X]+Var[Y]

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

34

35

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

36

Characteristic features of a rand. vector

Given a function g: IR2 IR, the expectation of


random vector g(X,Y) can be computed as

Expectation. The mean vector of a random vector X


is a column vector each of whose entries is the
expectation of an entry of X

E[ X 1 ]

E[ X 2 ]
E[ X ] =
M

E[ X ]
n

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

(X,Y) discrete, E[g(X,Y)] = g(xi,yj)p(xi,yj)


(X,Y) cont., E[g(X,Y)] = g(x,y)f(x,y)dxdy

37

Characteristic features of a rand. vector


Covariance. The covariance is a measure of
the linear relation between two variables,
Cov(X,Y) = E[(XE[X])(YE[Y])]
Properties:
1.
2.
3.
4.
Ignacio Cascos

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

38

Characteristic features of a rand. vector


Correlation. The correlation is also a measure
of the linear relation between two variables
( X ,Y ) =

Cov(X,Y) = E[XY]E[X]E[Y] ;
if X and Y are independent, Cov(X,Y) = 0 ;
Cov(X,Y) = 0 does not guarantee that X and Y are
independet ;
Cov(aX+b,cY+d)=acCov(X,Y) .
Depto. Estadstica, Universidad Carlos III

Characteristic features of a rand. vector

39

Properties:
1.
2.
3.
4.
Ignacio Cascos

Cov( X , Y )
Var[ X ]Var[Y ]

if X and Y are independent, (X,Y) = 0 ;


if (X,Y) = 0 they are said to be uncorrelated ;
| (X,Y) | 1 ;
| (X,aX+b) | = 1 .
Depto. Estadstica, Universidad Carlos III

40

Characteristic features of a rand. vector

A dartboard is a wooden square of 40cmx40cm. Inside the board


there are several concentric circles, the greater among them
having a diameter of 40cm. The darts of an unskilled player hit
the board at a point that can be described by a random vector
(X,Y) with joint density function

Covariance matrix.
M X = E[( X )( X ) t ]
Cov( X 1 , X 2 )
Var[ X 1 ]

Var[ X 2 ]
Cov( X 2 , X 1 )
MX =
M
M

Cov( X , X ) Cov( X , X )
n
1
n
2

Ignacio Cascos

L Cov( X 1 , X n )

L Cov( X 2 , X n )

O
M

L
Var[ X n ]

Depto. Estadstica, Universidad Carlos III

1 / 1600 if 0 x, y 40
f X ,Y ( x, y ) =
otherwise
0
where (X,Y) represent the coordinates (in centimeters) of the
hitting point. The lower right corner of the board is represented
by the origin, that is, the point (0,0).
41

Example (Dartboard)
Whenever we hit one of the circles, we get some
point. What is the probability of getting some point
from a throw?
What is the mean vector of (X,Y)?, and the
probability that (X,Y) assumes that value?
The inner circle has a diameter of 4cm. What is the
probability of hitting it with a dart?
Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

Example (Dartboard)

43

Ignacio Cascos

Depto. Estadstica, Universidad Carlos III

42

You might also like