Inferential Statistics, T Test, ANOVA & Proportionate Test
Inferential Statistics, T Test, ANOVA & Proportionate Test
©[email protected] 2012
FF2613
Inferential Statistics
©[email protected] 2012
Inferential Statistic
©[email protected] 2012
Drug A Better Than Drug B?
©[email protected] 2012
Null Hypothesis
4 Null Hyphotesis;
©[email protected] 2012
Null Hypothesis
©[email protected] 2012
Can reindeer fly?
4 You believe reindeer can fly
4 Null hypothesis: “reindeer cannot fly”
4 Experimental design: to throw reindeer off the
roof
4 Implementation: they all go splat on the ground
4 Evaluation: null hypothesis not rejected
• This does not prove reindeer cannot fly: what you have
shown is that
– “from this roof, on this day, under these weather conditions,
these particular reindeer either could not, or chose not to,
fly”
4 It is possible, in principle, to reject the null
hypothesis
• By exhibiting a flying reindeer!
©[email protected] 2012
Significance
4 Inferential statistics determine whether a significant
difference of effectiveness exist between drug A
and drug B.
4 If there is a significant difference (p<0.05), then the
null hypothesis would be rejected.
4 Otherwise, if no significant difference (p>0.05), then
the null hypothesis would not be rejected.
4 The usual level of significance utilised to reject or
not reject the null hypothesis are either 0.05 or 0.01.
In the above example, it was set at 0.05.
©[email protected] 2012
Confidence interval
Reject H0 Reject H0
.025 .025
-2.0639
-1.96 0 2.0639
1.96 t
©[email protected] 2012
Fisher’s Use of p-Values
©[email protected] 2012
Error
©[email protected] 2012
Error
REALITY
©[email protected] 2012
Type I Error
©[email protected] 2012
Type II Error
p = 0.136. p bigger than 0.05. No significant difference and the null hypothesis was not
rejected.
There was a large difference between the rates but were not
significant. Type II Error? ©[email protected] 2012
Not significant since power of
the study is less than 80%.
Power is only
32%!
©[email protected] 2012
Check for the errors
©[email protected] 2012
Determining the
appropriate statistical test
©[email protected] 2012
Data Analysis
©[email protected] 2012
Test of Association
©[email protected] 2012
Problem Flow Chart
Independent Variables
Suicidal Tendencies
Dependent Variable
©[email protected] 2012
Multivariat
©[email protected] 2012
Hypothesis Testing
©[email protected] 2012
Hypothesis Testing
Procedures
©[email protected] 2012
Parametric Test
Procedures
©[email protected] 2012
Parametric Analysis –
Quantitative
©[email protected] 2012
non-parametric tests
Variable 1 Variable 2 Criteria Type of Test
Qualitative Qualitative Sample size < 20 or (< 40 but Fisher Test
Dichotomus Dichotomus with at least one expected
value < 5)
Qualitative Quantitative Data not normally distributed Wilcoxon Rank Sum
Dichotomus Test or U Mann-
Whitney Test
Qualitative Quantitative Data not normally distributed Kruskal-Wallis One
Polinomial Way ANOVA Test
Quantitative Quantitative Repeated measurement of the Wilcoxon Rank Sign
same individual & item Test
Quantitative - Quantitative - Data not normally distributed Spearman/Kendall
continous continous Rank Correlation
©[email protected] 2012
Statistical Tests - Qualitative
©[email protected] 2012
Data Analysis
4Using SPSS;
http://161.142.92.104/spss/
4Using Excel;
http://161.142.92.104/excel/
©[email protected] 2012
FF2613
©[email protected] 2012
T - Test
Independent T-Test
Student’s T-Test
Paired T-Test
ANOVA
©[email protected] 2012
Student’s T-Test
4 To compare the means of two independent
groups. For example; comparing the mean
Hb between cases and controls. 2 variables
are involved here, one quantitative (i.e. Hb)
and the other a dichotomous qualitative
variable (i.e. case/control).
4 t=
©[email protected] 2012
Examples: Student’s t-
test
©[email protected] 2012
Example
Group Statistics
©[email protected] 2012
Assumptions of T test
©[email protected] 2012
Manual Calculation
©[email protected] 2012
Example – compare
cholesterol level
4 Hypertensive : 4 Normal :
Mean : 214.92 Mean : 182.19
s.d. : 39.22 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.
©[email protected] 2012
Calculation
X1 − X 2
t=
2 2
s s
1
+ 2
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
©[email protected] 2012
If df>100, can refer Table A1.
We don’t have 4.137 so we
use 3.99 instead. If t = 3.99,
then p=0.00003x2=0.00006
Therefore if t=4.137,
p<0.00006.
Or can refer to Table A3.
We don’t have df=98,
so we use df=60 instead.
t = 4.137 > 3.46 (p=0.001)
©[email protected] 2012
Exercise (answer)
4 Nullhypothesis rejected
4 There is a difference of marks between
UKM and ACMS students. UKM marks
higher than AUCMS
©[email protected] 2012
T-Test In SPSS
©[email protected] 2012
T-Test Results
Group Statistics
Std. Error
SGA N Mean Std. Deviation Mean
Weight at first ANC Normal 108 58.666 11.2302 1.0806
SGA 109 51.037 9.3574 .8963
©[email protected] 2012
Paired t-test
©[email protected] 2012
Paired T-Test
©[email protected] 2012
Formula
d −0
t=
sd
n
( ∑ d)
2
∑d i
2
−
n
sd =
n −1
df = n p − 1
©[email protected] 2012
Examples of paired t-test
©[email protected] 2012
Example
Paired Differences
Std. Sig.
Mean Deviation t df (2-tailed)
Pair DHAMAWK0 -
10.1563 6.75903 8.500 31 .000
1 DHAMAWK6
©[email protected] 2012
M a n u a l C a l c u l a t i o n
©[email protected] 2012
Calculation
©[email protected] 2012
Calculation
4∑ d = 112 ∑ d2 = 1842 n = 36
4 Mean d = 112/36 = 3.11
4 sd = ((1842-1122/36)/35)0.5 d −0
t=
sd
sd = 6.53 n
4 t = 3.11/(6.53/6)
t = 2.858 (∑ d )
2
4 df = np – 1 = 36 – 1 = 35. ∑ i−
d 2
n
sd =
n −1
4 Refer to t table;
df = n p − 1
©[email protected] 2012
Refer to Table A3.
We don’t have df=35,
so we use df=30 instead.
t = 2.858, larger than 2.75
(p=0.01) but smaller than 3.03
(p=0.005). 3.03>t>2.75
Therefore if t=2.858,
0.005<p<0.01.
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.
©[email protected] 2012
Paired T-Test In SPSS
Test…
©[email protected] 2012
Paired T-Test In SPSS
©[email protected] 2012
Paired T-Test Results
Paired Samples Statistics
Std. Error
Mean N Std. Deviation Mean
Pair HB2 10.247 70 .3566 .0426
1 HB3 10.594 70 .9706 .1160
©[email protected] 2012
Paired T-Test Results
Paired Samples Test
Paired Differences
95% Confidence
Interval of the
Std. Error Difference
Mean Std. Deviation Mean Lower Upper t df Sig. (2-tailed)
Pair 1 HB2 - HB3 -.347 .9623 .1150 -.577 -.118 -3.018 69 .004
Mean D
Group N Test p
(Diff.)
Before
treatment
Paired T-
(HB2) vs
70 0.35 + 0.96 test 0.004
After
t = 3.018
treatment
(HB3)
©[email protected] 2012
ANOVA
©[email protected] 2012
ANOVA –
Analysis of Variance
©[email protected] 2012
One-Way ANOVA
F-Test
4 Tests the equality of 2 or more population means
4 Variables
• One nominal scaled independent variable
– 2 or more treatment levels or classifications
(i.e. Race; Malay, Chinese, Indian & Others)
• One interval or ratio scaled dependent variable
(i.e. weight, height, age)
4 Used to analyse completely randomized
experimental designs
©[email protected] 2012
Examples
©[email protected] 2012
One-Way ANOVA
F-Test Assumptions
©[email protected] 2012
Example
Descriptives
Birth weight
N Mean Std. Deviation Minimum Maximum
Housewife 151 2.7801 .52623 1.90 4.72
Office work 23 2.7643 .60319 1.60 3.96
Field work 44 2.8430 .55001 1.90 3.79
Total 218 2.7911 .53754 1.60 4.72
ANOVA
Birth weight
Sum of
Squares df Mean Square F Sig.
Between Groups .153 2 .077 .263 .769
Within Groups 62.550 215 .291
Total 62.703 217
©[email protected] 2012
Manual Calculation
ANOVA
©[email protected] 2012
Manual Calculation
©[email protected] 2012
Example:
Time To Complete
Analysis
45 samples were
analysed using 3 different
blood analyser (Mach1,
Mach2 & Mach3).
If the combined
distances are large, that
indicates we should
reject H0.
The Anova Statistic
( )2
( )
2
(
SSB = 15 X Mach1 − X + 15 X Mach 2 − X + 15 X Mach3 − X )
2
( )2
( )
2
(
SSB = 15 X Mach1 − X + 15 X Mach 2 − X + 15 X Mach3 − X )
2
( )
2
( )2
(
SSB = 15 X Mach1 − X + 15 X Mach 2 − X + 15 X Mach3 − X )2
©[email protected] 2012
How big is big?
∑∑ (x − X j)
1 2
MSE = ij
N −K j i
∑∑ (x − X j)
1 2
MSE = ij
N −K j i
∑∑ (x − X j)
1 2
MSE = ij
N −K j i
MSE =
1
∑∑ (xij − X j )2
N −K j i
Mach1 (x-mean)^2 Mach2 (x-mean)^2 Mach3 (x-mean)^2
23.73 1.4400 21.5 1.2321 19.74 0.7225
23.74 1.4161 21.6 1.0201 19.75 0.7056
23.75 1.3924 21.7 0.8281 19.76 0.6889
24.00 0.8649 21.7 0.8281 19.9 0.4761
24.10 0.6889 21.8 0.6561 20 0.3481
24.20 0.5329 21.9 0.5041 20.1 0.2401
25.00 0.0049 22.75 0.0196 20.3 0.0841
25.10 0.0289 22.75 0.0196 20.4 0.0361
25.20 0.0729 22.75 0.0196 20.5 0.0081
25.30 0.1369 23.3 0.4761 20.5 0.0081
25.40 0.2209 23.4 0.6241 20.6 0.0001
25.50 0.3249 23.4 0.6241 20.7 0.0121
26.30 1.8769 23.5 0.7921 22.1 2.2801
26.31 1.9044 23.5 0.7921 22.2 2.5921
26.32 1.9321 23.6 0.9801 22.3 2.9241
SUM 12.8380 9.4160 11.1262
©[email protected] 2012
MSE =
1
∑∑ (xij − X j )2
N −K j i
©[email protected] 2012
Notes on MSE
In our example
141.492 2
F= = 89.015
33.3802 42
In our example
141.492 2
F= = 89.015
33.3802 42
Sum of Mean
Squares df Square F Sig.
Between
141.492 2 40.746 89.015 .0000000
Groups
Within Groups 33.380 42 .795
Total 174.872 44
ANOVA Table
Results are often displayed using an ANOVA Table
Sum of Mean
Squares df Square F Sig.
Between
141.492 2 40.746 89.015 .0000000
Groups
Within Groups 33.380 42 .795
Total 174.872 44
Pop Quiz!: Where are the following quantities presented in this table?
Sum of Mean
Squares df Square F Sig.
Between
141.492 2 40.746 89.015 .0000000
Groups
Within Groups 33.380 42 .795
Total 174.872 44
Sum of Mean
Squares df Square F Sig.
Between
141.492 2 40.746 89.015 .0000000
Groups
Within Groups 33.380 42 .795
Total 174.872 44
Sum of Mean
Squares df Square F Sig.
Between
141.492 2 40.746 89.015 .0000000
Groups
Within Groups 33.380 42 .795
Total 174.872 44
Sum of Mean
Squares df Square F Sig.
Between
141.492 2 40.746 89.015 .0000000
Groups
Within Groups 33.380 42 .795
Total 174.872 44
©[email protected] 2012
ANOVA in SPSS
4 Select ‘Descriptive’,
‘Homegeneity of
variance test’ and
‘Means plot’.
4 Click ‘Continue’ and
then ‘OK’.
©[email protected] 2012
ANOVA Results
Descriptives
Birth weight
95% Confidence Interval for
Mean
N Mean Std. Deviation Std. Error Lower Bound Upper Bound Minimum Maximum
Housewife 151 2.7801 .52623 .04282 2.6955 2.8647 1.90 4.72
Office work 23 2.7643 .60319 .12577 2.5035 3.0252 1.60 3.96
Field work 44 2.8430 .55001 .08292 2.6757 3.0102 1.90 3.79
Total 218 2.7911 .53754 .03641 2.7193 2.8629 1.60 4.72
©[email protected] 2012
Results & Homogeneity of
Variances
Test of Homogeneity of Variances
Birth weight
Levene
Statistic df1 df2 Sig.
.757 2 215 .470
©[email protected] 2012
ANOVA Results
ANOVA
Birth weight
Sum of
Squares df Mean Square F Sig.
Between Groups .153 2 .077 .263 .769
Within Groups 62.550 215 .291
Total 62.703 217
©[email protected] 2012
How to present the
result?
ANOVA
Housewife 2.78 + 0.53 0.769
F = 0.263
©[email protected] 2012
Proportionate Test
©[email protected] 2012
Proportionate Test
©[email protected] 2012
Formula
p1 − p2 • where p1 is the rate for
z= event 1 = a1/n1
1 1
p0 q0 + • p2 is the rate for event 2
= a2/n2
n1 n2
• a1 and a2 are frequencies
of event 1 and 2
©[email protected] 2012
http://stattrek.com/hypothesis-
test/proportion.aspx
©[email protected] 2012
Example
©[email protected] 2012
Cont.
p1 p2
p0 q0
©[email protected] 2012
Cont.
4 p0 = (29/96*96)+(24/104*104) = 0.265
96+104
4 q0 = 1 – 0.265 = 0.735
©[email protected] 2012
Cont.