You are on page 1of 49

BC2410, Prescriptive Analytics

From Data to Decisions

Lecture 11
Schedule
Schedule
Random Variables
 A random variable is a rule that assigns a numerical value to each
possible outcome of a probabilistic experiment.
A random variable (r.v.) may be discrete or continuous.

Discrete : can only assume values that are distinct and


separate
Example 1 : 0, 1, 2, 3, 4, 5, . . .
Example 2 : 2.0, 2.5, 3.0, 3.5

Continuous : can take on any value within some interval of numbers


Examples : [ 0 , 100 ], [2,
4]
Random Variables
 A random variable is a rule that assigns a numerical value to each
possible outcome of a probabilistic experiment.
A random variable (r.v.) may be discrete or continuous.
Examples

 Total number of points in a throw of 2 dice

 Number of B’s you will score in this semester


 Time between this and the next slide
 Time that you need to wait for buying Xiao Long Bao
 Temperature tomorrow
 Results for 4D/toto
Probability Distribution
 A random variable is a rule that assigns a numerical value to each
possible outcome of a probabilistic experiment.

A probability distribution for a random variable


describes how probabilities are distributed over
the values of the random variable
Probability Distribution
Discrete Probability Distribution
A probability distribution for a discrete random variable X consists of

(i) possible values x1 , x2 , . . . , xn


(ii) corresponding probabilities p1 , p2 , . . . , pn

with the interpretation that

ℙ[X = x1] = p1, ℙ[X = x2] = p2, . . . , ℙ[X = xn] = pn

Note:
Probabilities must sum to 1 : p1 + p2 + . . . + pn = 1.0 (pi ≥0)
Discrete Probability Distribution
 Let X be the random variable that denotes the number of orders for
Boeing 767 aircraft for next year.
 Suppose that the number of orders for Boeing 767 aircraft for next
year is estimated to obey the following distribution:
Orders for Boeing
767 Aircraft next Probability
year
pi
xi
42 0.05
43 0.10
44 0.15
45 0.20
46 0.25
47 0.15
48 0.10
Where do probability distributions come from?
Empirically (from data)
 Example: KFC sells chicken in “buckets” of 2, 3, 4, 8, 12, 16 or 20
pieces. Over the last week, orders for fried chicken had the following
data:
pieces in order orders
2 170
3 200
4 260
8 165
12 120
16 50
20 35
1,000

Let X = number of pieces of chicken in an order.


Develop a probability distribution for X.
Where do probability distributions come from?
Empirically (from data)
 Example: KFC sells chicken in “buckets” of 2, 3, 4, 8, 12, 16 or 20
pieces. Over the last week, orders for fried chicken had the following
data:
pieces in order orders
xi Probability
2 170 2 0.170
3 200
3 0.200
4 260
4 0.260
8 165
8 0.165
12 120
12 0.120
16 50
16 0.050
20 35
20 0.035
1,000

Let X = number of pieces of chicken in an order.


Develop a probability distribution for X.
Visualization of Probability Distributions

A histogram is a display of probabilities as a bar chart

Probability Distribution of the


Number of Orders of Boeing 767 Aircraft Next Year
0.35

0.30

0.25
Probability

0.20

0.15

0.10

0.05

0.00
43 44 45 46 47 48
Number of Orders
Measures of Probability Distributions
 X and Y denote the sales next year in the eastern division and the
western division of a company, respectively.
Probability Distribution Function of Eastern
Eastern Division Division Sales

Sales ($million) 0.40


Probability
0.35
3.0 0.05 0.30

Probability
4.0 0.20 0.25
0.20
5.0 0.35
0.15
6.0 0.30 0.10
7.0 0.10 0.05
8.0 0.00 0.00
3.0 4.0 5.0 8.0
6.0
7.0
Sales ($ million)
Probability Distribution Function of Western
Western Division Division Sales

Sales($million) 0.40
Probability 0.35
3.0 0.15 0.30

Probability
0.25
4.0 0.20
0.20
5.0 0.25
0.15
6.0 0.15 0.10
7.0 0.15 0.05

8.0 0.10 0.00


3.0 4.0 5.0 8.0
6.0
7.0
Sales ($ million)
Measures of Probability Distributions
 Summary statistics are used to summarize a set of observations, in
