0% found this document useful (0 votes)
4 views64 pages

Section 9 Slides

The document outlines various statistical tests for mean and variance, including one-sample and two-sample tests, paired t-tests, ANOVA, and F-tests. It discusses the concepts of Type I and Type II errors, significance levels, and hypothesis testing procedures. Additionally, it provides examples and calculations for different tests, emphasizing the importance of sample size and confidence levels in statistical analysis.

Uploaded by

goyal140107
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views64 pages

Section 9 Slides

The document outlines various statistical tests for mean and variance, including one-sample and two-sample tests, paired t-tests, ANOVA, and F-tests. It discusses the concepts of Type I and Type II errors, significance levels, and hypothesis testing procedures. Additionally, it provides examples and calculations for different tests, emphasizing the importance of sample size and confidence levels in statistical analysis.

Uploaded by

goyal140107
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Tests for Mean & Variance

One sample z test


One Sample
One sample t test

Two sample z test

Two Two sample t test


Tests Samples

Paired t test

Two sample standard


deviation

More than 2
ANOVA
samples
Errors of Statistical Tests
True State of Nature

H0 Ha
Is true Is true
Support H0 /
Reject Ha Correct Type II
Conclusion Error
Conclusion Support Ha / Correct
Reject H0 Type I Error Conclusion
(Power)
Errors of Statistical Tests
Type I error (alpha) Type II error (beta)
Name Producer’s risk/ Consumer’s risk
Significance level
1 minus error is Confidence level Power of the test
called
Example of Fire False fire alarm leading Missed fire leading to
Alarm to inconvenience disaster
Effects on Unnecessary cost Defects may be produced
process increase due to frequent
changes
Control method Usually fixed at a pre- Usually controlled to < 10%
determined level, 1%, by appropriate sample size
5% or 10%
Simple definition Innocent declared as Guilty declared as innocent
guilty
Significance Level
Level of Confidence / Confidence Interval:
C = 0.90, 0.95, 0.99 (90%, 95%, 99%)

Level of Significance:
α = 1 – C (0.10, 0.05, 0.01)
Power
❖ Power = 1 – β (or 1 - type II error)
❖ Type II Error: Failing to reject null
hypothesis when null hypothesis is false.
❖ Power: Likelihood of rejecting null
hypothesis when null hypothesis is false.

❖ Or: Power is the ability of a test to


correctly reject the null hypothesis.
Alpha vs Beta
❖ Researcher can not commit both Type I
and II error. Only one can be committed.
❖ As the value of α increases (say 0.01 to
0.05) β goes down and the Power of test
increases.
❖ To reduce both Type I and II errors
increase sample size.
p Value
❖ p value is the lowest value of alpha for
which the null hypothesis can be
rejected. (Probability that the null
hypothesis is correct)
❖ If p = 0.01 you can reject the null
hypothesis at α = 0.05
❖ p is low the null must go / p is high the
null fly.
Hypothesis Testing
1. State the Alternate Hypothesis.
2. State the Null Hypothesis.
3. Select a probability of error level (alpha
level). Generally 0.05
4. Select and compute the test statistic
(e.g t or z score)
5. Critical test statistic
6. Interpret the results.
Hypothesis Testing
❖ Lower Tail Tests
❖ H0: μ ≥ 150cc
❖ Ha: μ < 150cc

❖ Upper Tail Tests


❖ H0: μ ≤ 150cc
❖ Ha: μ > 150cc
Hypothesis Testing
❖ Two Tail Tests
❖ H0: μ = 150cc
❖ Ha: μ ≠ 150cc
Calculate Test Statistic
❖ Single sample
❖ z = (x - μ)/ σ

❖ Mean of Multiple samples


