decision trees

61
Decision Trees November 18, 2013

Upload: moriah

Post on 31-Jan-2016

28 views

Category:

Documents


0 download

DESCRIPTION

Decision Trees. November 18, 2013. Example: we have a machine which may break down at any time over the next three years. We can replace it now, at a cost of $40,000, or we can keep it in service till it breaks. That will cost us $10,000 in lost production, and we will have to pay to - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Decision Trees

Decision Trees

November 18, 2013

Page 2: Decision Trees

Example: we have a machine which may break down at any timeover the next three years. We can replace it now, at a cost of $40,000, or we can keep it in service till it breaks. That willcost us $10,000 in lost production, and we will have to pay tohave it replaced. Every year, there is a 30% chance that the cost of a replacement will go up by $5,000, though we don’texpect there to be more than one such increase in the next threeyears. Our MARR is 20%.

Page 3: Decision Trees
Page 4: Decision Trees

Example: we have a machine which may break down at any timeover the next three years. We can replace it now, at a cost of $40,000, or we can keep it in service till it breaks. That willcost us $10,000 in lost production, and we will have to pay tohave it replaced. Every year, there is a 30% chance that the cost of a replacement will go up by $5,000, though we don’texpect there to be more than one such increase in the next threeyears. Our MARR is 20%.

Page 5: Decision Trees
Page 6: Decision Trees
Page 7: Decision Trees

Your company has developed a new design of mobile phone.You need to decide whether to manufacture and market it inChina or North America.

If you manufacture in China, the fixed costs will be $4,000,000, andthe variable costs per phone will be $15.

If you manufacture in North America, the fixed costs may be anywherefrom $3,000,000 to $4,000,000, and the variable costs per phone willbe between $15 and $20. Shipping across the Pacific will add $10 perphone.

If you sell at $30 in China, you expect to sell 300,000-400,000 units.If you sell for $40, you can expect these figures to be halved. In NorthAmerica, if you sell at $40 you expect to sell 100,000 to 300,000, andthese figures will be halved if you sell at $50.

Page 8: Decision Trees

North America

China

Start with a decision node…

Page 9: Decision Trees

Make further decisions…

Make in China

Make in NA

Sell in China

Sell in China

Sell in NA

Sell in NA

Page 10: Decision Trees

Make further decisions…

$30

$30

$40

$40

$40

$50

$40

$50

Sell China

Sell NA

Sell China

Sell NA

Page 11: Decision Trees

Label leaf nodes…

$30

$30

$40

$40

$40

$50

$40

$50

Sell China

Sell NA

Sell China

Sell NA

NN40NN40

NN50NN50

CC30CC30

Page 12: Decision Trees

