Uploaded by Ong Ming Xia

NUS DAO1704 Decision Analytics using Spreadsheets Cheatsheet

advertisement
UNIT 1_Basic Probability
Expt: “randomly choosing a student” All possible
outcomes: “any student in the room” Event: “Student
chosen is a male”
P(A or B) = P(A) + P(B) – P(A and B)
{Mutually Exclusive: P(A and B) = 0}
P(𝐴∩𝐡) = P(𝐴|𝐡)𝑃(𝐡) [𝑃(𝐴∩𝐡) -> fulfil both conditions]
[Independent]:
P(A|B) = P(A) or P(B|A) = P(B)
P(𝐴∩𝐡) = P(A)P(B)
Geologists will predict an earthquake on 95% of occasions
for which earthquake occur’ mean P(ElP) or P(PlE)
[because earthquake is bound to happen already but its
whether geologist can predict]
Sensitivity
= P(test +ve if disease is present)
= P(test +ve | has disease)
Positive Predictive Value = P(has disease if tested +ve)
= P(has disease | test +ve)
Specificity
= P(test -ve if disease is absent)
= P(test -ve | disease absent)
BAYES’ THEOREM
𝑃(𝐴𝑖|𝐡)=
"($! ∩&)
"(&)
P(Ai∩B) = P(B|Ai)P(Ai)
If P(A|B) = 0.1, P (C |B) = 0.9
Given 1 – A = C (change the front one)
"(B)A*"(&)
𝑃(𝐴|𝐡)=
"(+)
UNIT 2_(Discrete) Probability Distributions
2.1 Discrete R.V.
.
E(X) = πœ‡, = - 𝑝- π‘₯.
Var(X) =
𝜎,1
-/0
= - 𝑝- (π‘₯- − πœ‡, )1
-/0
2.2 Binomial Distributions
1) n independent trials, 2) each trial has 2 outcomes 3)
each trial has same probability - success p, failure 1-p
BINOM.DIST (x, n, p, cum) : FALSE - 𝑃(𝑋=π‘₯); TRUE- 𝑃(𝑋≤π‘₯)
E(X) = πœ‡, = 𝑛𝑝 | π‘‰π‘Žπ‘Ÿ(𝑋) = 𝜎,1 = 𝑛𝑝(1 − 𝑝)
2.2 Poisson Distributions
1) Probability of occurrence is the same for any 2 intervals
of equal length (time/space)
2) Occurrences in nonoverlapping intervals are
independent of one another.
POISSON.DIST (x, λ, cum) : FALSE - 𝑃(𝑋=π‘₯); TRUE- 𝑃(𝑋≤π‘₯)
X~P(λ)
mean = E(X) = λ | π‘‰π‘Žπ‘Ÿ(𝑋) = λ
parameter λ is avg no. of occurrences per unit time or
space (unit time is the time frame they ask you)
*No negative in poisson – time scale
UNIT 3 – Functions
1 Variable (X):
2 Variables (X&Y):
E(aX+bY) = aE(X)+bE(Y)
E(aX+b) =
aE(X)+b
Var(aX+b) =
π‘Ž2Var(X)
Var(aX+bY) =
a2Var(X)+b2Var(Y)+2abCov(X,Y)
a2Var(X)+b2Var(Y)+2ab𝜎x𝜎yCorr(X,Y)
*applicable to discrete + continuous
If X&Y are independent, Cov(X,Y) = 0
Covariance
Cov(X,Y) = E[(X-πœ‡ x)(Y—πœ‡ y)]
~
Sumproduct(Probabilities,X-u,Y-u)
= ∑ 𝑃(𝑋 = π‘₯- , π‘Œ = 𝑦- )[(π‘₯- − πœ‡, )Eπ‘₯- − πœ‡2 F]
Large no. will result in large Cov -> absolute value is not an
indicatory of strength or relation
Correlation
~ unit free; -1 < corr < 1
[=1] perfectly +ve: linear r/s | [=0] no linear r/s | [=-1]
perfect -ve: linear r/s
~ If higher avg values of X are apt to occur with higher avg
values of Y, then Cov(X,Y)>0, Corr (X,Y)>0, X & Y are
positively correlated.
~ If higher avg values of X are apt to occur w lower avg
values of Y, Cov(X,y)<0, Corr(X,Y)<0, X & Y are negatively
correlated.
~ Cov(X, Y) = Cov(Y, X) = E(XY)- πœ‡, πœ‡2
~ Cov(X, X) = Var(X)
Independent Joint Distribution
𝑃(𝑋=π‘₯,π‘Œ=𝑦) = 𝑃(𝑋=π‘₯)𝑃(π‘Œ=𝑦)
𝐸(π‘‹π‘Œ) = 𝐸(𝑋)𝐸(π‘Œ)
πΆπ‘œπ‘£(𝑋,π‘Œ) = 0 or πΆπ‘œrr(𝑋,π‘Œ) = 0
-Independent r.v. are always uncorrelated, but dependent
r.v. may also be uncorrelated
-Linearly related r.v. are perfectly correlated
UNIT 4_(Continuous) Probability Distributions
for continuous.
3
3
πœ‡ = ∫43 π‘₯𝑓(π‘₯)𝑑π‘₯ | 𝝈2 = ∫43(π‘₯ − µ)1 𝑓(π‘₯)𝑑π‘₯
4.1 Uniform Distributions
X is “uniform” on [a,b] if X is
equally likely to take any
value in the range from a to
b. (b>a): X~U[a,b]
PDF of X: F(t) =
CDF of X: F(t) =
E(X) =
0
647
847
647
796
1
if a ≤ t ≤ b, otherwise 0
if a ≤ t ≤ b, otherwise 0
| Var(X) =
(647)"
01
4.2 Exponential Distribution
Usually for waiting line. Conditions: must occur
independently. Occurred in a specific period of time. Must
have consistent units.
EXPON.DIST(x, 𝝀, cum), where 𝝀 is the rate parameter
PDF 𝑓(π‘₯) = πœ†π‘’−πœ†π‘₯ [π‘₯>0]
CDF 𝐹(π‘₯) = 1−𝑒−πœ†π‘₯
0
Mean = 𝐸(𝑋)=
<
0
π‘‰π‘Žπ‘Ÿ(𝑋)= "
<
In the case of stock out, if mean waiting time per
occurrence = 1/3 , 𝝀 = 3
As such, x= waiting time per occurrence. Since need wait 2
days then restock, x =2
4.3 Normal Distribution
𝑋~𝑁(πœ‡,𝜎)
smaller σ = taller curve, bigger σ = short curve
when multiplied with eg n, πœ‡=π‘›πœ‡ , 𝜎=√π‘›πœŽ
~ Symmetric around the mean
~ Highest at its mean
NORM.DIST(𝒙,𝝁,𝝈,π’„π’–π’Ž)
NORM.INV(𝒑,𝝁,𝝈)
*given p, u, 𝜎 , find x value)
NORM.S.DIST(z, TRUE/FALSE) {πœ‡=0,
𝜎=1}
*given x value, compute p to find u, 𝜎
NORM.S.INV(p)
*given p, compute x value to find u, 𝜎
Unit 5 Optimisation
Excel Modelling:
Highlight “Decision Variables” cell [QTY] > Use
SUMPRODUCT for “Profit” > “Amt needed for each
resources” = SUMPRODUCT -> amt available & amt
needed forms constraint.
SOLVER-> Set OBJECTIVES = profit > by changing qty > set
CONSTRAINTS available qty >= amt needed > SOLVER LP
(solving method)
UNIT 5: Decision Tree
Expected Monetary Value (EMV): weighted average of all
possible payoffs for this decision.
Expected Value Of Perfect Information (EVPI):
EVPI = Max EMV with PI (low risk -> sell, high risk -> no
sell)
– Max EMV w/o additional info (not perfect)
> Must include Cost of i.e Market survey for each relevant
payoff at the end
Expected Value of Sample Information (EVSI):
EVSI = Max EMV with Sample Information (including the
cost) + the cost of your survey (negate the cost)
– Max EMV without additional information
UNIT 6: Linear Programming
1)Decision Variables: each decision variable forms a
dimension. n decision variables define an n-dimensional
space. A solution is a point in the space.
2)Constraints: each inequality constraint defines a hyperplane(line in a 2D space). Each inequality constraint
defines a half space. All constraints collectively define the
feasible region.
3)Objective: The objective function defines isoquants and
a direction in the space.
To finding the optimal soln, push along the direction
defined by the objective until we reach the boundary of the
feasible region.
max π‘₯# + π‘₯$
𝑠. 𝑑. π‘₯# + 2π‘₯$ ≤ 3
2π‘₯# + π‘₯$ ≤ 3
π‘₯# , π‘₯$ ≥ 0
X1+X2=0, then shift, X1+X2=1, X1+X2 =2 (objective
function quantity [rhs] )
Slack = max difference in constraint quantity (RHS) before
non-binding become binding
Infeasible Problem: Empty Feasible region Isoquant: A line
on which all points have the same objective value; all
points are equally good on the objective function.
Optimal solution may not be unique (lie on whole stretch of
extreme region), may not be finite(whole feasible region)
Redundant Constraint: Add/Remove constraint does not
affect feasible region
Binding constraints: constraints that are satisfied at
equality at the optimal solution. All equality constraints are
binding by definition. Non-binding constraints are satisfied
at strict inequality at the optimal solution. At optimal
solution, some constraints are binding while others are
not.
The inequality level (=RHS-LHS constraints) is known as
the slack. Binding constraints have zero slack by
definition.
3
#
𝐷
! π‘₯!" = 𝑑" π‘“π‘œπ‘Ÿ 𝑗 = 𝐴, 𝐡, 𝐢, 𝐷 <=> π‘šπ‘–π‘› ! ! 𝑐𝑖𝑗 π‘₯𝑖𝑗
𝑖=1 𝑗=𝐴
!$%
UNIT 9: DISCRETE OPTIMIZATION
9.1 Common Uses of Binary Variables
All or Nothing can occur
π‘₯1 = π‘₯0
π‘₯0 , π‘₯1 π‘π‘–π‘›π‘Žπ‘Ÿπ‘¦
For 3 events: π‘₯0 = π‘₯1 =
π‘₯=
𝑍≤𝑋
UNIT 7: SENSITIVITY ANALYSIS
If X is not selected, then Z
cannot be selected
If X and Y are selected,
𝑋+π‘Œ−1≤𝑍
then Z must be selected
If neither X nor Y is
1−𝑋−π‘Œ ≤𝑍
selected, then Z must be
selected
At most two of the three
𝑋+π‘Œ+𝑍 ≤2
projects can be selected
If either X or Y or both is
(2 − 𝑋 − π‘Œ)/2 ≥ 𝑍
selected, then Z cannot be
selected
X is selected only if both Y
𝑋 ≤ (π‘Œ + 𝑍)/2
and Z are selected
Introduce 1/M (Binary P1 will never exceed 1)
P1 >= {X11+X12+X13}/M
Remember that binary only has 0/1 so if we have
inequality value of ½ → 1
B. Change in constraint
Changing π’ƒπ’Š (constraint quantity) shifts the corresponding
constraint. The optimal solution change when constraint is
binding. Binding constraints will NOT change if within the
sensitivity range (range whereby binding constraint
remains as binding constraint). Use the shadow price to
estimate the impact on the objective value. Non-binding
constraint -> Shadow price 0
Changing π’‚π’Šπ’‹ (constraint coefficients) rotates the
corresponding constraint. Optimal solution, objective
value, binding constraint will be affected. No sensitivity
range here.
Shadow Price: the marginal change of the objective value
bcos of an additional unit of resource or requirement. Only
valid in the sensitivity range.
UNIT 8: OPTIMIZATION
Include assumptions, if need be.
key components:
Decision Variables –[variables can be grouped if there are
any complementing patterns]
Constraints – Linear, Non-negativity Constraint, Capacity,
Resource Constraint, Binary Constraint (Only for Integer
Programming).
* Simplify expression to just LHS
Inequality Sign
Fulfilled → >= Max Sold → <=
Know the difference between optimal decision/solution
(Deliver 800 from plant1 to shop2, 900 to shop4) and
optimal objective/value i.e (27200)
Standard formation of optimization models
Writing out standardization
*Always link decision variable with binary variable
&
i=1,2..5,
where M is a large
enough number i.e.
1000
OTHER EXCEL FORMULAS
SUMPRODUCT(A2:D69,F2:J69)
RAND( ), AVERAGE(b11:b41), STDEV.P(b11:b41),
VLOOKUP(lookup_value, table array(a2:d66), col
no(column from table array), [true/false[exact]),
COUNTIF(range, “criteria”), MAX(number 1, number 2…),
ROUND(number, 1/2/-1/-2)
-1 -> 10th Place -10 -> 100TH place 1 -> 1 dp
Lock Excel Formulas $B$4
Download