❖ z = (x̄ - μ) / (σ / √n)
One Sample t Test
❖ Calculated value
❖ t = [x̄ - μ ] / [s / sqrt( n ) ]
❖ Example: Perfume bottle producing
150cc, 4 bottles are randomly picked
and the average volume was found to
be 151cc and sd of sample was 2 cc. Has
mean volume changed? (95%
confidence)
❖ tcal = (151-150)/[2 / sqrt( 4 ) ] = 1/1 = 1
❖ tcritical = ?
One Sample t Test
tcritical = 3.182
One Sample t Test
❖ Calculated value
❖ t = [x̄ - μ ] / [s / sqrt( n ) ]
❖ Example: Perfume bottle producing
150cc, 4 bottles are randomly picked
and the average volume was found to be
be 151cc and sd of sample was 2 cc. Has
mean volume changed? (95%
confidence)
❖ tcal = (151-150)/[2 / sqrt( 4 ) ] = 1/1 = 1
❖ tcritical = 3.182 > Fail to reject Ho
Tests for Variance
❖ F-test
❖ for testing equality of two variances from
different populations
❖ for testing equality of several means with
technique of ANOVA.
❖ Chi-square test
❖ For testing the population variance against
a specified value
❖ testing goodness of fit of some probability
distribution
One Sample Chi Square
❖ For testing the population variance against
a specified value σ
One Sample Chi Square
❖ Example: A sample of 25 bottles was
selected. The variance of these 25 bottles
as 5 cc. Has it increased from established 4
cc? 95% confidence level.

❖ X2 = 24x5 / 4 = 30

❖ What is critical value of Chi Square for 24


degrees of freedom?
One Sample Chi Square
One Sample Chi Square
❖ Example: A sample of 25 bottles was
selected. The variance of these 25 bottles
as 5 cc. Has it increased from established 4
cc? 95% confidence level.

❖ X2 = 24x5 / 4 = 30

❖ Critical value of Chi Square for 24 degrees


of freedom = 36.42

❖ Fail to reject H0
Tests for M ean & Varianc e
One sample z test
One Sample
One sample t test

Two sample z test

Two Two sample t test


Tests Samples

Paired t test

Two sample standard


deviation

More than 2
ANOVA
samples
Two Sample z Test
❖ Null hypothesis: H 0: μ 1 = μ 2
❖ or H 0: μ 1 – μ 2= 0
❖ Alternative hypothesis: H a : μ 1 ≠ μ 2
Two Sample z Test
❖ Example: From two machines 100
samples each were drawn.
❖ Machine 1: Mean = 151.2 / sd = 2.1
❖ Machine 2: Mean = 151.9 / sd = 2.2
❖ Is there difference in these two machines.
Check at 95% confidence level.
Two Sample z Test
❖ Example: From two machines 100
samples each were drawn.
❖ Machine 1: Mean = 151.2 / sd = 2.1
❖ Machine 2: Mean = 151.9 / sd = 2.2
❖ Is there difference in these two machines.
Check at 95% confidence level.
❖ Zcal = -0.7 / 0.304 = -2.30
❖ Zcritical = 1.96
❖ Reject Null.
❖ There is a difference.
Two Sample z Test
❖ Example: From two machines 100
samples each were drawn.
❖ Machine 1: Mean = 151.2 / sd = 2.1
❖ Machine 2: Mean = 151.9 / sd = 2.2
❖ Is there difference of more than 0.3 cc in
these two machines. Check at 95%
confidence level.

❖ H 0: μ 1 – μ 2 <= 0.3
❖ H a: μ 1 – μ 2 > 0.3
Two Sample z Test
❖ Example: From two machines 100
samples each were drawn.
❖ Machine 1: Mean = 151.2 / sd = 2.1
❖ Machine 2: Mean = 151.9 / sd = 2.2
❖ Is there difference of more than 0.3 cc in
these two machines. Check at 95%
confidence level.
❖ Zcal = (151.2 – 151.9)-(-0.3)/0.304 = 2.30
❖ = -0.4/2.30 = -1.316
❖ Zcritical = 1.64
❖ Fail to Reject Null Hypothesis.
Two Sample t Test
❖ If two set of data are independent or
dependent.
❖ If the values in one sample reveal no
information about those of the other
sample, then the samples are independent.
❖ Example: Blood pressure of male/female

❖ If the values in one sample affect the values


in the other sample, then the samples are
dependent.
❖ Example: Blood pressure before and after a
specific medicine
Two Sample t Test
❖ If two set of data are independent or
dependent.
❖ If the values in one sample reveal no
information about those of the other
sample, then the samples are independent.
❖ Example: Blood pressure of male/female
Two sample t test

