Добавил:
Sekretar
kiopkiopkiop18@yandex.ru
t.me/Prokururor I Вовсе не секретарь, но почту проверяю
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Ординатура / Хирургия / Библиотека им академика М.И. Перельмана / Книга_155_библиотеки_им_акад_М_И_Перельмана
.pdf
11.10 Fisher’s Exact Test for Small Samples 259
a = 10, b = 8, c = 6, d = 16,
E = 18, F = 22, G = 16, H = 24 and N = 40
By replacing them in the above-simplified formula, the result is exactly the same:
χ
2
=
N
(
a.d − b.c
)
2
E.F .G.H
=
40 ×
(
10 × 16 − 8 × 6
)
2
16 × 24 × 18 × 22
=
501760
152064
= 3.2997
It should be r emembered that if the sample size is small, we will have some bias in
the Chi-square calculation and calculate it larger than its actual value. For this reason,
Yates correction is used to eliminate the bias value. The Chi-square test statistics in
tables 2 × 2 after applying Yates correction will be as follows:
χ
2
Y
=
N
|
a.d − b.c
|
−
N
2
2
E.F .G.H
Altman (p. 252), however, recommends the use of Yates correction even for large
examples.
11.10 Fisher’s Exact Test for Small Samples
The general guideline for using the Chi-square t est is that at least 80% of cells should
have expected values greater than or equal to 5. Specifically, for a 2 × 2 table, all
cells should meet this criterion. Therefore, even with Yates correction, the expectation
for the size of expected frequencies remains. However, in practice, this rule can be
slightly relaxed to permit one cell to have an expected value slightly lower than 5.
In cases where tables have very small expected frequencies, the renowned
statistician R. A. Fisher proposed an alternative approach known as Fisher’s exact
test.
This method is also based on the observed row and column totals, but has a
little difference in principle from previous ones. The Fisher’s exact test is purely a
hypothesis test, which provides the exact p-value instead of test statistic and should
be compared with significant level of
α. The null hypothesis for it, like the Chi-
squared test, is that the row and column variables are unrelated. Considering Table
7.
6, Fisher’s exact test formula will be as follows:
p =
a + b
a
c + d
c
n
a + c
=
a + b
b
c + d
d
n
b + d
=
E!× F!× G!× H !
N !× a!× b!× c!× d !
,
https://t.me/med1917

260 11 Hypothesis Testing
Table 11.8 Type of exercise
by the gender
Swimming Pilates Sum
Men 4 3 7
Women 2 6 8
Sum 6 9 15
where the symbol “x!” is “x factorial”, which means that we multiply together all
the integers from 1 up to x. For instance, 5! = 1 × 2 × 3 × 4 × 5 = 120.
The above formula is obviously based on the exact hypergeometric probability
distribution.
Example 11.16
Consider the previous example with a sample size of 15 athletes as
in Table
11.8. Is the type of exercise independent of the athlete’s gender?
Solution: To calculate Fisher’s exact probability, we use the given information:
a = 4, b = 3, c = 2, d = 6, E = 7, F = 8, G = 6, H = 9 and N = 15
By placing them in the above-simplified formula, the result is exactly the same:
p =
E!× F!× G!× H !
N !× a!× b!× c!× d !
=
7!× 8!× 6!× 9!
15!× 4!× 3!× 2!× 6!
= 0.196
The obtained p-value is greater than the significance level of 0.05, so the null
hypothesis is not rejected, that is the type of sport is independent of athlete’s gender.
11.11 Tests of Homogeneity
In contingency tables, we typically focus on testing the independence between the
row and column variables, where the sample data is drawn from a single population.
In such cases, both the row and column variables are considered random.
However, there are situations where samples are randomly selected from different
populations, or where values of one variable (e.g., the row variable) are assigned by
the investigator and are not random. In these scenarios, the assigned values can
be treated as separate populations. The objective then becomes testing whether the
distribution of the randomly selected variable (typically the column variable) is the
same across each category of the other variable (the row variable). This type of
analysis is referred to as a “test of homogeneity” or a contingency table with one
margin fixed. “Homogeneity” here refers to the idea of having the same quality or
proportion.
For example, consider a study comparing two types of diet, A and B, involving
100 adults. Sixty adults are randomly assigned to diet A, while the remaining 40 are
https://t.me/med1917

