Statistical Packages
FIVE
1 Dr Mahi
Statistical Inference about
Difference between Two Populations
Means (𝝁𝟏 -𝝁𝟐 ) {Continued}
Independent Samples Dependent Samples
Parametric Non- Parametric Non-
parametric parametric
Dr Mahi
Introduction to Statistical Hypotheses Testing:
Parametric Tests Non-Parametric Tests
One Two K One Two K
Sample Samples Samples Sample Samples Samples
Independent
Independent
Independent
Independent
Dependent
Dependent
Dependent
Dependent
1) Requires specific assumptions about the 1) Does not require any assumptions about
distribution of the data. The data distribution.
2) Used with quantitative data only. 2) Used with quantitative & qualitative data.
3) Have greater power. 3) Have less power.
3
Dr Mahi
One Sample tests
Non-Parametric
Parametric Tests
Tests
Population is Normal Population is not Normal
1-sample Z 1-sample t 1-sample 1-sample
Wilcoxon sign
Variance of Variance of
the the Not
population population Symmetric
is Known
symmetric
is unknown
Testing for the mean Testing for the median
4 Dr Mahi
Two Sample tests
Independent Dependent
Samples Samples
Non- Non-
Parametric Parametric Parametric
Tests Tests Parametric
Tests Tests
2 independent Mann-Whitney Wilcoxon
samples t-test test Paired t-test test
Testing for the Testing for the Testing for the Testing for the
5 mean median Dr Mahi mean median
Testing hypotheses for 2-dependent (related) samples
( Parametric case)
Paired t-test
Stat Basic Statistics Paired t-test
Paired t-test or paired comparison is used when comparing two sets
of paired measurements to assess whether their population means
differ, such as: pretest/posttest scores, the weight before and after a
diet program, the production before and after applying a new
production method, marks of students before and after applying a
new way of teaching.
This test is designed to situations where there is dependence between
pairs of measurements (i.e. when the data is in the form of matched
pairs. This test is not suitable for comparing two independent
samples.
Dr Mahi
Assumptions of the paired t- test:
1) The measured differences are normally distributed:
2) Subjects must be independent and random:
Measurements of one subject do not affect measurements of any other subject.
3) Each of the paired measurements must be obtained from
the same subject:
For example, the before and after weight of a person or scores of students must be
from the same subject or person.
4) This test is used with numeric and continuous data :
7 Dr Mahi
8 Dr Mahi
Two tailed left tailed
Right tailed
9
Dr Mahi
Example 1:
Given the following data for 9 students stored in columns c5 and c6 for
their mean weights before and after following a certain diet program:
μ1 μ2
A nutrition claims that
the diet program is
Before After
effective at 5%
significance level.
Solution:
Effective means that the
program leads to
decreases the weights
after, means μ2 ˂ μ1,
Ho: 𝝁𝟏 ≤ 𝝁𝟐 Or μ1˃ μ2,
˃
Or μ1 - μ2 ˃ 0
H1: 𝝁𝟏 𝝁𝟐 claim
10
Dr Mahi
How to find the differences?????
Before - After
C5 – C6
11 Dr Mahi
Let’s first satisfy the assumptions of the test before applying the test:
1) The differences are normally distributed:
Stat Basic Statistics Normality Test
Differences
Before
After
Differences
The P-value of Anderson Darling test ensures to accept normality as the P-value is greater
12
than 0.05, Also the dots are around the diagonal line in a narrow range. Dr Mahi
2) Subjects must be independent and random:
Stat nonparametric Runs Test
Runs Test: Difference The P-value of the runs test is
greater than 0.05 which shows
Runs test for Difference that we accept Ho of
Runs above and below K = 0.344444 randomness of the differences.
The observed number of runs = 8
The expected number of runs = 5.44444
4 observations above K; 5 below
* N is small, so the following approximation may be invalid.
P-value
13 = 0.065
Dr Mahi
After exploring the assumptions of
the Paired t-test, and we are sure
that the assumptions are satisfied,
let’s now apply main test with its
steps:
14 Dr Mahi
Stat Basic Statistics Paired t-test
c5
c6
c5
Difference ˃ hypothesized difference
15 Dr Mahi
Paired T-Test and CI: before; after
Paired T for before - after Options
N Mean StDev SE Mean
Before 9 91.08 4.46 1.49
After 9 90.73 4.80 1.60
Difference 9 0.344 1.963 0.654
95% lower bound for mean difference: -0.873
T-Test of mean difference = 0 (vs > 0): T-Value = 0.53 P-Value = 0.306
Paired T-Test and CI
N Mean StDev SE Mean
Difference 9 0.344 1.963 0.654
95% lower bound for mean difference: -0.873
T-Test of mean difference = 0 (vs > 0): T-Value = 0.53 P-Value = 0.307
16
Dr Mahi
Ho: 𝝁𝟏 ≤ 𝝁𝟐 Ho: 𝝁𝟏 −𝝁𝟐 ≤ 𝟎
H1: 𝝁𝟏 ˃ 𝝁𝟐 claim H1: 𝝁𝟏 −𝝁𝟐 ˃ 𝟎 claim
1) Because the P-value of the paired-t test is 0.306 which is greater
than the significance level 0.05, then the null hypothesis is
accepted and we rejected the alternative hypothesis (we reject
the claim) , we conclude that the diet program is not effective, so
we rejected the nutrition’s claim.
17 Dr Mahi
Graphs
The hypothesized value ( 0) in the three graphs of the differences is
inside the confidence interval which means accepting Ho and rejecting
the claim of the effectiveness of the diet program.
Also, the three confidence intervals are (-ve , +ve) which ensures to
that the test is two tailed not a right tailed test, and we should reject
the 18claim of right tailed test.
Dr Mahi
Example 2:
Given the following data that measures the blood sugar for diabetic 8
patients before and after taking a new drug to treat diabetes:
A doctor claims that the new drug is
μ1 effective. Test the doctor’s claim at
μ2
5% significance level.
Solution
Effective means that the drug leads
to decreases the blood sugar in
blood after patients using it.
Which means that the claim is
μ2 ˂ μ1,
Or μ1˃ μ2,
Or μ1 - μ2 ˃ 0
19 Dr Mahi
Check by yourself the availability of the assumptions of the Paired t-
test.
20
Dr Mahi
Ho: 𝝁𝟏 ≤ 𝝁𝟐 Ho: 𝝁𝟏 −𝝁𝟐 ≤ 𝟎
H1: 𝝁𝟏 ˃ 𝝁𝟐 claim H1: 𝝁𝟏 −𝝁𝟐 ˃ 𝟎 claim
1) Because the P-value of the paired-t test is 0.002 which is smaller
than the significance level 0.05, then the null hypothesis is
rejected and we accepted the alternative hypothesis (we accepted
the claim) , we conclude that the new drug is effective, so we
accepted the doctor’s claim.
2) The lower bound of the confidence interval is (52.5) which means
that both limits are positive, this means that the interval does not
contains zero (the hypotheized value), so this also ensures to reject
Ho and accept H1 as we accept the claim .
3) The sign of both limlts are positive ( +, +), which ensures that the
test is a a right tailed test and the claim is accepted.
21 Dr Mahi
Testing hypotheses for 2-dependent (related) samples
( Non-Parametric case)
Wilcoxon matched-pairs signed rank test
This test is a non-parametric statistical test and is used to compare
before–after measurements on the same unit, or matched subjects
(related samples).It is used when we wish to investigate any change in
scores from one time point to another, or when individuals are
subjected to more than one condition.
This test is equivalent to the paired t- test but it doesn’t assume
normality of the differences of the related groups, so it is used when
the assumptions of the paired t- test is inappropriate (when the
assumption of normality failed) and is used when the differences is
symmetric.
This test assesses whether the median difference between pairs of
observations
22
is zero ( Ƞ1 - Ƞ2 = 0 ).
Dr Mahi
What is the difference between
Mann-Whitney test and Wilcoxon
matched-pairs test ?
Although both are non-parametric tests,
Mann-Whitney test is applied to independent
samples, while Wilcoxon matched-pairs test is
applied to matched or dependent samples.
23 Dr Mahi
Assumptions of Wilcoxon matched-pairs test:
1) The differenced are not normally distributed( non-parametric):
2) Subjects must be independent and random:
3) This test is used with numeric and continuous data :
4) The distribution of differences is symmetric:
Stat Non-parametric 1-Sample Wilcoxon
24 Dr Mahi
Example 3:
Given the following data that measures the weight for 8 trainers at a
certain gem before and after practicing exercises:
A coach at the gem claims that
the practicing exercises does
not affect the weight of the
trainers(The weight before and
after practicing exercises is the
same/ equal) Test this claim at
5% significance level using
Wilcoxon signed rank test.
Solution:
Ƞ1 Ƞ2
Ƞ1 = Ƞ2, claim
Or Ƞ1 - Ƞ2 = 0,
25
Dr Mahi
First we should calculate the differences and store them in a
new column to make the test on this new column or on this
new data (differences = before – after)
Calc Calculator Expression: C1 –C2 Store result in C3
Nonparametric
Stat
1 sample
Wilcoxon
26
C1 before
c3
C2 after
C3 difference
0
Not equal
27
Dr Mahi
Ho: Ƞ𝟏 = Ƞ𝟐 claim
H1: Ƞ𝟏 ≠ Ƞ𝟐
OR
Ho: Ƞ𝟏 − Ƞ𝟐 = 0 claim Ho: Diff. = 0
H1: Ƞ𝟏 −Ƞ𝟐 ≠ 0 H1: Diff. ≠ 0
Wilcoxon Signed Rank Test: C3
Test of median = 0.000000 versus median ≠ 0.000000
N for Wilcoxon Estimated
N Test Statistic P Median
C3 8 8 34.5 0.025 10.75
Wilcoxon Signed Rank CI: before-after
Confidence
Estimated Achieved Interval
N Median Confidence Lower Upper
before-after 8 10.8 94.1 3.5 15.0
28
Dr Mahi
1) As the p-value is less than 5%, then we reject Ho, thus we reject the
claim of the coach and accept H1 that practicing exercises affect
the weight of the trainers, that the two medians for the weights
before and after differ and not equal.
2) By calculating the confidence interval for the difference between
the two medians , we found that the confidence interval does not
contain the hypothesized value Zero, this also ensures to reject the
null hypothesis and accept the alternative.
3) Both limits of the confidence interval are (+, +) which also ensures
that the test is a right tailed test not a two tailed, this also ensures
to reject the null hypothesis of a two tailed test and accept the
alternative.
29 Dr Mahi
Home Work
Five
30 Dr Mahi
Exercise 1
Given below the marks of students in Accounting subject for a sample
of 10 students in both Ain-Shams University and Asuit University:
1) The marks of student of students in Ain-Shams University are:
2) The marks of student of students in Asuit University are:
Use a suitable test to test whether there is a difference between the
marks of students in both subjects using 5% significance level.
State every thing about the test.
31 Dr Mahi
Exercise 2
In order to investigate whether adults report verbally presented
material more accurately from right than from their left ear, a dichotic
listening task was carried out. The data were found to be positively
skewed.
An analyst analyze the data and
claimed that there is a difference
between the number of words
recalled from the right ear and the
number of words recalled from the
Left ear.
Do you accept the analyst’s claim?
Which test should you use to test
this claim?
Justify your answer briefly.
32
Dr Mahi
Exercise 3
Comment on this graph.
33 Dr Mahi
Thank You
34
Dr Mahi