❖ If the values in one sample affect the values


in the other sample, then the samples are
dependent.
❖ Example: Blood pressure before and after a
specific medicine Paired t test
Two Sample t Test
❖ Is variance for two samples equal?

❖ If yes: Pooled variance calculate Sp for


finding out t
Paired t Test
❖ Where you have two samples in which
observations in one sample can be
paired with observations in the other
sample.
❖ Or
❖ If the values in one sample affect the
values in the other sample, (the samples
are dependent.)
❖ Example: Blood pressure before and after a
specific medicine
Paired t Test
❖ Find the difference between two set of
readings as d1, d2 …. dn.
❖ Find the mean and standard deviation of
these differences.
Paired t Test
❖ Example: Before and after medicine BP
was measured. Is there a difference at
95% confidence level?

Patient Before After


1 120 122
2 122 120
3 143 141
4 100 109
5 109 109
Paired t Test
❖ Example: Before and after medicine BP
was measured. Is there a difference at
95% confidence level?
Patient Before After difference
1 120 122 2
2 122 120 -2
3 143 141 -2
4 100 109 9
5 109 109 0

❖ d-bar = 1.4 , s = 4.56 , n=5


❖ tcal. = 1.4/1.99 = 0.70
Paired t Test
❖ Example: Before and after medicine BP
was measured. Is there a difference at
95% confidence level?
Patient Before After difference
1 120 122 2
2 122 120 -2
3 143 141 -2
4 100 109 9
5 109 109 0
❖ tcal. = 1.4/1.99 = 0.70
❖ t0.025, 4 = 2.766
❖ Fail to reject null hypothesis
Two Sample Varianc e – F Test
❖ F-test
❖ for testing equality of two variances from
different populations

❖ H0: σ21 = σ22


❖ F calculated

❖ Keep higher value at the top for right tail


test.
❖ Remember: Variance is square of standard
deviation
Two Sample Varianc e – F Test
❖ F critical
❖ Use table with appropriate degrees of
freedom
❖ For two tail test use the table for α/2
Two Sample Variance – F Test
❖ Example: We took 8 samples from
machine A and the standard deviation
was 1.1. For machine B we took 5
samples and the variance was 11. Is
there a difference in variance at 90%
confidence level?
❖ n1 = 8, s1 = 1.1, s21 = 1.21, df = 7 (denominator)
❖ n2 = 5, s22 = 11, df = 4 (numerator)
❖ F calculated = 11/1.21 = 9.09 (higher value at top)
Two Sample Varianc e – F Test

F critical = 4.1203
Two Sample Varianc e – F Test
❖ Example: We took 8 samples from
machine A and the standard deviation
was 1.1. For machine B we took 5
samples and the variance was 11. Is
there a difference in variance at 90%
F critical = 4.1203
confidence level?
❖ n1 = 8, s1 = 1.1, s21 = 1.21, df = 7 (denominator)
❖ n2 = 5, s22 = 11, df = 4 (numerator)
❖ F calculated = 11/1.21 = 9.09 (higher value at top)
❖ Reject H0
ANOVA
❖ F-test
❖ for testing equality of two variances from
different populations
❖ for testing equality of several means with
technique of ANOVA.
❖ Chi-square test
❖ For testing the population variance against
a specified value
❖ testing goodness of fit of some probability
distribution

❖ testing for independence of two attributes


ANOVA
❖ F-test
❖ for testing equality of two variances from
different populations

❖ H0: σ21 = σ22


❖ F calculated

❖ Keep higher value at the top for right tail


test.
❖ Remember: Variance is square of standard
deviation
ANOVA
❖ Why ANOVA?
❖ We used t test to compare the means of
two populations.
❖ What if we need to compare more than two
two populations? With ANOVA e can find
out if one or more populations have
different mean or comes from a different
population.
❖ We could have conducted multiple t Test.
❖ How many t Test we need to conduct if
have to compare 4 samples? … 6
ANOVA
❖ Why ANOVA?
❖ How many t Test we need to conduct if
have to compare 4 samples? … 6

