Documente Academic
Documente Profesional
Documente Cultură
FF2613
Inferential Statistics
Basic Hypothesis Testing
drtamil@gmail.com 2012
Inferential Statistic
4 When
drtamil@gmail.com 2012
drtamil@gmail.com 2012
Null Hypothesis
4 Null
Hyphotesis;
drtamil@gmail.com 2012
Null Hypothesis
4 H0
drtamil@gmail.com 2012
Significance
4 Inferential
drtamil@gmail.com 2012
Confidence interval
4 Confidence
interval = 1 - level of
significance.
4 If the level of significance is 0.05, then
the confidence interval is 95%.
4CI
What is level of
significance? Chance?
Reject H0
Reject H0
.025
.025
-1.96
1.96
-2.0639
0 2.0639
drtamil@gmail.com 2012
drtamil@gmail.com 2012
Error
4 Although
drtamil@gmail.com 2012
Error
REALITY
Treatments are
not different
Treatments are
different
Conclude
treatments are
not different
Correct Decision
Type II error
error
(Cell a)
(Cell b)
Conclude
treatments are
different
Type I error
error
Correct Decision
DECISION
(Cell c)
(Cell d)
drtamil@gmail.com
2012
Error
Test of
Significance
Null Hypothesis
Not Rejected
Null Hypothesis
Rejected
Incorrect Null
Hypothesis
(Ho rejected)
Correct Conclusion
Type II Error
Type I Error
Correct Conclusion
drtamil@gmail.com 2012
Type I Error
Type I Error rejecting the null hypothesis
although the null hypothesis is correct
e.g.
when we compare the mean/proportion of
the 2 groups, the difference is small but the
difference is found to be significant.
Therefore the null hypothesis is rejected.
It may occur due to inappropriate choice of
alpha (level of significance).
drtamil@gmail.com 2012
Type II Error
Type II Error not rejecting the null
hypothesis although the null hypothesis is
wrong
e.g. when we compare the mean/proportion
of the 2 groups, the difference is big but the
difference is not significant. Therefore the
null hypothesis is not rejected.
Type of treatment
Pethidine
Cocktail
Total
Count
% within Type
of treatment
Count
% within Type
of treatment
Count
% within Type
of treatment
Total
15
53.3%
46.7%
100.0%
11
15
26.7%
73.3%
100.0%
12
18
30
40.0%
60.0%
100.0%
There was a large difference between the rates but were not
significant. Type II Error?
drtamil@gmail.com 2012
Power is only
32%!
drtamil@gmail.com 2012
drtamil@gmail.com 2012
Determining the
appropriate statistical test
drtamil@gmail.com 2012
Data Analysis
4 Descriptive
summarising data
4 Test of Association
4 Multivariate controlling for confounders
drtamil@gmail.com 2012
Test of Association
4 To
drtamil@gmail.com 2012
Marital Status
Suicidal Tendencies
Dependent Variable
drtamil@gmail.com 2012
Multivariat
4 Studies
Hypothesis Testing
4 Distinguish
procedures
4 Test two or more populations using
parametric & non-parametric procedures
Means
Medians
Variances
drtamil@gmail.com 2012
Hypothesis Testing
Procedures
drtamil@gmail.com 2012
Parametric Test
Procedures
4 Involve
population parameters
stringent assumptions
Z test, t test
drtamil@gmail.com 2012
Nonparametric Test
Procedures
4 Statistic
Parametric Analysis
Quantitative
Qualitative
Dichotomus
Qualitative
Polinomial
Quantitative
Quantitative continous
Quantitative
Student's t Test
Quantitative
ANOVA
Quantitative
drtamil@gmail.com 2012
non-parametric tests
Variable 1
Qualitative
Dichotomus
Variable 2
Qualitative
Dichotomus
Qualitative
Dichotomus
Qualitative
Polinomial
Quantitative
Quantitative continous
Criteria
Type of Test
Sample size < 20 or (< 40 but Fisher Test
with at least one expected
value < 5)
drtamil@gmail.com 2012
Variable 1
Qualitative
Variable 2
Qualitative
Qualitative
Dichotomus
Qualitative
Dichotomus
Qualitative
Dichotomus
Qualitative
Dichotomus
Qualitative
Dichotomus
Quantitative
Qualitative
Dichotomus
Qualitative
Quantitative
Criteria
Sample size > 20 dan no
expected value < 5
Sample size > 30
Type of Test
Chi Square Test (X2)
Proportionate Test
drtamil@gmail.com 2012
Data Analysis
4Using
SPSS;
http://161.142.92.104/spss/
4Using Excel;
http://161.142.92.104/excel/
drtamil@gmail.com 2012
FF2613
T -
Test
Independent T-Test
Students T-Test
Paired T-Test
ANOVA
2012
Students T-test
William Sealy Gosset @
Student, 1908. The Probable
Error of Mean. Biometrika.
drtamil@gmail.com 2012
Students T-Test
4 To
t=
drtamil@gmail.com 2012
drtamil@gmail.com 2012
Example
Group Statistics
DHAMAWK6
DRUG
F
S
N
35
32
Mean
4.2571
3.8125
Std. Deviation
3.12808
4.39529
t
DHAMAWK6
Equal variances
assumed
.48
.633
.4446
drtamil@gmail.com 2012
Assumptions of T test
4 Observations
t)
drtamil@gmail.com 2012
Manual Calculation
4 Sample
t=
size > 30
X1 X 2
2
1
2
2
s
s
+
n1 n2
4 Small
sample size,
equal variance
X1 X 2
t=
1 1
s0
+
n1 n2
2
2
(
n
1)
s
+
(
n
1)
s
1
2
2
s02 = 1
(n1 1) + (n2 1)
drtamil@gmail.com 2012
Example compare
cholesterol level
4 Hypertensive
:
214.92
39.22
4 Normal
Mean :
Mean : 182.19
s.d. :
s.d. :
37.26
n : 64
n : 36
Comparing the cholesterol level between
hypertensive and normal patients.
The difference is (214.92 182.19) = 32.73 mg%.
H0 : There is no difference of cholesterol level
between hypertensive and normal patients.
n > 30, (64+36=100), therefore use the first formula.
drtamil@gmail.com 2012
Calculation
t=
X1 X 2
2
1
2
2
s
s
+
n1 n2
4t
= (214.92- 182.19)________
((39.222/64)+(37.262/36))0.5
4 t = 4.137
4 df = n1+n2-2 = 64+36-2 = 98
4 Refer to t table; with t = 4.137, p < 0.001
drtamil@gmail.com 2012
Conclusion
Therefore p < 0.05, null hypothesis rejected.
There is a significant difference of
cholesterol level between hypertensive and
normal patients.
Hypertensive patients have a significantly
higher cholesterol level compared to
normotensive patients.
drtamil@gmail.com 2012
drtamil@gmail.com 2012
Exercise (answer)
4 Null
hypothesis rejected
4 There is a difference of marks between
UKM and ACMS students. UKM marks
higher than AUCMS
drtamil@gmail.com 2012
T-Test In SPSS
4
T-Test in SPSS
4
T-Test Results
Group Statistics
SGA
Normal
SGA
4 Compare
N
108
109
Mean
58.666
51.037
Std. Deviation
11.2302
9.3574
Std. Error
Mean
1.0806
.8963
Normal 58.7+11.2 kg
SGA
51.0+ 9.4 kg
4 Apparently
there is a difference of
weight between the two groups.
drtamil@gmail.com 2012
F
Weight at first ANC Equal variances
assumed
Equal variances
not assumed
4
4
1.862
Sig.
.174
df
Sig. (2-tailed)
Mean
Difference
Std. Error
Difference
95% Confidence
Interval of the
Difference
Lower
Upper
5.439
215
.000
7.629
1.4028
4.8641
10.3940
5.434
207.543
.000
7.629
1.4039
4.8612
10.3969
Normal
SGA
Mean
test
T test
t = 5.439
<0.0005
108 58.7+11.2 kg
109
51.0+ 9.4
drtamil@gmail.com 2012
Paired t-test
Repeated measurement on the
same individual
drtamil@gmail.com 2012
Paired T-Test
4 Repeated
individual
4
t=
drtamil@gmail.com 2012
Formula
d 0
t=
sd
n
sd =
2
i
d)
(
n 1
df = n p 1
drtamil@gmail.com 2012
drtamil@gmail.com 2012
Example
Paired Samples Statistics
Pair
1
DHAMAWK0
DHAMAWK6
Mean
13.9688
3.8125
N
32
32
Std. Deviation
6.48315
4.39529
Paired Differences
Std.
Mean
Deviation
Pair
1
DHAMAWK0 DHAMAWK6
10.1563
6.75903
df
Sig.
(2-tailed)
8.500
31
.000
drtamil@gmail.com 2012
l c
l a
t i o
d e te r m
in e
h e th e r
th e r e
a s
a n y
drtamil@gmail.com 2012
Calculation
4 Calculate
drtamil@gmail.com 2012
Calculation
4
d = 112
d2 = 1842
4 Mean d = 112/36 = 3.11
4 sd = ((1842-1122/36)/35)0.5
sd = 6.53
4 t = 3.11/(6.53/6)
t = 2.858
4 df = np 1 = 36 1 = 35.
4 Refer to t table;
n = 36
t=
d 0
sd
n
sd =
2
d
i
( d )
n 1
df = n p 1
drtamil@gmail.com 2012
Conclusion
with t = 2.858, 0.005<p<0.01
Therefore p < 0.01.
Therefore p < 0.05, null hypothesis
rejected.
Conclusion: There is a significant
difference of the systolic blood pressure
between the first and second
measurement. The mean average of first
reading is significantly higher compared
to the second reading.
drtamil@gmail.com 2012
Pair
1
HB2
HB3
Mean
10.247
10.594
N
70
70
Std. Deviation
.3566
.9706
Std. Error
Mean
.0426
.1160
4 This
drtamil@gmail.com 2012
Pair 1
HB2 - HB3
Mean
-.347
Std. Deviation
.9623
Std. Error
Mean
.1150
95% Confidence
Interval of the
Difference
Lower
Upper
-.577
-.118
t
-3.018
df
69
Sig. (2-tailed)
.004
4 This
70
Mean D
(Diff.)
Test
0.35 + 0.96
Paired Ttest
t = 3.018
0.004
drtamil@gmail.com 2012
ANOVA
drtamil@gmail.com 2012
ANOVA
Analysis of Variance
4 Extension
of independent-samples t test
4 Compares
4 Can
One-Way ANOVA
F-Test
4 Tests
drtamil@gmail.com 2012
Examples
4 Comparing
drtamil@gmail.com 2012
One-Way ANOVA
F-Test Assumptions
4 Randomness
of variance
drtamil@gmail.com 2012
Example
Descriptives
Birth weight
N
Housewife
Office work
Field work
Total
151
23
44
218
Mean
2.7801
2.7643
2.8430
2.7911
Std. Deviation
.52623
.60319
.55001
.53754
Minimum
1.90
1.60
1.90
1.60
Maximum
4.72
3.96
3.79
4.72
ANOVA
Birth weight
Between Groups
Within Groups
Total
Sum of
Squares
.153
62.550
62.703
df
2
215
217
Mean Square
.077
.291
F
.263
Sig.
.769
drtamil@gmail.com 2012
Manual Calculation
ANOVA
drtamil@gmail.com 2012
Manual Calculation
4 Not
drtamil@gmail.com 2012
Example:
Time To Complete
Analysis
45 samples were
analysed using 3 different
blood analyser (Mach1,
Mach2 & Mach3).
15 samples were placed
into each analyser.
Time in seconds was
measured for each
sample analysis.
Example:
Time To Complete
Analysis
The overall mean of the
entire sample was 22.71
seconds.
This is called the grand
mean, and is often
denoted by X .
If H0 were true then wed
expect the group means
to be close to the grand
mean.
Example:
Time To Complete
Analysis
The ANOVA test is
based on the combined
distances from X .
If the combined
distances are large, that
indicates we should
reject H0.
4 Grand
Mean = 22.71
4 Mean Mach1 = 24.93; (24.93-22.71)2=4.9284
4 Mean Mach2 = 22.61; (22.61-22.71)2=0.01
4 Mean Mach3 = 20.59; (20.59-22.71)2=4.4944
4 SSB = (15*4.9284)+(15*0.01)+(15*4.4944)
4 SSB = 141.492
drtamil@gmail.com 2012
4 For
4 Is
4 As
4 In
MSE
Mean Square Error
MSE =
1
N K
(x
ij
X j)
MSE
Mean Square Error
MSE =
1
N K
(x
ij
X j)
MSE
Mean Square Error
MSE =
1
N K
(x
ij
X j)
1
2
(xij X j )
MSE =
N K j i
Mach1 (x-mean)^2 Mach2 (x-mean)^2
23.73
1.4400
21.5
1.2321
23.74
1.4161
21.6
1.0201
23.75
1.3924
21.7
0.8281
24.00
0.8649
21.7
0.8281
24.10
0.6889
21.8
0.6561
24.20
0.5329
21.9
0.5041
25.00
0.0049
22.75
0.0196
25.10
0.0289
22.75
0.0196
25.20
0.0729
22.75
0.0196
25.30
0.1369
23.3
0.4761
25.40
0.2209
23.4
0.6241
25.50
0.3249
23.4
0.6241
26.30
1.8769
23.5
0.7921
26.31
1.9044
23.5
0.7921
26.32
1.9321
23.6
0.9801
SUM
12.8380
9.4160
Mach3
19.74
19.75
19.76
19.9
20
20.1
20.3
20.4
20.5
20.5
20.6
20.7
22.1
22.2
22.3
(x-mean)^2
0.7225
0.7056
0.6889
0.4761
0.3481
0.2401
0.0841
0.0361
0.0081
0.0081
0.0001
0.0121
2.2801
2.5921
2.9241
11.1262
drtamil@gmail.com 2012
1
2
(xij X j )
MSE =
N K j i
4 Note
drtamil@gmail.com 2012
Notes on MSE
4 If
~ 9.4160 ~ 11.1262)
ANOVA F Test
4 The
SSB (K 1)
F=
MSE
where K is the number of groups.
4 Under
Time to Analyse:
F test p-value
To get a p-value we
compare our F statistic
to an F(2, 42)
distribution.
Time to Analyse:
F test p-value
To get a p-value we
compare our F statistic
to an F(2, 42)
distribution.
In our example
141.492 2
F=
= 89.015
33.3802 42
We cannot draw the line
since the F value is so
large, therefore the p
value is so small!!!!!!
drtamil@gmail.com 2012
Time to Analyse:
F test p-value
To get a p-value we
compare our F statistic
to an F(2, 42)
distribution.
In our example
141.492 2
F=
= 89.015
33.3802 42
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of
Squares
df
Mean
Square
141.492
40.746
42
.795
Total
44
Between
Groups
174.872
Sig.
89.015 .0000000
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of
Squares
df
Mean
Square
141.492
40.746
42
.795
Total
44
Between
Groups
174.872
Sig.
89.015 .0000000
Pop Quiz!: Where are the following quantities presented in this table?
Sum of Squares
Between (SSB)
Mean Square
Error (MSE)
F Statistic
p value
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of
Squares
df
Mean
Square
141.492
40.746
42
.795
Total
44
Between
Groups
174.872
Sum of Squares
Between (SSB)
Mean Square
Error (MSE)
Sig.
89.015 .0000000
F Statistic
p value
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of
Squares
df
Mean
Square
141.492
40.746
42
.795
Total
44
Between
Groups
174.872
Sum of Squares
Between (SSB)
Mean Square
Error (MSE)
Sig.
89.015 .0000000
F Statistic
p value
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of
Squares
df
Mean
Square
141.492
40.746
42
.795
Total
44
Between
Groups
174.872
Sum of Squares
Between (SSB)
Mean Square
Error (MSE)
Sig.
89.015 .0000000
F Statistic
p value
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of
Squares
df
Mean
Square
141.492
40.746
42
.795
Total
44
Between
Groups
174.872
Sum of Squares
Between (SSB)
Mean Square
Error (MSE)
Sig.
89.015 .0000000
F Statistic
p value
ANOVA In SPSS
4
ANOVA in SPSS
4
4
4
4
ANOVA in SPSS
4 Select
Descriptive,
Homegeneity of
variance test and
Means plot.
4 Click Continue and
then OK.
drtamil@gmail.com 2012
ANOVA Results
Descriptives
Birth weight
N
Housewife
Office work
Field work
Total
151
23
44
218
Mean
2.7801
2.7643
2.8430
2.7911
Std. Deviation
.52623
.60319
.55001
.53754
Std. Error
.04282
.12577
.08292
.03641
Minimum
1.90
1.60
1.90
1.60
Maximum
4.72
3.96
3.79
4.72
4 Compare
df1
2
df2
215
Sig.
.470
4 Look
drtamil@gmail.com 2012
ANOVA Results
ANOVA
Birth weight
Between Groups
Within Groups
Total
Sum of
Squares
.153
62.550
62.703
df
2
215
217
Mean Square
.077
.291
F
.263
Sig.
.769
4 So
drtamil@gmail.com 2012
Mean+sd
Office
2.76 + 0.60
Housewife
2.78 + 0.53
Farmer
2.84 + 0.55
Test
ANOVA
F = 0.263
0.769
drtamil@gmail.com 2012
Proportionate Test
drtamil@gmail.com 2012
Proportionate Test
4 Qualitative
drtamil@gmail.com 2012
Formula
z=
p1 p2
1 1
p0 q0 +
n1 n2
p1n1 + p2 n2
p0 =
n1 + n2
q0 = 1 p0
drtamil@gmail.com 2012
http://stattrek.com/hypothesistest/proportion.aspx
4 The
Example
4 Comparison
Cont.
p1
p0
p2
q0
drtamil@gmail.com 2012
Cont.
4 p0
= (29/96*96)+(24/104*104) = 0.265
96+104
4 q0
= 1 0.265 = 0.735
drtamil@gmail.com 2012
Cont.
4z
0.302 - 0.231
= 1.1367
((0.735*0.265) (1/96 + 1/104))0.5
4 From
4 Comparison
Answer
4 P1