order to communicate the largest amount as simply as possible.

Statisticians commonly try to describe the observations in


 a measure of location, or central tendency, such as the mean, median,
mode etc
 a measure of statistical dispersion like the standard deviation,
variance, range etc
 a measure of the shape of the distribution like skewness or kurtosis
Mean of Probability Distributions
Suppose the discrete r.v. X has probability distribution

x1 , x2 , . . . xn
,
p1 , p2 , . . . pn
,

The mean (or expected value) of X is


Variance of Probability Distributions
Suppose the discrete r.v. X has probability distribution

x1 , x2 , . . . xn
,
p1 , p2 , . . . pn
,

The variance of X is
Discrete Probability Distribution
 X and Y denote the sales next year in the eastern division and the
western division of a company, respectively.
Probability Distribution Function of Eastern
Eastern Division Division Sales

Sales ($million) 0.40


Probability
0.35
3.0 0.05 0.30

Probability
4.0 0.20 0.25
0.20
5.0 0.35
0.15
6.0 0.30 0.10
7.0 0.10 0.05
8.0 0.00 0.00
3.0 4.0 5.0 8.0
6.0
7.0
Sales ($ million)
Probability Distribution Function of Western
Western Division Division Sales

Sales($million) 0.40
Probability 0.35
3.0 0.15 0.30

Probability
0.25
4.0 0.20
0.20
5.0 0.25
0.15
6.0 0.15 0.10
7.0 0.15 0.05

8.0 0.10 0.00


3.0 4.0 5.0 8.0
6.0
7.0
Sales ($ million)
Measures of Probability Distributions
 X and Y denote the sales next year in the eastern division and the
western division of a company, respectively.
Probability Distribution Function of Eastern
Eastern Division Division Sales

Sales ($million) 0.40


Probability
Mean 5.20 3.0 0.05
0.35
0.30

Probability
4.0 0.20 0.25
Variance 1.06 5.0 0.35
0.20
0.15
6.0 0.30
Std Dev 1.0296 7.0 0.10
0.10
0.05
8.0 0.00 0.00
3.0 4.0 5.0 8.0
6.0
7.0
Sales ($ million)
Probability Distribution Function of Western
Western Division Division Sales

Sales($million) 0.40
Probability 0.35

Mean 5.25 3.0 0.15 0.30

Probability
0.25
4.0 0.20
Variance 2.3875
0.20
5.0 0.25
0.15
6.0 0.15 0.10

Std Dev 1.5452 7.0 0.15 0.05

8.0 0.10 0.00


3.0 4.0 5.0 8.0
6.0
7.0
Sales ($ million)
Covariance and Correlation
 How do we summarize the relationship between two variables? Specifically : how
do we summarize what we observe in a scatter plot?
 Examples:

Unemployment rate vs. Crime rate

Stock market vs. Property market

Time spent on BC2410 vs. BC2410 exam marks


Covariance and Correlation
 Example: Starbucks sells gourmet hot coffees and cold beverages. From past sales
data, daily sales at North Spine obey the following probability distribution for (X, Y),
X = # hot coffees, Y = # cold beverages sold per day

Probability No. of Hot Coffees Sold No. of Cold Drinks Sold


pi xi yi
0.10 360 360
0.10 790 110
0.15 840 30
0.05 260 90
0.15 190 450
0.10 300 230
0.10 490 60
0.10 150 290
0.10 550 140
0.05 510 290
Mean 444 205
Standard Deviation 244.62 145.72
Covariance and Correlation

900

800

700 From the plot, we can conclude that


600

500
the sales of hot coffees and the sales of
400 cold beverage are negatively related.
300

200

100 Is it correct?
0
1 2 3 4 5 6 7 8 9 10

Series1 Series2
Covariance and Correlation
We now define the covariance of two random variables X
and Y with means μX and μY :
Probability X Y
ℙ[X = x1, Y = y1 ] x1 y1
ℙ[X = x2, Y = y2 ] x2 y2
… … …
ℙ[X = xN, Y = yN ] xN yN

Covariance
Covariance and Correlation
Covariance

Observe from the above that:


Covariance and Correlation
 Example: Starbucks sells gourmet hot coffees and cold beverages. From past sales