4 x

3 x 3 vs 4

2 x 2 vs 3 2 vs 4

1 x 1 vs 2 1 vs 3 1 vs 4

1 2 3 4
ANOVA
❖ Why ANOVA?
❖ How many t Test we need to conduct if
have to compare 4 samples? … 6
❖ Each test is done with alpha = 0.05 or 95%
confidence.
❖ 6 tests will result in confidence level of
0.95x0.95x0.95x0.95x0.95x0.95 = 0.735
ANOVA
❖ Comparing three machines:
Machine 1 Machine 2 Machine 3
150 153 156
151 152 154
152 148 155
152 151 156
151 149 157
150 152 155
x̄1 = 151 x̄2 = 150.83 x̄3 = 155.50
ANOVA
Machine 1 Machine 2 Machine 3
❖ Comparing three machines: 150 153 156
151 152 154
152 148 155
152 151 156
158
151 149 157
156 150 152 155
x̄1 = 151.00 x̄2 = 150.83 x̄3 = 155.50
154
Median
25th
152
75th
Mean
150

148
Machine 1 Machine 2 Machine 3
146
ANOVA
❖ Comparing three machines:

Machine 1 Machine 2 Machine 3 Machine 4 Machine 5 Machine 6


150 153 156 130 163 166
151 152 154 155 152 154
152 148 155 160 143 155
152 151 156 158 141 151
151 149 157 152 149 152
150 152 155 145 157 155
x̄1 = 151.00 x̄2 = 150.83 x̄3 = 155.50 x̄1 = 151.00 x̄2 = 150.83 x̄3 = 155.50
ANOVA
❖ Comparing three machines:
Machine 1 Machine 2 Machine 3 Machine 4 Machine 5 Machine 6
150 153 156 130 163 166
151 152 154 155 152 154
152 148 155 160 143 155
152 151 156 158 141 151
151 149 157 152 149 152
150 152 155 145 157 155
x̄1 = 151.00 x̄2 = 150.83 x̄3 = 155.50 x̄1 = 151.00 x̄2 = 150.83 x̄3 = 155.50
170
158
165
156 160
154 Median
Median 155
25th 25th
152 150
75th 75th
145
150 Mean Mean
140 Outliers
148
135
Machine 1 Machine 2 Machine 3
146 130
125 Machine 4 Machine 5 Machine 6
ANOVA
❖ ANOVA is Analysis of Variance
❖ Variance

❖ Numerator of this formula is Sum of


Squares
❖ Total of Sum of Squares (SST) =
SS between/or treatment +SS within/or error
A NOVA
❖ SST = SS between(or treatment) +SS within(or error)

❖ Ratio:
SS between(or treatment) / SS within(or error)

F = MS between(or treatment) / MS within(or error)


Goodness of Fit Test (Chi Square)
❖ To test if the sample is coming from a
population with specific distribution.
❖ Other goodness-of-fit tests are
❖ Anderson-Darling
❖ Kolmogorov-Smirnov
❖ Chi Square Goodness of Fit can be used
for any time of data: Continuous or
Discrete.
Goodness of Fit Test (Chi Square)
❖ H0: The data follow a specified
distribution.
❖ Ha: The data do not follow the specified
distribution.
❖ Calculated Statistic:

❖ Critical Statistic: Chi square for k-1


degrees of freedom for specific alpha.
Goodness of Fit Test (Chi Square)
❖ A coin is flipped 100 times. Number of
heads are noted. Is this coin biased?
Expected Observed
50 51
50 52
50 56
50 82
50 65
Goodness of Fit Test (Chi Square)
❖ A coin is flipped 100 times. Number of
heads are noted. Is this coin biased?
Expected Observed O-E (O-E)2 (O-E)2/E
50 51 1 1 0.02
50 52 2 4 0.08
50 56 6 36 0.72
50 82 32 1024 20.48
50 65 15 225 4.5

X2 = 25.8
Goodness of Fit Test (Chi Square)
❖ A coin is flipped 100 times. Number of
heads are noted. Is this coin biased?
X2cal= 25.8

