Asgkit Prog3
Asgkit Prog3
Program 3
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
Prerequisites Reading
•Chapters 5 and 6
Table 1 contains historical estimated and actual data for 10 programs. For
program 11, the developer has estimated a proxy size of 386 LOC.
Thoroughly test the program. At a minimum, run the following four test cases.
•Test 1: Calculate the regression parameters and correlation coef cients
between estimated proxy size and actual added and modi ed size in Table 1.
Calculate plan added and modi ed size given an estimated proxy size of x k =
386.
•Test 2: Calculate the regression parameters and regression coef cients
between estimated proxy size and actual development time in Table 1.
Calculate time estimate given an estimated proxy size of x k = 386.
•Test 3: Calculate the regression parameters and regression coef cients
between plan added and modi ed size and actual added and modi ed size in
Table 1. Calculate plan added and modi ed size given an estimated proxy
size of x k = 386.
•Test 4: Calculate the regression parameters and regression coef cients
between plan added and modi ed size and actual development time in Table
1. Calculate time estimate given an estimated proxy size of x k = 386.
Table 1
Expected
results
Table 2
Overview Linear regression is a way of optimally tting a line to a set of data. The linear
regression line is the line where the distance from all points to that line is
minimized. The equation of a line can be written as
y = β 0 + β1 x
ev
ct
m
al
el
A
D
u
o
p
Using regression in Looking at Figure 1, how many hours do you think it would take to develop a
the PSP program with an estimated proxy size of 500?
The PSP PROBE method uses regression parameters to make better predictions
of size and time based on your historical data.
PROBE methods A and B differ only in the historical data (x values) used to
calculate the regression parameters. In PROBE method A, estimated proxy
size are used as the x values. In PROBE method B, plan added and modi ed
size are used as the x values.
PROBE methods for size and time differ only in the historical data (y values)
used to calculate the regression parameters. To predict improved size
estimates, actual added and modi ed LOC are used as the y values. To
predict time estimates, actual development times are used as the y values.
Overview The correlation calculation determines the relationship between two sets of
numerical data.
r
The correlation x , y can range from +1 to -1.
•Results near +1 imply a strong positive relationship; when x increases, so does
y.
•Results near -1 imply a strong negative relationship; when x increases, y
decreases.
•Results near 0 imply no relationship.
Using correlation in Correlation is used in the PSP to judge the quality of the linear relation in
the PSP various historical process data that are used for planning. For example, the
relationships between estimated proxy size and actual time or plan added and
modi ed size and actual time.
2
For this purpose, we examine the value of the relation rxy squared, or r .
2
If r is the relationship is
2 predictive; use it with high con dence
.9 ≤ r
2
.7 ≤ r < .9 strong and can be used for planning
2
.5 ≤ r < .7 adequate for planning but use with caution
Calculating β1
regression and The formulas for calculating the regression parameters β 0 and are
correlation n
⎛ ⎞
⎜ ∑ xi yi ⎟ − (nxavg yavg )
β1 = ⎝ i =1 n ⎠
⎛ ⎞
(
⎜ ∑ xi2 ⎟ − nxavg
2
)
⎝ i =1 ⎠
β 0 = yavg − β1 xavg
rx , y 2
The formulas for calculating the correlation coef cient and r are
⎛ n ⎞ ⎛ n ⎞⎛ n ⎞
n⎜ ∑ xi yi ⎟ − ⎜ ∑ xi ⎟⎜ ∑ yi ⎟
rx , y = ⎝ i =1 ⎠ ⎝ i =1 ⎠⎝ i =1 ⎠
⎡ ⎛ n 2 ⎞ ⎛ n ⎞2 ⎤ ⎡ ⎛ n 2 ⎞ ⎛ n ⎞2 ⎤
⎢n⎜ ∑ xi ⎟ − ⎜ ∑ xi ⎟ ⎥ ⎢n⎜ ∑ yi ⎟ − ⎜ ∑ yi ⎟ ⎥
⎢⎣ ⎝ i =1 ⎠ ⎝ i =1 ⎠ ⎥⎦ ⎢⎣ ⎝ i =1 ⎠ ⎝ i =1 ⎠ ⎥⎦
r2 = r *r
where
•Σ is the symbol for summation
•i is an index to the n numbers
•x and y are the two paired sets of data
•n is the number of items in each set x and y
x
• avg is the average of the x values
y
• avg is the average of the y values
A regression example β1
In this example, we will calculate the regression parameters ( β 0 and
r 2
values) and correlation coef cients x , y and r of the data in the Table 3.
n x y
1 130 186
2 650 699
3 99 132
4 150 272
5 128 291
6 302 331
7 95 199
8 945 1890
9 368 788
10 961 1601
Table 3
⎛ n ⎞
⎜ ∑ xi yi ⎟ − (nxavg yavg )
β1 = ⎝ i =1 n ⎠
⎛ ⎞
(
⎜ ∑ xi2 ⎟ − nxavg
2
)
⎝ i =1 ⎠
1. In this example there are 10 items in each dataset and therefore we set n = 10.
2. We can now solve the summation items in the formulas.
n x y x2 x*y y2
1 130 186 16900 24180 34596
3828 6389
xavg = = 382.8 yavg = = 638.9
10 10
An example, cont. 3. We can then substitute the values into the formulas
β1 =
(4303108)− (10 * 382.8 * 638.9)
(2540284)− (10 * 382.82 )
1857399
β1 = = 1.727932
1074926
10(4303108)− (3828)(6389 )
rx , y =
[10(2540284)− (3828) ][10(7604693)− (6389) ]
2 2
18573988
rx , y =
[10749256][35227609]
18573988
rx , y =
19459460.1
rx , y = 0.9545
r 2 = 0.9111
Assignment Before starting program 3, review the top-level PSP1 process script below to
instructions ensure that you understand the “big picture” before you begin. Also, ensure that
you have all of the required inputs before you begin the planning phase.
Planning phase Plan program 3 following the PSP1 planning phase and the PROBE estimating
scripts.
Verify that you have met all of the exit criteria for the planning phase, then
have an instructor review your plan. After your plan has been reviewed,
proceed to the development phase.
Purpose To guide the size and time estimating process using the PROBE method
Entry Criteria - Requirements statement
- Size Estimating template and instructions
- Size per item data for part types
- Time Recording log
- Historical size and time data
General - This script assumes that you are using added and modified size data as the
size-accounting types for making size and time estimates.
- If you choose some other size-accounting types, replace every “added and
modified” in this script with the size-accounting types of your choice.
expected size of the new program), or β 1 is not near 1.0 (between about
0.5 and 2.0), use procedure 4B.
4B Size Estimating β
Procedure 4B - Using the linear-regression method, calculate the 0 and β 1 parameters
from the plan added and modified size and actual added and modified size
data.
- If
β 0 is not near 0 (substantially smaller than the expected development
β
time for the new program), or 1 is not within 50% of 1/(historical
productivity), use procedure 5B.
5B Time Estimating β
Procedure 5B - Using the linear-regression method, calculate the 0 and β 1 regression
parameters from the plan added and modified size and actual total
development time data.
- If
β 0 is not near 0 (substantially smaller than the expected development
β
time for the new program), or 1 is not within 50% of 1/(historical
productivity), use procedure 5C.
5C Time Estimating - If you have data on estimated – added and modified size and actual
Procedure 5C β
development time, set 0 = 0 and β 1 = (actual total development time to
date/estimated – total added and modified size to date).
- If you have data on plan – added and modified size and actual
β β
development time, set 0 = 0 and 1 = (actual total development time to
date/plan total added and modified size to date).
β
- If you only have actual time and size data, set 0 = 0 and β 1 = (actual
total development time to date/actual total added and modified size to
date).
5D Time Estimating If you have no historical data, use your judgment to estimate the
Procedure 5D development time from the estimated added and modified size.
6 Time and Size - If you used regression method A or B, calculate the 70% prediction
Prediction Intervals intervals for the time and size estimates.
- If you did not use the regression method or do not know how to calculate
the prediction interval, calculate the minimum and maximum
development time estimate limits from your historical maximum and
minimum productivity for the programs written to date.
Exit Criteria - Completed estimated and actual entries for all pertinent size categories
- Completed PROBE Calculation Worksheet with size and time entries
- Plan and actual values entered on the Project Plan Summary
Development Develop the program following the PSP1 development phase script.
phase
PSP1 Development Script
Exit Criteria - A thoroughly tested program that conforms to the Coding standard
- Completed Test Report template
- Completed Time and Defect Recording logs
Verify that you have met all of the exit criteria for the development phase, then
proceed to the postmortem phase.
Postmortem
phase Conduct the postmortem following the PSP1 postmortem script.
Exit Criteria - A thoroughly tested program that conforms to the coding and size
counting standards
- Completed Test Report template
- Completed Project Plan Summary form
- Completed PIP forms describing process problems, improvement
suggestions, and lessons learned
- Completed Time and Defect Recording logs
Verify that you have met all of the exit criteria for the PSP1 postmortem phase, then
submit your assignment.
Submitting your When you’ve completed the postmortem phase, submit your assignment
assignment package, source code, and test results to the instructor.
Keep your programs simple. You will learn as much from developing small
programs as from large ones.
If you are not sure about something, ask your instructor for clari cation.