data, daily sales at North Spine obey the following probability distribution for (X, Y),
X = # hot coffees, Y = # cold beverages sold per day

Probability No. of Hot Coffees Sold No. of Cold Drinks Sold


pi xi yi
0.10 360 360
0.10 790 110
0.15 840 30
0.05 260 90
0.15 190 450
0.10 300 230
0.10 490 60
0.10 150 290
0.10 550 140
0.05 510 290
Mean Cov[X,Y] = -27195
444 205
Standard Deviation 244.62 145.72
The bigger the covariance is, the
stronger the relationship is.

Is it true?
Covariance and Correlation
 Example: Starbucks sells gourmet hot coffees and cold beverages. From past sales
data, daily sales at North Spine obey the following probability distribution for (X, Y),
X = # hot coffees, Y = # cold beverages sold per day

Probability No. of Hot Coffees Sold No. of Cold Drinks Sold


pi xi yi
0.10 36 36
0.10 79 11
0.15 84 3
0.05 26 9
0.15 19 45
0.10 30 23
0.10 49 6
0.10 15 29
0.10 55 14
0.05 51 29
Mean Cov[X,Y] = -271.95
44.4 20.5
Standard Deviation 24.462 14.572
Covariance and Correlation
Covariance

We introduce a standardized measure of interdependence between two rv’s :

Correlation

Properties :
• The measure of correlation is unit-free.
• Corr[X, Y] is always between -1 and 1
Covariance and Correlation

Correlation

Corr[X,Y] = 1.0 perfect positive linear relationship

= 0 no linear relationship between X and Y

= - 1.0 perfect negative linear relationship


Covariance and Correlation

If higher than average values of X are apt to occur with higher than
average values of Y, then Cov[X, Y ] > 0 and Corr[X, Y ] > 0.
X and Y are positively correlated.

If higher than average values of X are apt to occur with lower than
average values of Y, then Cov[X, Y ] < 0 and Corr[X, Y ] < 0.
X and Y are negatively correlated.
Covariance and Correlation
 Example: Starbucks sells gourmet hot coffees and cold beverages. From past sales
data, daily sales at North Spine obey the following probability distribution for (X, Y),
X = # hot coffees, Y = # cold beverages sold per day

Probability No. of Hot Coffees Sold No. of Cold Drinks Sold


pi xi yi
0.10 360 360
0.10 790 110
0.15 840 30
0.05 260 90
0.15 190 450
0.10 300 230
0.10 490 60
0.10 150 290
0.10 550 140
0.05 510 290 Cov[X,Y] = -27195
Mean 444 205 Corr[X,Y] = -0.7629
Standard Deviation 244.62 145.72
Do you know how to build a portfolio based on
historical stock data?
Real Data---Historical Data

#
*

*
The adjusted closing price amends a stock's closing price to reflect that stock's value after accounting for any corporate actions.
#
The closing price is the raw price, which is just the cash value of the last transacted price before the market closes.
Classical Portfolio Selection
Markowitz Portfolio Optimization
 Objective: Minimize total portfolio variance so that
• Expected reward of total portfolio is above target β
• Total amount invested stay within our budget
• No short sales
Generalization of Portfolio Variance
Generalization of Portfolio Variance
Generalization of Portfolio Variance (Optional)
 is known as the covariance matrix, which has the following
properties:
• It is a symmetric matrix
• It is a positive definite matrix,

• The eigenvalues of are real and positive.


• There exists real matrix A such that = AA
Covariance Matrix from Data
 Let be a matrix that contains the stock returns of N stocks over T
periods. In particular, denotes the return of stock i at period t.
Covariance Matrix from Data
Compact form of Portfolio Selection Problem
Quadratic Optimization Problems (Optional)
Another Portfolio Selection Problem (Optional)
 Objective: Maximize probability that portfolio returns exceeds target β
 Expected reward of portfolio above β
 Total investment stays within budget B
 No short sales
 Assume returns are normally distributed
Another Portfolio Selection Problem (Optional)
Sharpe Ratio (Optional)
Another Portfolio Selection Problem (Optional)
Another Portfolio Selection Problem (Optional)
Another Portfolio Selection Problem (Optional)
Another Portfolio Selection Problem (Optional)
Another Portfolio Selection Problem (Optional)

You might also like