X2(4,0.95)= 9.49
Goodness of Fit Test (Chi Square)
❖ A coin is flipped 100 times. Number of
heads are noted. Is this coin biased?

❖ X2cal= 25.8
❖ X2(4,0.95)= 9.49

❖ Reject Null Hypothesis


❖ Coin is biased
Contingency Tables
❖ To find relationship between two
discrete variables.
Smoker Non
Smoker
Male 60 40 100
Female 35 40 75
95 80 175

Operator 1 Operator 2 Operator 3


Shift 1 22 26 23 71
Shift 2 28 62 26 116
Shift 3 72 22 66 160
122 112 115 347
Contingenc y Tables
❖ Null hypothesis is that there is no
relationship between the row and
column variables.
❖ Alternate hypothesis is that there is a
relationship. Alternate hypothesis does
not tell what type of relationship exists.
Operator 1 Operator 2 Operator 3
Shift 1 22 26 23 71
Shift 2 28 62 26 116
Shift 3 72 22 66 160
122 112 115 347
Contingency Tables
❖ Calculate Chi square statistic.

Operator 1 Operator 2 Operator 3


Shift 1 22 26 23 71
Shift 2 28 62 26 116
Shift 3 72 22 66 160
122 112 115 347
Contingenc y Tables
❖ Calculate Chi square statistic.
OBSERVED
Operator 1 Operator 2 Operator 3
Shift 1 22 26 23 71
Shift 2 28 62 26 116
Shift 3 72 22 66 160
122 112 115 347

EXPECTED
Operator 1 Operator 2 Operator 3
Shift 1 122x71/347 112x71/347 115x71/347 71
Shift 2 122x116/347 112x116/347 115x116/347 116
Shift 3 122x160/347 112x160/347 115x160/347 160
122 112 115 347
Contingency Tables
❖ Calculate Chi square statistic.
EXPECTED
Operator 1 Operator 2 Operator 3
Shift 1 122x71/347 112x71/347 115x71/347 71
Shift 2 122x116/347 112x116/347 115x116/347 116
Shift 3 122x160/347 112x160/347 115x160/347 160
122 112 115 347

EXPECTED
Operator 1 Operator 2 Operator 3
Shift 1 24.96 22.91 23.53 71
Shift 2 40.78 37.44 38.44 116
Shift 3 56.25 51.64 53.02 160
122 112 115 347
Contingency Tables
❖ Calculate Chi square statistic.
OBSERVED EXPECTED
Operator 1 Operator 2 Operator 3 Operator 1 Operator 2 Operator 3
Shift 1 22 26 23 71 Shift 1 24.96 22.91 23.53 71
Shift 2 28 62 26 116 Shift 2 40.78 37.44 38.44 116
Shift 3 72 22 66 160 Shift 3 56.25 51.64 53.02 160
122 112 115 347 122 112 115 347

Operat Operat
2
(O-E) /E Operator 1
or 2 or 3
Shift 1 (22-24.96)2/24.96 = 0.35 0.42 0.01 71
Shift 2 (28-40.78)2/40.78 = 4.00 16.11 4.03 116
Shift 3 (72-56.25)2/56.25 = 4.41 17.01 3.18 160
122 112 115 347 X2 = 49.52
Contingenc y Tables
❖ Calculate Chi square statistic = 49.52
❖ Degrees of freedom = (r-1)(c-1) = 4
❖ Chi square critical = 9.49
❖ Reject null hypothesis
❖ There is a relationship between the shift
and the operator.
Contingency Tables
❖ Practice Exercise:
❖ Calculate the Expected value for Non
Smoker Male?
❖ What will be the degrees of freedom in
this example?
Smoker Non
Smoker
Male 60 40 100
Female 35 40 75
95 80 175
Contingenc y Tables
❖ Practice Exercise:
❖ Calculate the Expected value for Non
Smoker Male? = 80x100/175 = 45.71
❖ What will be the degrees of freedom in
this example? (2-1)(2-1)=1
Smoker Non
Smoker
Male 60 40 100
Female 35 40 75
95 80 175

You might also like