11.11 Tests of Homogeneity 261
assigned to diet B. After four months, each participant’s satisfaction level is recorded
as “Satisfied”, “Moderate”, or “Unsatisfied”. The frequencies recorded in Table
11.9
are used to test the null hypothesis that there is no difference in satisfaction levels
between the two diets.
In Table 11.9a, the samples were assigned to row categories (Diet A or Diet B),
while only the column variable (satisfaction level) is random. Our objective is to
conduct a test of homogeneity to determine whether the distribution of outcomes
(satisfaction levels) is the same for each row (diet type). This test follows the same
methodology as a test of independence.
Since the two rows of Table 11.10 represent independent samples, it would be
appropriate to compute the probabilities (relative frequencies) for each row to provide
a better description of the data.
These are given in Table 11.9a.
Now, this table allows us to describe the null hypothesis more clearly. The null
hypothesis of “no difference” is equivalent to the statement that, f or each response
category, the probability is the same for diet A and diet B, i.e.:
H
0
: p
(
A1
)
= p
(
B1
)
and p
(
A2
)
= p
(
B2
)
and p
(
A3
)
= p
(
B3
)
H
A
: p
(
A1
)
/= p
(
B1
)
or p
(
A2
)
/= p
(
B2
)
or p
(
A3
)
/= p
(
B3
)
Solution: As previous example, we calculate the expected frequencies for all cells.
For example, expected frequency for satisfied by and Moderate cells of Diet A are:
Table 11.9 Point of view under two different diets
Satisfied Moderate Unsatisfied Sum
Diet A 24 22 14 60
Diet B 11 23 6 40
Total 35 45 20 100
Table 11.9a Point of view under two different diets
Satisfied Moderate Unsatisfied Sum
Diet A p
(
A1
)
p
(
A2
)
p
(
A3
)
1
Diet B p
(
B1
)
p
(
B2
)
p
(
B3
)
1
Table 11.9b Expected frequencies of Table
11.10
Satisfied Moderate Unsatisfied Sum
Diet A 21 27 12 60
Diet B 14 18 8 40
Total 35 45 20 100
https://t.me/med1917

