Mod 4 Risk and Uncertainty
Mod 4 Risk and Uncertainty
• Technological (the biggest source, e.g., mixing old and new technologies),
• socio-human (e.g., How do your team members learn and use information?)
Goals
• Goals in software engineering economics are mostly business goals (or
business objectives).
Components of Estimates:
Effort Estimation: Calculating the amount of work required to complete a task or project.
Cost Estimation: Evaluating the financial resources required for the project.
Application Areas:
Software Engineering Management KA: Focuses on effort, schedule, and cost estimation to manage
software projects effectively.
Software Maintenance KA: Involves maintenance cost estimation to plan and manage ongoing
support and updates for the software.
Estimates
• Estimates are typically internally generated and are not necessarily
visible externally.
Internal Estimates: Your construction team calculates how much time and
money it will take, but they don’t share every detail with the neighbors.
Avoid Over-Optimism: If you only focus on the goal of finishing the house
in 6 months, you might ignore bad weather, supply shortages, or worker
availability. A good estimate considers these challenges.
Revise Estimates: As construction progresses, you realize the foundation took
longer than expected. You update your timeline and budget to reflect this new
information, ensuring the project stays realistic.
Plans
• A plan describes the activities and milestones that are necessary to reach the goals
of a project.
• The plan should align with the goal and the estimate, which is not necessarily easy
and obvious— such as when a software project with given requirements would take
longer than the target date expected by the client.
• In such cases, plans demand a review of initial goals, estimates, and the underlying
uncertainties and inaccuracies. Creative solutions are applied to resolve conflicts
with the underlying rationale of achieving a win-win position.
Goals, Estimates, and Plans
Estimation Techniques
• Estimations are used to analyze and forecast the resources or time necessary to
implement requirements.
• Estimation techniques exist:
• Expert judgment
• Analogy
• Top-down estimate
• Bottom-up estimate
• Three-point estimates
• Parametric methods
Expert judgement
• One or more experts in both software development and the application
domain use their experience to predict software costs. Process iterates until
some compromise is reached.
• Advantages:
• Calculate Estimates
Estimation by analogy
Estimation by analogy
• Advantages: Accurate if project data is available
Aggregate Estimates
Add up the estimates from historical data and experts to determine the total
expected budget and duration.
Develop Schedule
Map out major milestones and phases in a master schedule showing the
sequence of work.
• It's similar to bottom-up estimating but more accurate and can better be used
at a high level as well.
Three-point estimates
• The 3-point estimate, also known as the PERT (Project Evaluation and Review
Technique), provides a range of project estimates and calculates the weighted
average of that range. This means that 3 data points, the “best case”, “most
likely case” and the “worst case”, must always be provided for each part of the
estimate.
Three Data Points:
Best Case (Optimistic Estimate - O): The minimum time, cost, or effort required if
everything goes perfectly.
Most Likely Case (Realistic Estimate - M): The most probable time, cost, or effort
required under normal conditions.
Worst Case (Pessimistic Estimate - P): The maximum time, cost, or effort required if
significant issues or delays occur.
Parametric methods
• Parametric estimating is a statistical and accuracy-based technique for calculating
• Often used during a project or in the project planning phase, parametric estimating
applies a formula or algorithm for making these calculations, using the specific cost
Once you have determined your formula, you can use it as a template to model future project
estimations, making adjustments to variables as needed in subsequent project
Estimation Techniques
• No single estimation technique is perfect, so using multiple estimation techniques is
useful.
• Spread among the estimates indicates that certain factors might have been
overlooked.
• Finding the factors that caused the spread and then re-estimating again to produce
results that converge could lead to a better estimate.
Example
Let's say your project is to install new anti-viral software on 105 –(desktops, routers, and outdated OS)
devices at your client's location. You may have a fixed price for the software cost but need to estimate the
time duration and installation cost. However, your team can install software on routers 5% faster than a
computer installation, but outdated operating systems require 15% more effort. So, you may break down
your estimate accordingly to get an accurate appraisal. (75 desktop, 5 routers ,25 OS)
With the number of devices and other variables determined, you may identify anomalies related to increased
resource use.
Based on historical data, you know it takes 30 minutes per device. If you used analogous cost estimating,
you'd multiply the 105 devices by 30 minutes to get an estimate of 3,150 minutes or 52 hours, 30 minutes.
Solution
• Identify Device Types and Numbers:
• 75 desktops
• 5 routers
• Outdated OS: Takes 15% more effort, so they take 30×1.15=34.530 minutes per device.
Solution
Calculate Time for Each Device Type:
Desktops: 75×30=2250 minutes
Routers: 5×28.5=142.55 minutes
Outdated OS: 25×34.5=862.5 minutes
Convert to Hours:
3255 minutes is approximately
=3255/60
=54 hours and 25 minutes
Solution
Analyze and Adjust:
Now that you have a detailed breakdown, you can identify any anomalies or
factors that could increase resource use and adjust your estimate accordingly.
Addressing Uncertainty
• Because of the many unknown factors during project initiation and planning,
estimates are inherently uncertain;
Rank your tasks based on their importance and urgency. Focus on completing
the highest-priority tasks first.
Regularly review your priorities and adjust them as needed. Priorities can
change based on new information or shifting goals
Prioritization
• Prioritization involves ranking alternatives based on common criteria to
deliver the best possible value.
• For example, the number 1 can mean that the requirement is the most important and the
number n can be assigned to the least important requirement, n being the total number of
requirements.
• This method works best when you are dealing with a single stakeholder as it can be difficult
to align different stakeholders’ perspectives on what the priority of a requirement should be;
taking an average can however, address this problem to some extent.
Example
Tasks: Task A, Task B, Task C
Person 1 Rankings: Task A (1), Task B (2), Task C (3)
Person 2 Rankings: Task A (2), Task B (1), Task C (3)
Average Ranking:
Task A: (1+2)/2 = 1.5
Task B: (2+1)/2 = 1.5
Task C: (3+3)/2 = 3
Tasks A and B are tied in importance based on the average ranking.
Prioritization Techniques
Numerical Assignment (Grouping)
• This method is based on grouping requirements into different priority groups with
each group representing something stakeholders can relate to. For example,
requirements can be grouped into
• critical priority,
• optional priority.
• These groups should be clearly defined so that stakeholders do not have a different
understanding of each during the prioritization exercise.
• One disadvantage to this, however, is the fact that requirements in each group will
then have the same priority with no unique priority assigned per requirement.
Example
Imagine you’re organizing a school event:
Critical Priority: Booking the venue and inviting guests.
Moderate Priority: Arranging food and setting up equipment.
Optional Priority: Adding decorations and planning extra activities.
Stakeholder:
If you ask teachers (stakeholders) what’s most important:
Teacher 1: Venue (compulsory), food (very important), decorations (optional).
Teacher 2: Guests (compulsory), equipment (very important), extra activities
(not important).
This helps you understand what everyone thinks is most important and plan
accordingly.
Prioritization Techniques
MoScoW Technique
• Instead of numbers, this method uses four priority groups:
MUST have, SHOULD have, COULD have, and WON'T have.
• With this technique, stakeholders can prioritize requirements in a collaborative fashion.
• The acronym represents the following:
• MUST (Mandatory)
• SHOULD (Of high priority)
• COULD (Preferred but not necessary)
• WOULD (Can be postponed and suggested for future execution)
• The decisions of stakeholders on requirements' priorities are categorized as shown above
Example-develop a mobile app
If you find out that one requirement should have greater priority over the other, you
swap them accordingly.
You then continue in this fashion until the very last requirement is properly sorted.
• All stakeholders get a conceptual 100 dollars, which they can distribute among the requirements. As such, the
stakeholder may choose to give all 100 dollars to a single requirement, or the person may distribute the points
more evenly.
• The higher the amount allocated to each requirement, the higher the priority of the requirement.
• At the end, the total is counted and the requirements are sorted based on the number of points received.
• This technique should only be used when you have a small group of requirements to prioritize and when you
have the same set of requirements to prevent respondents from influencing their results by assigning more
dollars to their favourite requirement.
Example
The following requirements for a software project:
Requirement A: User Authentication
Requirement B: Reporting and Analytics
Requirement C: Mobile App Integration
A software engineering team is deciding which DBMS to use for a new project. The options are:
MySQL
PostgreSQL
MongoDB
MySQL: 0.60 (Ease of Use) + 0.50 (Cost) + 0.40 (Performance) + 0.30 (Scalability) = 1.80
PostgreSQL: 0.80 (Performance) + 0.70 (Scalability) + 0.50 (Ease of Use) + 0.40 (Cost) =
2.40
MongoDB: 0.90 (Scalability) + 0.70 (Performance) + 0.30 (Ease of Use) + 0.20 (Cost) =
2.10
Decision:
The results show PostgreSQL as the best choice with the highest score of 2.40.
Decisions under Risk
• Decisions under risk techniques are used when the decision maker can
assign probabilities to the different possible outcomes
For example, imagine you have a rigged coin that flips heads 30% of the time, and tails 70% of
the time. If it comes up heads, you get $100. If it comes up tails, you get nothing. The expected
value of the coin flip is 30% times $100 or $30. If you take this bet 100 times in a row, over time,
you’ll make about $3,000—roughly $30 per toss.
Decisions under Risk
Both outcomes can have payoffs attached.
Let’s change the game a bit. If heads gives you $100 and tails gives you $20, you can
calculate the average value of one bet. If you play this game 100 times, you'd earn about
$4,400 in total?
Heads probability = 30% or 0.3, payout = $100 → Expected value from heads = $100 ×
0.3 = $30.
Tails probability = 70% or 0.7, payout = $20 → Expected value from tails = $20 × 0.7
= $14.
So, the total expected value per bet is $30 + $14 = $44.
If you repeat this bet 100 times, the total payout would be approximately $44 × 100 =
$4,400.
Decisions under Risk
• To measure the risk associated with a decision, several statistical characteristics of the
This formula helps you find the average value of all possible outcomes if the decision or
experiment were repeated many times..
Expectation variance and decision making
When making decisions under risk, it’s important to not only consider the expected value
but also the variability (or risk) associated with possible outcomes. Variance helps you
measure this variability.
The formula for Variance:
To calculate the variance (σ2) of a probability distribution, you can use the following
formula:
Where:
σ2 is the variance.
Xi is the ith outcome.
pi is the probability of the ith outcome.
E is the expected value.
n is the total number of possible outcomes.
∑ (Sigma) denotes the summation of all the products of probabilities and the squared
differences between the outcomes and the expected value.
a. Calculate the expected sales for both of these probability distributions.
E(Sales A ) and E(Sales B )
E(Sales_A)= (100 * 0.20) + (200 *0.40) + (300 * 0.20) + (400 * 0.15) + (500 * 0.05) $
E(Sales_A) = 20 + 80 + 60 + 60 + 25 = 245
Distribution B:
Probabilities: 0.05, 0.20, 0.50, 0.20, 0.05
E(Sales_B) = (100 * 0.05) + (200 * 0.20) + (300 * 0.50) + (400 * 0.20) + (500 * 0.05) $
E(Sales_B) = 5 + 40 + 150 + 80 + 25 = 300
Variance (σ2):
Distribution A:
E(SalesA)=245
σ2 _A = (0.20 * 21025) + (0.40 * 2025) + (0.20 * 3025) + (0.15 *4025) + (0.05 *65025) $
Distribution B:
E(Sales_B)= 300
σ2 _B = (0.05 * (100 - 300)^2) + (0.20 * (200 - 300)^2) + (0.50 * (300 - 300)^2) +
(0.20* (400 - 300)^2) + (0.05 * (500 - 300)^2) $
• If this risk occurs, how will it affect the schedule or the cost of the project?
• Monte Carlo gives you a range of possible outcomes and probabilities to allow
you to consider the possibility of different scenarios.
Monte Carlo analysis
• Simulation uses a representation or model of a system to analyze the expected
behavior or performance of the system.
• To use a Monte Carlo simulation, you must have three estimates (most likely,
pessimistic, and optimistic) plus an estimate of the likelihood of the estimate
being between the most likely and optimistic values.
Steps of a Monte Carlo Analysis
1. Assess the range for the variables being considered
2. Determine the probability distribution of each variable
3. For each variable, select a random value based on the probability
distribution
4. Run a deterministic analysis or one pass through the model
5. Repeat steps 3 and 4 many times to obtain the probability distribution of
the model’s results
Monte Carlo analysis
• For example, let’s say you don’t know how long your project will take.
You have a rough estimate of the duration of each project task. Using this,
• Using this information, you can now better estimate your timeline and plan your project.
Monte Carlo analysis – Benefits & Limitations
Benefits
• Provides early indication of how likely you are to meet project milestones and deadlines.
• Can be used to create a more realistic budget and schedule.
• Predicts the Chances of schedule and cost overruns
• Quantifies risks to assess impacts
• Provides objective data for decision making.
Limitations
• You must provide three estimates for every activity or factor being analyzed.
• The analysis is only as good as the estimates provided
• The Monte Carlo simulation shows the overall probability for the entire project or a large
subset (such as a phase). It can’t be used to analyze individual activities or risks.
Expected Value of Perfect Information
The expected value of perfect information is the price that a healthcare
decision maker would be willing to pay to have perfect information
regarding all factors that influence which treatment choice is preferred as
the result of a cost-effectiveness analysis.
Expected Value of Perfect Information
• Expected Value with Perfect Information (EVPI) is a concept in decision-
making. It helps us understand the value of having perfect information
about future events before making decisions.
• Without perfect information, you have to make a decision based on probabilities (e.g., a
60% chance of rain). Sometimes you might bring an umbrella unnecessarily, or get wet
because you didn't bring one.
• With perfect information, you would always make the right decision (bring an umbrella
if it will rain, don't if it won't). This saves you from making mistakes.
• EVPI calculates the difference between the value of decisions made with perfect
information and decisions made with imperfect information.
Expected Value of Perfect Information
Suppose the probabilities for S1 is 0.3 , S2 is 0.5, S3 is 0.2
=0.3(12)+0.5(9)+0.2(13) = 10.7
=0.3(15)+0.5(11)+0.2(8)= 11.6
=0.3(5)+0.5(18)+0.2(10)=12.5
EVwpI=0.3(5)+0.5(9)+0.2(8)= 7.6
Bonds=0.2(40)+0.50(45)+0.3(5)=32.0
Stocks=0.2(70)+0.50(30)+0.3(-13)=25.1
Mutual Funds=0.2(53)+0.50(45)+0.3(-5)=31.6
To calculate the Expected Value of Perfect Information(EVPI):
EVPI=EVwPI-EVwoPI
EVwPI=0.2(70)+0.50(45)+0.3(5)=38
Expected Value of Perfect Information(EVPI):
EVPI= EVwPI-EVwoPI
EVPI=38-32=6
Decisions under Uncertainty
• Decisions under uncertainty techniques are used when the decision maker cannot
assign probabilities to the different possible outcomes because needed
information is not available.
• A decision under uncertainty is when there are many unknowns and no possibility
of knowing what could occur in the future to alter the outcome of a decision.
Decisions under Uncertainty
• A situation of uncertainty arises when there can be more than one possible consequence of selecting any
course of action. In terms of the payoff matrix, if the decision-maker selects A1, his payoff can be X11, X12,
X13, etc., depending upon which state of nature S1, S2, S3, etc., is going to occur.
• There are a variety of criteria that have been proposed for the selection of an optimal course of action under
the environment of uncertainty.
• Laplace Rule or Rationality or Equal Probability or Bayesian Criterian
• Maximin Rule
• Maximax Rule
• Hurwicz Rule
• Minimax Regret Rule
Laplace Rule
• In the absence of any knowledge about the probabilities of occurrence of various
states of nature, one possible way out is to assume that all of them are equally
likely to occur.
• Using these probabilities, we compute the expected payoff for each course of
action and the action with maximum expected value is regarded as optimal.
Example- Laplace rule
A firm is considering a final “GO” decision on a new product. If the product is
introduced and it is successful, the profit is $500 and if it is unsuccessful the loss is
$300. There is no profit or loss if the product is not introduced (STOP).
Events or states of nature
Action Successful Unsuccessful
GO $500 -$300
STOP $0 $0
Decision Values
Go $500(.5) - 300(.5) = 100
Stop $0(.5) + 0$(.5) = 0
GO Decision is optimal
Example
• The following matrix give a payoff different strategies (alternatives) S1,S2,S3
and S4 against the conditions (Events) N1,N2,N3 and N4.
N1 N2 N3 N4
S1 1000 1500 750 0
S2 250 2000 3750 3000
S3 -500 1250 3000 4750
S4 -1250 500 2250 4000
Expected S3=1/4 [-500+1250+3000+4750]
Payoff=1/n(P1+P2+P3…………Pn)
=1/4 [8500]
S1 =1/4 [1000+1500+750+0]
S3=2125
=1/4 [ 3250]
S4=1/4 [-1250+500+2250+4000]
S1 =812.50
=1/4[5500]
S2=1/4 [250+2000+3750+3000]
S4=1375
=1/4[9000]
S2 =2250
Example
N1 N2 N3 N4 Expected
Payoff
S1 1000 1500 750 0 812.50
S2 250 2000 3750 3000 2250
S3 -500 1250 3000 4750 2125
S4 -1250 500 2250 4000 1375
• Choose the action which has the max. of these max. profits.
• Identify the best outcome for each possible decision and choose the decision
with the maximum payoff.
Example -Maxi-max Rule
Events or states of nature
Action Successful Unsuccessful
GO $500 -$300
STOP $0 $0
N1 N2 N3 N4 Maximum
Value
S2
250 2000 3750 3000 3750
S1
1000 1500 750 0 1500
S3
-500 1250 3000 4750 4750 S2
250 2000 3750 3000 3750
S4 S3
-1250 500 2250 4000 4000 -500 1250 3000 4750 4750 4750
S4
-1250 500 2250 4000 4000
S3 is the best alternative among the alternatives because it has the maximum expected payoff
(i) Min Min- This is only applicable for cost matrix
N1 N2 N3 N4 Minimum
Value
S1 1000 1500 750 0 0
S2 250 2000 3750 3000 250
S3 -500 1250 3000 4750 -500
S4 -1250 500 2250 4000 -1250
N1 N2 N3 N4 Minimum Min Min
Value
S1
1000 1500 750 0 0 -1250
S2
250 2000 3750 3000 250
S4 is the best alternative among the alternatives S3
-500 1250 3000 4750 -500
because it has the Mini Min criteria S4
-1250 500 2250 4000 -1250
Criterion of Pessimism-Maximin Rule
• Decision maker selects the decision that will reflect the maximum of the
minimum payoffs; a pessimistic criterion or Wald criterion.
• Choose the action which has the max. of these minimum profits.
• Identify the worst outcome for each decision and choose the decision
associated with the maximum worst payoff.
MaxiMin Rule – Example
GO $500 -$300
STOP $0 $0
S1 is the best alternative among the alternatives S2 250 2000 3750 3000 3750
because it has MinMax criteria
S3 -500 1250 3000 4750 4750
N1 N2 N3 N4
S1 1000 1500 750 0
S2 250 2000 3750 3000
S3 -500 1250 3000 4750
S4 -1250 500 2250 4000
N1 N2 N3 N4
S1 1000-(- 1000 0 0
1250)=2250
S2 250-(- 1500 3000 3000
1250)=1500
S3 -500-(- 750 2250 4750
1250=750
S4 -1250-(-Table=Cost-Minimum
• Regret 0 1500
Cost 4000
1250)=0
MiniMax Rule
N1 N2 N3 N4 Maximum
Value
S1 1000-(- 1000 0 0 2250
1250)=2250
S1 is a best alternative
Hurwicz Rule
• Compromise between the maximax and maximin criterion.
• A coefficient of optimism, , is a measure of the decision maker’s optimism.
• The Hurwicz criterion multiplies the best payoff by and the worst payoff by
1- ., for each decision, and the best result is selected.
• If a, a constant lying between 0 and 1, denotes the degree of optimism, then
the degree of pessimism will be 1 - .
• Then a weighted average of the maximum and minimum payoffs of an action,
with and 1 - as respective weights, is computed.
• The action with the highest average is regarded as optimal.
Hurwicz Rule
Events or states of nature
Action Successful Unsuccessful
GO $500 -$300
STOP $0 $0
=0.4
Decision Values
Go $500(.4) - 300(.6) = $20
Stop $0(.4) - 0(.6) = $0
Choice is GO decision
Hurwicz Rule-Example
Given:
Maximization Problem
=0.6
N1 N2 N3 N4
S1 1000 1500 750 0
S2 250 2000 3750 3000
S3 -500 1250 3000 4750
S4 -1250 500 2250 4000
Hurwicz Rule-Example
Given:
=0.6
N1 N2 N3 N4 Maximum Minimum
Value Value
Weighted Outcomes=*Max+(1-)*Min
=0.6
S1= *Max+(1-)*Min
=0.6*1500+(1-0.6)*0
=900+0=900
Hurwicz Rule-Example
S2=0.6*3750+0.4*250=2350
S3=0.6*4750+0.4*(-500)
=2850-200=2650
S3=2650
S4=0.6*4000+0.4*-1250
=2400-500=1900 N1 N2 N3 N4 Maximu Minim Weighted
S4=1900 m Value um Outcomes
Value
S1 1000 1500 750 0 1500 0 900
S2 250 2000 3750 3000 3750 250 2350
S3 -500 1250 3000 4750 4750 -500 2650
S3 is the best alternatives S4 -1250 500 2250 4000 4000 -1250 1900
Hurwicz Rule-Example
Given:
Minimization Problem
=?
N1 N2 N3 N4
S1 1000 1500 750 0
S2 250 2000 3750 3000
S3 -500 1250 3000 4750
S4 -1250 500 2250 4000
Hurwicz Rule-Example
Minimization Problem
=?
N1 N2 N3 N4 Minimum Maximum
Value Value
Weighted Outcomes=*Min+(1-)*Max
Range between 0 to 1