Добавил:
kiopkiopkiop18@yandex.ru t.me/Prokururor I Вовсе не секретарь, но почту проверяю Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Ординатура / Хирургия / Библиотека им академика М.И. Перельмана / Книга_155_библиотеки_им_акад_М_И_Перельмана

.pdf
Скачиваний:
0
Добавлен:
10.10.2026
Размер:
7 Мб
Скачать
☆
11.6 Comparison the Proportions in Two Independent Groups 249
z =
(
0.364 − 0.083
)
0.0385
= 7.30
Since
|
7.30
|
> 1.96
, then we reject the null hypothesis (H
0
).
The incidence rate of flu is not equal in the vaccinated and unvaccinated groups.
This result was obtained exactly from the estimation of the confidence interval.
To perform a significant test in order to compare the proportions in two
independent groups in SPSS, first choose the path Analyze\Descriptive
statistics\Crosstab… to open a new window.
In this window, we first select the name of the binomial variables from the list on
the left and move them to the boxes on the right, called the “Row(s)” and “Column(s)”.
Then, we choose the “Cells” option to open another sub-window. In the r ight box
titled “z-test”, mark “Compare Column proportions” option and close the window
by pressing “Continue”.
In the main windows, again choose the “Statistics” option to open another sub-
window. In the top left, mark “Chi-square” option and close the window by pressing
“Continue”. Then press “OK” to run z test and have the following output.
https://t.me/med1917
250 11 Hypothesis Testing
11.7 Testing the Equality of Variance of Two Groups
Sometimes researchers are keen on assessing the equality of variance (standard
deviation) between two distinct groups. This inquiry arises from the common
prerequisite of numerous statistical models, which necessitate equal variance
(homogeneity). For instance, one might investigate whether the variability of body
temperature is consistent across different blood types, or compare the variance of
cholesterol levels between males and females. To address this, researchers employ
the f test or variance ratio test. Under the null hypothesis positing that two normally
distributed populations exhibit equal variances, the ratio of the two sample
variances is expected to follow a sampling distribution known as the F distribution.
The test statistic (F ) is obtained by dividing the larger variance by the smaller
variance and comparing the critical value in Table F with the degree of freedoms of
numerator and the denominator of the fraction.
F =
Larger of S
2
1
and S
2
2
Smaller of S
2
1
and S
2
2
If test statistic F > F
(
1−
α
2
,n
1
−1,n
2
−1
)
or F < F
(
α
2
,n
1
−1,n
2
−1
)
, the null hypothesis
(
H
0
), equality of two variances is rejected.
Also, we can calculate confidence interval for the variance ratio, when the
underlying data distribution is normal. Two-tailed
100
(
1 − α
)
% confidence interval
for variance ratio is:
S
2
1
S
2
2
×
1
F
(
α
2
,n
1
−1,n
2
−1
)
to
S
2
1
S
2
2
× F
(
α
2
,n
1
−1,n
2
−1
)
Under the null hypothesis being true (equality of variance of the two groups), the
variance ratio is equal 1. Therefore, if the confidence interval contains 1, there are
no reason and evidence to reject the null hypothesis. Null hypothesis can only be
rejected if the value 1 is outside the confidence interval
100
(
1 − α
)
%. That is, both
the upper and lower limits are either greater than one or both are less than one.
However, the two-tailed 100
(
1 − α
)
% confidence interval for a single variance
can be estimated by the following equation:
(
n − 1
)
S
2
χ
2
α
2
<σ
2
<
(
n − 1
)
S
2
χ
2
1−
α
2
https://t.me/med1917
11.7 Testing the Equality of Variance of Two Groups 251
Example 11.12 A researcher aims to ascertain whether there is a difference in the
variance of heart rates (measured in beats per minute, bpm) between smokers and
non-smokers. He selects a random sample of 8 smokers and 9 non-smokers and the
data is shown in Table
11.2.Using a α = 0.050, is there enough evidence to decide
about hypothesis?
Solution: First we calculate mean and variance of each group.
x
1
=
x
i
n
=
640
8
= 80,
y
1
=
y
i
n
=
666
9
= 74
S
2
x
=
(
x
i
− x
)
2
n − 1
=
256
8 − 1
= 36.57, S
2
y
=
(
y −
y
)
2
n − 1
=
252
9 − 1
= 31.5
Null and alternative hypotheses are:
H
0
: σ
2
x
= σ
2
y
H
A
: σ
2
x
/= σ
2
y
Sample sizes are 8 and 9, degrees of freedom are df
1
= n
1
−1 = 8 −1 = 7, d f
2
=
n
2
− 1 = 9 − 1 = 8, and default significant level is 0.05.
Test statistic is the ratio of larger variance to the smaller variance:
F =
S
2
larger
S
2
smaller
Table 11.2 Heart rates (bpm) of samples by smoking habit
Smoker 83 78 83 78 80 70 77 91 –
Non-smoker 67 76 78 76 79 78 79 66 67
https://t.me/med1917
252 11 Hypothesis Testing
Critical value is F
(
%2.5,7,8
)
= 4.23. If the test statistic is greater than the critical value
of 4.23, then we reject the null hypothesis (
H
0
.).
The test statistic according to sample data is:
F =
S
2
larger
S
2
smaller
=
36.57
31.5
= 1.16
Since 1.16 < 4.23, then we don’t reject the null hypothesis (H
0
).
The variance of 2 groups is equal.
To calculate confidence interval for variance ratio, critical value of F from the
F distribution table is
F
(
α
2
,n
1
−1,n
2
−1
)
= 4.23
. Therefore, 95% confidence interval is
calculated as below:
S
2
1
S
2
2
×
1
F
(
α
2
,n
1
−1,n
2
−1
)
to
S
2
1
S
2
2
× F
(
α
2
,n
1
−1,n
2
−1
)
=
36.57
31.5
×
1
4.23
to
36.57
31.5
× 4.23
= 0.27 to 4.91
The estimated confidence interval includes 1, then we can assume that the variance
of two groups is equal.
11.8 Goodness-Of-Fit Tests
The notion of “goodness-of-fit” entails examining whether sample data, organized
in a one-way frequency table, aligns with a specific distribution under consideration,
such as normal or uniform. To assess this alignment, we employ a hypothesis test to
determine whether the observed frequency counts correspond with the expected or
theoretical frequency distribution. This test, applicable to qualitative and categorical
data, is referred to as the Chi-square test.
Goodness-of-fit test
Is used to consider the hypothesis that an observed
frequency distribution fits (or conforms to) some theoretical or expected
distribution.
χ
2
=
k
i=1
(
O
i
− E
i
)
2
E
i
https://t.me/med1917
11.8 Goodness-Of-Fit Tests 253
where O
i
is the observed frequency in a cell and E
i
is the expected frequency in
each cell that is found by the following equation:
E =
Row total × Column total
Grand total
If data is provided in a column, E
i
is the product of the probability of ith row by
the grand total.
Example 11.13 To check the accuracy of the recorded weight of individuals, a
sample of 96 adults was selected and last digit of their weight is given in Table
11.3.
Judge the accuracy of this scale.
Solution: If the weights of individuals are accurately measured and recorded without
rounding to the nearest 0 or 0.5, it is expected that the last digits of these weights will
follow a uniform distribution. In such a distribution, each digit from 0 to 9 should
occur with approximately the same frequency, as the probability of observing each
digit is equal to 0.1 (p_0 = p_1 = p_2 = … = p_8 = p_9). Despite a subjective
observation s uggesting that the digits 0 and 5 occur more frequently than others, we
will conduct a formal hypothesis test to corroborate this subjective assessment.
To do this, we employ the χ
2
test statistic, which is based on differences between
the observed and expected values. If the observed and expected values are close,
the
χ
2
test statistic will be small, the P-value will be large, and we don’t reject the
null hypothesis. If the observed and expected frequencies are far apart, the
χ
2
test
statistic will be large, the P-value will be small, and we reject the null hypothesis.
Table 11.3 Last digits of
individuals’ weights
Last digit Observed frequency
0 13
1 8
2 10
3 9
4 10
5 14
6 5
7 12
8 11
9 4
Total 96
https://t.me/med1917
254 11 Hypothesis Testing
The hypothesis tests of this section are always right-tailed, because the critical value
and critical region are located at the extreme right of the distribution.
To find each corresponding expected frequency (E) in this exercise, we multiply
the probability of each digit by the grand total (96 × 0.6 = 9.6). Because the 96 digits
would be uniformly distributed among the 10 categories (see Table
11.3a). This set
of columns is called theoretical distribution.
χ
2
=
k
i=1
(
O
i
− E
i
)
2
E
i
= 9.833
The critical value with 9 degree of freedom is χ
2
(
0.95,9
)
= 16.92. Since the test
statistic is less than the critical value (9.833 < 16.92), then it can be concluded that
the observed frequency distribution is consistent with the theoretical frequencies.
Table 11.3a Uniform distribution of Table
11.3
Last digit Observed frequency (O) Expected frequency (E ) (O−E)
(
O − E
)
2
(
O−E
)
2
E
0 13 9.6 3.4 11.56 1.204
1 8 9.6 −1.6 2.56 0.266
2 10 9.6 0.4 0. 16 0.017
3 9 9.6 −0.6 0.36 0.037
4 10 9.6 0.4 0.16 0.017
5 14 9.6 4.4 19.36 2.017
6 5 9.6 −4.6 21.16 2.204
7 12 9.6 2.4 5.76 0.60
8 11 9.6 1.4 1.96 0.204
9 4 9.6 −5.6 31.36 3.267
Total 96 96 χ
2
= 9.883
The sum of last column is the test statistic of Chi-square which should be compared with the critical
value of the table with degree of freedom df = n−1 = 10–1 = 9
https://t.me/med1917
11.9 Association and Dependence of Variables in Contingency Tables 255
Tip
For the goodness-of-fit test to be valid, the expected frequency of each cell
must be at least 5.
11.9 Association and Dependence of Variables
in Contingency Tables
Contingency table or cross-tabulation is two dimensions’ table and a type of table
in a matrix format that displays the frequency distribution of the two variables in
terms of each other. It can provide a basic picture of the interrelation between two
variables and can help find interactions between them. The term contingency table
refers to a dependence of a variable on another variable. We use the term contingency
table in this book because we test for independence between the row and column
variables.
To test independence of two qualitative or categorical variables, we use test statistic
of Chi-square, which is an one-tailed test. The formula and degree of freedom of
Chi-square test statistic are as below, which is explained by an example below.
χ
2
(
O − E
)
2
E
df =
(
c − 1
)(
r − 1
)
where O is observed value and E is expected value for each cell.
E =
Row total × Column total
Grand total
The closer the observed frequencies are to the expected frequencies (i.e., the
row variable and the column variable are independent), the calculated test statistic
is closer to zero; it becomes. Conversely, the farther away they are (i.e., the more
dependent the row variable and the column variable), the larger the test statistic.
The calculated test statistic is compared with the critical value obtained from the
Chi-square distribution table with degree of freedom df = (c−1) (r−1). If the test
statistic is greater than the critical value, the null hypothesis (independence of two
variables) is rejected, i.e., the two variables are dependent. Otherwise, there is no
reason to reject it.
The Chi-square test is valid when the sample size is large enough. That is, when
80% of the expected frequencies are greater than 5 and none are less than 1.
Otherwise, some categories must be merged to meet this condition or use Fisher’s
exact test.
https://t.me/med1917
256 11 Hypothesis Testing
Example 11.14 In a random sample, 200 university students were asked about their
preference to use e-books and hard copies, and the results are shown in Table
11.4.
Can the priority of students be considered independent of the level of education?
Solution: The null and alternative hypotheses are:
H
0
: The row and column variables are independent. or p
1
= p
2
= p
3
H
A
: The row and column variables are dependent. or p
1
/= p
2
/= p
3
In order to be independent, the students’ education level and their preference
of the book type, the proportion of students using e-books must be approximately
equal in all three levels of education. That is, we expect the proportion of e-book
preference among BSc, MSc, and Ph.D. students to be equal to the proportion of
e-book preferences for all students. It is also expected that the proportion of hard
copy priorities in all three levels is equal to the proportion of total preferences of
hard copy. For this reason, these values are called expected frequencies.
Thus, the expected frequencies for each cell can be obtained by multiplying the
total proportion of e-book preference by the number of students in each level of
education, that is, by multiplying the row sum by the sum of the column divided by
the total number. For example, the expected frequency for BSc students who prefer
e-books and also for MSc students who prefer hard copy is calculated as follows:
E =
140 × 120
200
= 84 and E =
40 × 80
200
= 16
The rest of the table cells can be obtained by subtracting from the marginal sums.
We know that in this study, we have 140 BSc students, and the expected number
of BSc students with an e-book priority is 84. Therefore, the number of BSc students
with the priority of hard copy is equal to 140–84 = 56.
There are 40 MSc students, 16 of whom prefer the hard copy. Therefore, the
number of MSc students with e-book priority is equal to 40–16 = 24.
On the other hand, 120 students were interested in e-books (first row), of which
24 were MSc students and 84 were BSc students. Therefore, the number of PhD
students who want to prefer e-books is equal to 120 − (24 + 84) = 12.
Thus, when the type of book is independent of the level of education (null
hypothesis is true), we should have the expected frequencies according to
Table
11.4a.
Table 11.4 Preference of students to use e-books and hard copies
Education level BSc MSc Ph.D. Sum
e-book 90 22 8 120
Hard copy 50 18 12 80
Total 140 40 20 200
https://t.me/med1917
11.9 Association and Dependence of Variables in Contingency Tables 257
Table 11.4a Expected frequencies of preference for e-books and hard copy in terms of educational
level
Education level BSc MSc Ph.D. Sum
e-book 84 24 12 120
Hard copy 56 16 8 80
Sum 140 40 20 200
It can be seen that by calculating the expected frequency of two of the table cells,
we were able to complete all the table cells. For this reason, the degree of freedom
of this table is 2.
df =
(
c − 1
)(
r − 1
)
=
(
3 − 1
)(
2 − 1
)
= 2
Now we have to examine how big is the difference between the observed
frequencies and the expected frequencies? Are they so big that they cannot be
ignored? Obviously, the magnitude of these differences must be weighed against
the expected frequencies. Because the difference of the cell with a frequency of 8 is
not equal to the difference of the cell with a frequency of 84. So, we have to
calculate the “relative difference”. On the other hand, some frequencies are positive
and some other are negative, and the sum of these differences
O
ij
− E_ij