262 11 Hypothesis Testing
Table 11.9c Calculations for Chi-square test statistic
Satisfied Moderate Unsatisfied Sum
Diet A
(
24 − 21
)
2
21
= 0.43
(
22 − 27
)
2
27
= 0.93
(
14 − 12
)
2
12
= 0.33
–
Diet B
(
11 − 14
)
2
14
= 0.64
(
23 − 18
)
2
18
= 1.39
(
6 − 8
)
2
8
= 0.50
–
Total – – – 4.22
E =
35 × 60
100
= 21 and E =
45 × 60
100
= 27
Then, the expected frequencies are summarized in Table 11.9b:
Calculation for Chi-square test statistic is shown in Table 11.9c:
Thus, the test statistic of Chi-square in this example is equal to χ
2
= 4.22.The
critical value with degree of freedom 2 is equal to
χ
2
= 5.991. Because the test
statistic is less than the critical value, there is no reason to reject the null hypothesis.
That is, the probability of adults point view level in two types of diet is the same.
11.12 Chi-Squared Test for Trend
When there is a binary variable with two categories (say, yes and no) and an ordinal
variable with k categories (e.g., non-smoker, light-smoker, moderate-smoker, and
heavy-smoker), William Cochran (
https://en.wikipedia.org/wiki/William_Gemm
ell_Cochran) and Peter Armitage (https://en.wikipedia.org/wiki/Peter_Armitage)
modified the Chi-square test to assess the presence of an association (
https://en.wik
ipedia.org/wiki/Association_%28statistics%29) between a dichotomous variable
and an ordinal variable and named “Chi squared test for trend” or
Cochran–Armitage test for trend. The Chi-square test for trend provides a more
powerful test than the usual Chi-squared test, because it is a Chi-squared
distribution with one degree of freedom instead k–1 degrees of freedom for the
usual Chi-squared test. Although the value of
χ
2
trend
for trend will always is less
than
χ
2
for the overall comparison. For example, for different doses of a treatment
as “low”, “medium”, and “high”, we may consider that the treatment benefit cannot
become smaller as the dose increases or we are interested to study wheezing in
different groups of smokers (non-smoker, light-smoker, moderate-smoker, and
heavy-smoker).
To conduct this test, we need to assign ranks to each group. If the variable has
a clear quantitative score, we can use these scores as ranks. For instance, in the
case of shoe size data, we can assign ranks such as 3.5, 4.0, 4.5, 5.0, 5.5, and 6.0.
Alternatively, integer scores like 1, 2, 3, 4, 5, and 6 can also be used. Equally spaced
https://t.me/med1917

11.12 Chi-Squared Test for Trend 263
scores are typically recommended when the dose-dependent shape of the binomial
proportions is unknown beforehand. The test statistic is obtained as:
χ
2
trend
=
N
N
k
i=1
r
i
.x
i
− R.
n
i
.x
i
2
R
(
N − R
)
N
k
i=1
n
i
.x
2
i
−
n
i
.x
i
2
Or
χ
2
trend
=
k
i=1
r
i
.x
i
− R.x
2
p
(
1 − p
)
k
i=1
n
i
.x
2
i
− N .x
2
where
N =
k
i=1
n
i
, R =
k
i=1
r
i
, p =
R
N
, and
x =
k
i=1
n
i
.x
i
N
Example 11.18
In a sample of 200, people are categorized as Table 11.10 based on
the severity of smoking and wheezing. Researcher is interested to investigate whether
wheezing increases with increasing smoking levels.
Solution: To obtain the test statistic, first add a column for the smoking level to the
table above and then complete the calculations in Table
11.11.
By replacing the calculated values in the above formula, the Chi-square statistic
for trend is obtained with both formulas:
χ
2
trend
=
k
i=1
r
i
.x
i
− R.x
2
p
(
1 − p
)
k
i=1
n
i
.x
2
i
− N .x
2
Table 11.10 Distribution of
people with wheezing in
terms of smoking level
Smoker Wheezing
Yes No Tot a l
Non 8 60 68
Light 12 36 48
Moderate 15 28 44
Heavy 25 15 40
70 130 200
https://t.me/med1917

264 11 Hypothesis Testing
Table 11.11 Required calculation for Chi-square test for trend for table above
Smoker Score (x) Wheezing r
i
.x
i
n
i
.x
i
n
i
.x
2
i
Yes = r No Total = n
Non 1 8 60 68 8 68 68
Light 2 12 36 48 24 96 192
Moderate 3 15 28 44 45 132 396
Heavy 4 25 15 40 100 160 640
Sum R = 70 N −R =
130
N = 200
r.x =
177
n.x =
456
n.x
2
=
1296
p =
R
N
=
70
200
= 0.35 and x =
n.x
N
=
456
200
= 2.28
=
[
177 − 70 × 2.28
]
2
0.35
(
1 − 0.35
)
1296 − 200 × 2.28
2
= 5.192.
χ
2
trend
=
N
N
k
i=1
r
i
.x
i
− R.
n
i
.x
i
2
R
(
N − R
)
N
k
i=1
n
i
.x
2
i
−
n
i
.x
i
2
=
200
[
200 × 177 − 70 × 456
]
2
70
(
200 − 70
)
200 × 1296 −
(
456
)
2
= 5.192.
The Chi-square test statistic (5.192) is larger than the critical value in the Chi-
square distribution with one degree of freedom (3.841) and the null hypothesis (
H
0
)
is rejected.
0
0.2
0.4
0.6
0.8
1234
To run the Chi-square test in SPSS, select analyze\Descriptive Statistics\Crosstab
or Analyze\Nonparametric Tests\Legacy Dialogs\Chi-square to open a window like
the one below.
https://t.me/med1917

11.13 McNemar’s Test for Paired Proportions 265
In this window, enter categorical variable into right box and press OK.
11.13 McNemar’s Test for Paired Proportions
In scenarios where measurements are taken before and after an intervention on the
same group of individuals, or when two experts evaluate the same group of patients
based on certain characteristics, or when paired observations are made, such as
in age and gender-matched individuals with similar clinical conditions randomly
assigned to different treatment methods (A and B), the measurements, opinions, or
observations within each pair are not independent. This is because they pertain to
the same individuals.
Tips
A discordant pair is a matched pair in which the outcome differs for each
member of the pair with the other.
A concordant pair is a matched pair in which the outcome is the same for
each member of the pair.
In such cases, traditional tests like the Chi-square test or Fisher’s exact test are not
suitable. Instead, we can employ the McNemar test, which is specifically designed
for analyzing paired categorical data or repeated measures data.
Paired samples mean that the two “groups” consist of data from t he same group
observed at multiple points in time, or measured by two raters.
https://t.me/med1917

266 11 Hypothesis Testing
In this test, the variables must have nominal or ordinal scales, or if they are
quantitative, they can be transformed into binary variables. In this test, the values
of two proportions, which are in the form of pairs of binomial samples (
p
A
, p
B
),
are compared. In this test, the null hypothesis
H
0
: p
A
= p
B
orb = c
is tested against
the alternative hypothesis
H
A
: p
A
/= p
B
orb /= c
. Paired data can be summarized as
Table 2 × 2 below (Table
11.12).
In this table, cells a and d are concordant observations with both methods and
cannot provide useful information. However, cells b and c present discordant
observations and are of particular importance in this test. If the sample size is large
(
b + c ≥ 20), then both z (normal) and Chi-square statistics can be used for this
test.
z =
(
|
b − c
|
− 1
)
√
b + c
and χ
2
1,
(
1−α
)
=
(
|
b − c
|
− 1
)
2
b + c
These two tests are exactly equivalent. If the calculated test statistic at the
significant level of (
α)% is greater than the critical value in the corresponding
tables, then the null hypothesis is rejected.
When, say, (b + c) < 20, then χ
2
is not well-approximated by the Chi-squared
distribution and a two-tailed exact test, based on the cumulative binomial distribution
with p = 0.5, can be used instead.
p = 2 ×
n
i=max b or c
n
i
× 0.5
n
where “n = b + c” and the factor 2 is used to compute the two-tailed p-value (be
careful, here “n” is not the total sample size).
Example 11.20
In order to compare survival rate with breast cancer treatments, A
and B, a study of 207 pairs of cancer patients matched in terms of age, sex, and
clinical conditions was investigated. Each member of these pairs was assigned to
one of the two treatments A and B randomly. After 5 years, 75 patients in group A
and 72 patients in group B survived which their information has been presented in
Table
11.13.
Table 11.12 How the paired observations are located
Rater B
Positive Negative
Rater A Positive a b d + a
Negative c d d + c
c + a d + b N
https://t.me/med1917

11.13 McNemar’s Test for Paired Proportions 267
Table 11.13 Outcomes of the disease treatment in terms of two methods A and B
Treatment B
Alive Died Sum
Treatment A Alive 70 5 75
Died 2 30 32
Sum 72 35 207
At a significant level of 5% and after 5 years, is the survival rate differed with
these two treatments?
Solution: In this example, a = 70, b = 5, c = 2, and d = 30. Since b + c = 5 +
2 = 7 is less than 20, z and
χ
2
test statistics are not appropriate and we will apply
cumulative binomial distribution with p = 0.5.
The maximum value of b and c is the max (5, 2) = 5, then i = b = 5 and n = b
+ c = 5 + 2 = 7. Replacing above elements we have:
n
i=max bor c
n
i
× 0.5
n
=
7
i=5
7
5
× 0.5
7
=
7
5
× 0.5
7
+
7
6
× 0.5
7
+
7
7
× 0.5
7
=
7
5
+
7
6
+
7
7
× 0.5
7
=
[
21 + 7 + 1
]
× 0.0078125 = 0.226565
and
p = 2 ×
n
i=max borc
n
i
× 0.5
n
= 2 × 0.226565 = 0.453
which is greater 0.05 and we cannot reject the null hypothesis.
However, if we ignore the assumption b + c < 20, the χ
2
statistic will be as:
χ
2
=
(
|
b − c
|
− 1
)
2
b + c
=
(
|
5 − 2
|
− 1
)
2
5 + 2
= 0.571
To execute McNemar test in SPSS, first select the path to open a new window.
https://t.me/med1917

268 11 Hypothesis Testing
In this window, we first move the dichotomous variables to the right boxes called
Row(s) and Column(s). Then, by selecting the Statistics option, another window
opens. On the bottom right of this sub-window, mark the McNemar option and close
it by pressing Continue. Then it runs McNemar test with confirming OK.
It should be noted that the McNemar test can be run through the path
Analyze\Nonparametric tests\Related samples. After selecting this path, a window
opens.
In this window, click “customize analysis” in the “What is your objective” box?
Then go to the “Fields” section at the top of the window and enter your variables into
the “Test Fields” box. Then, from the top of the Settings window, select “customize
tests” option to enable its options. You can now mark “McNemar’s test (2 samples)”
to run the test.
11.14 Confidence Intervals and Hypothesis Tests?
Looking at the formulas of confidence interval and two-tailed statistical tests, it can
be found that there is a logical and close link between hypothesis test and confidence
intervals. Because four elements: confidence coefficient, standard error, sample size
and point estimation of parameter have a direct role in the formula of both. Therefore,
there is a clear and strong relationship between confidence interval and p-value which
is the outcome of the hypothesis test and the conclusions are consistent with both
https://t.me/med1917
Соседние файлы в папке Библиотека им академика М.И. Перельмана