Construct `chance’ trees from leaf nodes…

CC30CC30

Sell 300,000

Sell 400,000

Page 13: Decision Trees

Calculate PW (omit (P/F) factors, since they’rethe same on all branches; figures in $000’s)

CC30CC30

Sell 300,000

Sell 400,000

PW = -4,000+300(30-15)= -4,000+4,500= 500

PW = -4,000+400(30-15)= -4,000+6,000= 2,000

Page 14: Decision Trees

Calculate average PW

CC30CC30

Sell 300,000

Sell 400,000

PW = 500

PW = 2,000

E(x)=1,250

Page 15: Decision Trees

Calculate variance and standard deviation

CC30CC30

Sell 300,000

Sell 400,000

PW = 500

PW = 2,000

E(x)=1,250

Var(x) = 0.5 × (1,250-500)2 + 0.5 × (1,250-2,000)2 = 562,500

s.d. = 750

Page 16: Decision Trees

For some leaf nodes, the process is more complicated…

NN40NN40

Fixed cost 300,000

Fixed cost 400,000

VC 15

VC 15

VC 20

VC 20

Sell 100,000

Sell 100,000

Sell 100,000

Sell 100,000

Sell 300,000

Sell 300,000

Sell 300,000

Sell 300,000

Page 17: Decision Trees

NN40

NN40

VC 15

VC 20

Sell 100K

Sell 300KFC 300K

PW=-3,000+100(40-15) = -500

PW=-3,000+300(40-15) = 5,500

Page 18: Decision Trees

NN40

NN40

VC 15

VC 20

Sell 100K

Sell 300KFC 300K

PW=-3,000+100(40-15) = -500

PW=-3,000+300(40-15) = 5,500

FC 400K

PW= -1,000

PW= 3,000

PW= -1,500

PW= 4,500

PW= -2,000

PW= 2,000

Page 19: Decision Trees

NN30

NN30

VC 15

VC 20

Sell 100K

Sell 300KFC 300K

PW= -500

PW= 5,500

FC 400K

PW= -1,000

PW= 3,000

PW= -1,500

PW= 4,500

PW= -2,000

PW= 2,000

E(x) = 1,250Var = 4,570,000s.d. = 2,137

Page 20: Decision Trees

Mark these results on the decision tree

$30

$30

$40

$40

$40

$50

$40

$50

Sell China

Sell NA

Sell China

Sell NA

Mean = 1,250, sd = 750

Mean = 375, sd = 625

Mean = -1,000, sd = 1,500

Mean = -1,500, sd = 1,250

Mean = 1,250, sd = 2,137

Mean = -250, sd = 1,639

Make in China

Make in NA

Page 21: Decision Trees

Mark these results on the decision tree

$30

$30

$40

$40

$40

$50

$40

$50

Sell China

Sell NA

Sell China

Sell NA

Mean = 1,250, sd = 750

Mean = 375, sd = 625

Mean = -1,000, sd = 1,500

Mean = -1,500, sd = 1,250

Mean = 1,250, sd = 2,137

Mean = -250, sd = 1,639

Make in China

Make in NA

Page 22: Decision Trees

The China/China option is mean-variance dominant

$30

$30

$40

$40

$40

$50

$40

$50

Sell China

Sell NA

Sell China

Sell NA

Mean = 1,250, sd = 750

Mean = 375, sd = 625

Mean = -1,000, sd = 1,500

Mean = -1,500, sd = 1,250

Mean = 1,250, sd = 2,137

Mean = -250, sd = 1,639

Make in China

Make in NA

Page 23: Decision Trees

The Monte Carlo Method

Page 24: Decision Trees
Page 25: Decision Trees

Illustrative example:

How to calculate π using a shotgun

Page 26: Decision Trees

Step One: Draw a circle in a square

Page 27: Decision Trees

Note that, if the side of the square is 2, then the area

of the square is 4 and the area of the circle is π

2

Page 28: Decision Trees

Blast the target with your shotgun

Page 29: Decision Trees

Count the number of holes inside the circle and the

number inside the square. Their ratio approximates π/4

Page 30: Decision Trees

In this case, we find that π is about 4 × 10 ⁄ 13 = 3.08

Page 31: Decision Trees

To get an improved estimate, we take more shots

Page 32: Decision Trees

j = 0;

for (i=1; i <= 1000000; i++){

x = rnd();y = rnd();

if ((x2 + y2) < 1) j++;

pi_Estimate = 4 * real(i)/real(j)

}

Page 33: Decision Trees

j = 0;

for (i=1; i <= 1000000; i++){

x = rnd();y = rnd();

if ((x2 + y2) < 1) j++;

pi_Estimate = 4 * real(i)/real(j)

}

In the square

Page 34: Decision Trees

j = 0;

for (i=1; i <= 1000000; i++){

x = rnd();y = rnd();

if ((x2 + y2) < 1) j++;

pi_Estimate = 4 * real(i)/real(j)

}

Is it in the circle?

Page 35: Decision Trees

π

Page 36: Decision Trees

π

Page 37: Decision Trees

π

Page 38: Decision Trees

π

Page 39: Decision Trees

Applying Monte Carlo analysis to economic problems:

Page 40: Decision Trees

Your company has developed a new design of mobile phone.You need to decide whether to manufacture and market it inChina or North America.

If you manufacture in China, the fixed costs will be $4,000,000, andthe variable costs per phone will be $15.

If you manufacture in North America, the fixed costs may be anywherefrom $3,000,000 to $4,000,000, and the variable costs per phone willbe between $15 and $20. Shipping across the Pacific will add $10 perphone.

If you sell at $30 in China, you expect to sell 300,000-400,000 units.If you sell for $40, you can expect these figures to be halved. In NorthAmerica, if you sell at $40 you expect to sell 100,000 to 300,000, andthese figures will be halved if you sell at $50. It will take 2 to 4 yearsto begin manufacture, and your MARR is between 10 and 15%.

Page 41: Decision Trees

Step 1: Build the deterministic model

(this may be a computer program or set of spreadsheetformulae)

PW(NN30) = (Fixed_Cost – Sales(30 -Variable_Cost))(P/F, i, N)

PW(NN40) = (Fixed_Cost – Sales(40 -Variable_Cost))(P/F, i, N)

Do a sample calculation to make sure it works.

Page 42: Decision Trees

Step 2: Decide what the probability distribution is for each random variable:

Fixed Cost

p(F

ixed

Cos

t)

$3M $3.5M $4M

Page 43: Decision Trees

Step 3: The random numbers you are going to generate will be uniformly distributed between 0 and 1.

This is fine if the variable you are modelling happens to be uniformly distributed between 0 and 1, but what if it’s normally distributed between $3M and $4M?

Page 44: Decision Trees

First form the cumulative distribution function

Fixed Cost$3M $4M

p(F

ixed

Cos

t < x

)

Page 45: Decision Trees

Then discretize it

x2$3M $4Mx1 x3

p(x<x1)

p(x<x2)

p(x<x3)

Page 46: Decision Trees

Pick z = rnd()

x2$3M $4Mx1 x3

p(x<x1)

p(x<x2)

p(x<x3)

z

Page 47: Decision Trees

Now if p(x<x2) < z < p(x<x3), X =(x2+x3)/2

x2$3M $4Mx1 x3

p(x<x1)

p(x<x2)

p(x<x3)

z

X

Page 48: Decision Trees

Step 3a: The random numbers you are going to generate will be uniformly distributed between 0 and 1.

This is fine if the variable you are modelling happens to be uniformly distributed between 0 and 1, but what if it’s a discrete random variable?

Page 49: Decision Trees

For example:

``There is a 30% probability that the government will levy a surcharge on phones imported from China.’’

Let z = rnd(); if z > 0.3, no surcharge

Page 50: Decision Trees

In this way, we generate random estimates for eachparameter in the problem. Then we plug these parameters into the deterministic model, and getone possible value of the present worth.

PW(NN30)1 = (Fixed_Cost1 – Sales1(30 -Variable_Cost1))(P/F, i1, N1)

Now do this a thousand times.

PW(NN30)1000 = (Fixed_Cost1000 – Sales1000(30 -Variable_Cost1000))(P/F, i1000, N1000)

PW(NN30)2 = (Fixed_Cost2 – Sales2(30 -Variable_Cost2))(P/F, i2, N2)

.

.

.

Page 51: Decision Trees

What do we do with the 1,000 PW’s?

We create a histogram:

Find highest and lowest PW’s.

Divide the interval between them into N binsof equal size. (N could be 10 or thereabouts)

Count the number of cases in each bin.

Then repeat for other possible strategies

Page 52: Decision Trees

Cases inBin

Present worth ($000’s)

-500 5500

NN30

Page 53: Decision Trees

Cases inBin

Present worth ($000’s)

-500 5500

NN30

CC30

Page 54: Decision Trees

Making a decision:

The histogram provides somewhatmore information than mean + variance.

We may want to choose the strategy thathas no chance of making a loss.

Page 55: Decision Trees

Other applications of the Monte Carlo method:

First used in the Manhattan project

N. Metropolis and S. Ulam, "The Monte Carlo Method", Journal of the American Statistical Association, volume 44, number 247, pp. 335–341 (1949)

Page 56: Decision Trees
Page 57: Decision Trees

Used to simulate combustion in diesel engines:

Page 58: Decision Trees

Start with N1 packets of air andN2 packets of fuel.

Each packet of fuel has anN1/(N1+N2) chance of mixingwith a packet of air.

Page 59: Decision Trees

After mixing has taken place, there is a delay for vaporization, thena second delay before combustion starts.

Page 60: Decision Trees

After combustion starts, each packetof fuel has a certain chance of mixingwith air, and a certain chance of mixingwith an already-combusted packet.

Page 61: Decision Trees

The outputs of the process are histograms of various output parameters:

Soot emissions Nox emissions