is
always zero, because the observed and expected frequencies both add up to the
sample size. In order not to neutralize each other, we square them and divide them
by the expected frequency of each cell. Then their sum will be the test criterion. A
summary of these calculations is given in Table
11.4b.
Note: In the special case, the contingency tables are based on two dichotomous
characteristics and with 2 × 2 format such as Table
11.5.
Table 11.4b Calculations for Chi-square test statistic
Education level BSc MSc Ph.D. Sum
e-book
(
90 − 84
)
2
84
= 0.43
(
22 − 24
)
2
24
= 0.17
(
12 − 8
)
2
12
= 1.33
–
Hard copy
(
50 − 56
)
2
50
= 0.72
(
18 − 16
)
2
16
= 0.25
(
12 − 8
)
2
8
= 2.00
–
Sum – – – 4.90
Thus, the test statistic of Chi-square in this example is equal to χ
2
= 4.90. 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 priority to e-books and hard copy has
no significant relationship with students’ educational level
https://t.me/med1917
258 11 Hypothesis Testing
Table 11.5 Sample distribution in terms of two characteristics
First column (yes) Second column (No) Sum
First row (yes) a b E = a + b
Second row (no) c D F = c + d
Sum G = a + c H = b + d N
In this case, the test statistic can be calculated with the following simplified
formula:
χ
2
=
N
(
a.d − b.c
)
2
E.F .G.H
This simplified form of the Chi-square formula can only be used for 2 × 2
contingency tables.
Example 11.15 In a random sample, 40 athletes were asked about their favourite
exercise between Pilates and swimming, and the results are shown in Table
11.6.Is
there a difference in the choice of sports between men and women?
Solution: This table is 2 × 2 with 1 degree of freedom. First, we calculate the Chi-
square test statistics by obtaining expected frequencies. Just finding one of the table
cells with this method is enough (Table
11.7).
E =
16 × 18
40
= 7.2
χ
2
=
(
10 − 7.2
)
2
7.2
+
(
8 − 10.8
)
2
10.8
+
(
6 − 8.8
)
2
8.8
+
(
16 − 13.2
)
2
13.2
= 3.2997
To calculate it using simplified formula, the following information is provided:
Table 11.6 Type of exercise
by the gender
Swimming Pilates Sum
Men 10 8 18
Women 6 16 22
Sum 16 24 40
Table 11.7 Expected
frequencies for Table
10.7
Swimming Pilates Sum
Men 7.2 10.8 18
Women 8.8 13.2 22
Sum 16 24 40
https://t.me/med1917