decision trees
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 PresentationTRANSCRIPT
![Page 1: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/1.jpg)
Decision Trees
November 18, 2013
![Page 2: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/2.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/3.jpg)
![Page 4: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/4.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/5.jpg)
![Page 6: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/6.jpg)
![Page 7: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/7.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/8.jpg)
North America
China
Start with a decision node…
![Page 9: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/9.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/10.jpg)
Make further decisions…
$30
$30
$40
$40
$40
$50
$40
$50
Sell China
Sell NA
Sell China
Sell NA
![Page 11: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/11.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/12.jpg)
Construct `chance’ trees from leaf nodes…
CC30CC30
Sell 300,000
Sell 400,000
![Page 13: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/13.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/14.jpg)
Calculate average PW
CC30CC30
Sell 300,000
Sell 400,000
PW = 500
PW = 2,000
E(x)=1,250
![Page 15: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/15.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/16.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/17.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/18.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/19.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/20.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/21.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/22.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/23.jpg)
The Monte Carlo Method
![Page 24: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/24.jpg)
![Page 25: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/25.jpg)
Illustrative example:
How to calculate π using a shotgun
![Page 26: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/26.jpg)
Step One: Draw a circle in a square
![Page 27: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/27.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/28.jpg)
Blast the target with your shotgun
![Page 29: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/29.jpg)
Count the number of holes inside the circle and the
number inside the square. Their ratio approximates π/4
![Page 30: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/30.jpg)
In this case, we find that π is about 4 × 10 ⁄ 13 = 3.08
![Page 31: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/31.jpg)
To get an improved estimate, we take more shots
![Page 32: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/32.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/33.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/34.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/35.jpg)
π
![Page 36: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/36.jpg)
π
![Page 37: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/37.jpg)
π
![Page 38: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/38.jpg)
π
![Page 39: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/39.jpg)
Applying Monte Carlo analysis to economic problems:
![Page 40: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/40.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/41.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/42.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/43.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/44.jpg)
First form the cumulative distribution function
Fixed Cost$3M $4M
p(F
ixed
Cos
t < x
)
![Page 45: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/45.jpg)
Then discretize it
x2$3M $4Mx1 x3
p(x<x1)
p(x<x2)
p(x<x3)
![Page 46: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/46.jpg)
Pick z = rnd()
x2$3M $4Mx1 x3
p(x<x1)
p(x<x2)
p(x<x3)
z
![Page 47: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/47.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/48.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/49.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/50.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/51.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/52.jpg)
Cases inBin
Present worth ($000’s)
-500 5500
NN30
![Page 53: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/53.jpg)
Cases inBin
Present worth ($000’s)
-500 5500
NN30
CC30
![Page 54: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/54.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/55.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/56.jpg)
![Page 57: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/57.jpg)
Used to simulate combustion in diesel engines:
![Page 58: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/58.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/59.jpg)
After mixing has taken place, there is a delay for vaporization, thena second delay before combustion starts.
![Page 60: Decision Trees](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/60.jpg)
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](https://reader035.vdocuments.us/reader035/viewer/2022062410/5681586a550346895dc5c878/html5/thumbnails/61.jpg)
The outputs of the process are histograms of various output parameters:
Soot emissions Nox emissions