BY: David J.Litja: Measurement Errors
BY: David J.Litja: Measurement Errors
BY: David J.Litja: Measurement Errors
= =
= =
=
=
=
n
x x
s
x x
n
n s
x x
z
i
n
i
i
Copyright 2004 David J. Lilja
23
Confidence Interval for the Mean
Normalized z follows a Students t distribution
(n-1) degrees of freedom
Area left of c
2
= 1 /2
Tabulated values for t
Copyright 2004 David J. Lilja
24
c1 c2
1-
/2 /2
Confidence Interval for the Mean
As n , normalized distribution becomes
Gaussian (normal)
Copyright 2004 David J. Lilja
25
c1 c2
1-
/2 /2
Confidence Interval for the Mean
Copyright 2004 David J. Lilja
26
o
o
o
= s s
+ =
=
1 ) Pr(
Then,
2 1
1 ; 2 / 1 2
1 ; 2 / 1 1
c x c
n
s
t x c
n
s
t x c
n
n
An Example
Experiment Measured value
1 8.0 s
2 7.0 s
3 5.0 s
4 9.0 s
5 9.5 s
6 11.3 s
7 5.2 s
8 8.5 s
Copyright 2004 David J. Lilja
27
An Example (cont.)
14 . 2 deviation standard sample
94 . 7
1
= =
= =
=
s
n
x
x
n
i
i
Copyright 2004 David J. Lilja
28
An Example (cont.)
90% CI 90% chance actual value in interval
90% CI = 0.10
1 - /2 = 0.95
n = 8 7 degrees of freedom
Copyright 2004 David J. Lilja
29
c1 c2
1-
/2 /2
90% Confidence Interval
a
n 0.90 0.95 0.975
5 1.476 2.015 2.571
6 1.440 1.943 2.447
7 1.415 1.895 2.365
1.282 1.645 1.960
4 . 9
8
) 14 . 2 ( 895 . 1
94 . 7
5 . 6
8
) 14 . 2 ( 895 . 1
94 . 7
895 . 1
95 . 0 2 / 10 . 0 1 2 / 1
2
1
7 ; 95 . 0 1 ;
= + =
= =
= =
= = =
c
c
t t
a
n a
o
Copyright 2004 David J. Lilja
30
95% Confidence Interval
a
n 0.90 0.95 0.975
5 1.476 2.015 2.571
6 1.440 1.943 2.447
7 1.415 1.895 2.365
1.282 1.645 1.960
7 . 9
8
) 14 . 2 ( 365 . 2
94 . 7
1 . 6
8
) 14 . 2 ( 365 . 2
94 . 7
365 . 2
975 . 0 2 / 10 . 0 1 2 / 1
2
1
7 ; 975 . 0 1 ;
= + =
= =
= =
= = =
c
c
t t
a
n a
o
Copyright 2004 David J. Lilja
31
What does it mean?
Copyright 2004 David J. Lilja
32
90% CI = [6.5, 9.4]
90% chance real value is between 6.5, 9.4
95% CI = [6.1, 9.7]
95% chance real value is between 6.1, 9.7
Why is interval wider when we are more confident?
Higher Confidence Wider Interval?
Copyright 2004 David J. Lilja
33
6.5
9.4
90%
6.1 9.7
95%
Key Assumption
Measurement errors are
Normally distributed.
Is this true for most
measurements on real
computer systems?
Copyright 2004 David J. Lilja
34
c1 c2
1-
/2 /2
Key Assumption
Copyright 2004 David J. Lilja
35
Saved by the Central Limit Theorem
Sum of a large number of values from any
distribution will be Normally (Gaussian)
distributed.
What is a large number?
Typically assumed to be > 6 or 7.
How many measurements?
Width of interval inversely proportional to n
Want to minimize number of measurements
Find confidence interval for mean, such that:
Pr(actual mean in interval) = (1 )
| | x e x e c c ) 1 ( , ) 1 ( ) , (
2 1
+ =
Copyright 2004 David J. Lilja
36
How many measurements?
Copyright 2004 David J. Lilja
37
2
2 / 1
2 / 1
2 / 1
2 1
) 1 ( ) , (
|
.
|
\
|
=
=
=
=
e x
s z
n
e x
n
s
z
n
s
z x
x e c c
o
o
o
\
|
=
|
.
|
\
|
=
e x
s z
n
o
213 measurements
90% chance true mean is within 3.5% interval
Copyright 2004 David J. Lilja
41
Proportions
Copyright 2004 David J. Lilja
42
p = Pr(success) in n trials of binomial experiment
Estimate proportion: p = m/n
m = number of successes
n = total number of trials
Proportions
Copyright 2004 David J. Lilja
43
n
p p
z p c
n
p p
z p c
) 1 (
) 1 (
2 / 1 2
2 / 1 1
+ =
o
o
Proportions
Copyright 2004 David J. Lilja
44
How much time does processor spend in OS?
Interrupt every 10 ms
Increment counters
n = number of interrupts
m = number of interrupts when PC within OS
Proportions
Copyright 2004 David J. Lilja
45
How much time does processor spend in OS?
Interrupt every 10 ms
Increment counters
n = number of interrupts
m = number of interrupts when PC within OS
Run for 1 minute
n = 6000
m = 658
Proportions
) 1176 . 0 , 1018 . 0 (
6000
) 1097 . 0 1 ( 1097 . 0
96 . 1 1097 . 0
) 1 (
) , (
2 / 1 2 1
=
n
p p
z p c c
o
95% confidence interval for proportion
So 95% certain processor spends 10.2-11.8% of its
time in OS
Copyright 2004 David J. Lilja
46
Number of measurements for proportions
Copyright 2004 David J. Lilja
47
2
2
2 / 1
2 / 1
2 / 1
) (
) 1 (
) 1 (
) 1 (
) 1 (
p e
p p z
n
n
p p
z p e
n
p p
z p p e
o
o
o
Number of measurements for proportions
Copyright 2004 David J. Lilja
48
How long to run OS experiment?
Want 95% confidence
0.5%
Number of measurements for proportions
Copyright 2004 David J. Lilja
49
How long to run OS experiment?
Want 95% confidence
0.5%
e = 0.005
p = 0.1097
Number of measurements for proportions
| |
102 , 247 , 1
) 1097 . 0 ( 005 . 0
) 1097 . 0 1 )( 1097 . 0 ( ) 960 . 1 (
) (
) 1 (
2
2
2
2
2 / 1
=
=
p e
p p z
n
o
10 ms interrupts
3.46 hours
Copyright 2004 David J. Lilja
50
Important Points
Copyright 2004 David J. Lilja
51
Use statistics to
Deal with noisy measurements
Aggregate large amounts of data
Errors in measurements are due to:
Accuracy, precision, resolution of tools
Other sources of noise
Systematic, random errors
Important Points: Model errors with bell
curve
Copyright 2004 David J. Lilja
52
True value
Precision
Mean of measured values
Resolution
Accuracy
Important Points
Copyright 2004 David J. Lilja
53
Use confidence intervals to quantify precision
Confidence intervals for
Mean of n samples
Proportions
Confidence level
Pr(actual mean within computed interval)
Compute number of measurements needed for
desired interval width