Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
30 views8 pages

Module 16. Lesson Proper

N/A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views8 pages

Module 16. Lesson Proper

N/A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Kruskal Wallis Test and Friedman Test

The Kruskal-Wallis Test (H Test)

The Kruskal-Wallis test, also known as the H test, is a non-parametric statistical test
used to determine if there are significant differences between three or more
independent groups. It is an extension of the Mann-Whitney U test, which compares
only two groups. The Kruskal-Wallis test is particularly useful when the assumptions of
a one-way ANOVA are violated, especially when data is not normally distributed.

Key Characteristics of the Kruskal-Wallis Test

• Non-parametric: Unlike parametric tests (e.g., one-way ANOVA), the Kruskal-


Wallis test does not assume normal distribution of the data. This makes it
suitable for data that are not normally distributed.
• Ordinal or Continuous Data: The test is appropriate for ordinal (e.g., Likert
scales) or continuous data that can be converted into ranks.
• Independent Groups: The Kruskal-Wallis test is used to compare independent
groups—meaning that the observations within each group are not related.
• Median Differences: While the test is often used to detect differences in medians,
it actually compares the ranks of all values across groups, so it can be sensitive
to differences in distribution shape.

When to Use the Kruskal-Wallis Test

The Kruskal-Wallis test is often employed in situations where the assumptions for one-
way ANOVA are not met, such as:

• Non-normal data: The Kruskal-Wallis test doesn’t require the data to be normally
distributed.
• Unequal variances: It can be used when the groups have unequal variances.
• Ordinal or continuous data: As long as the data can be ranked, the Kruskal-
Wallis test is applicable.

How the Kruskal-Wallis Test Works

The Kruskal-Wallis test works by ranking all the data values across the groups from
lowest to highest, regardless of which group they belong to. The ranks are then
averaged within each group, and the differences between these averages are
assessed. If the average ranks differ significantly between groups, it suggests that there
is a difference in the underlying distribution of the groups.
Specifically, the test evaluates whether any of the groups have values that tend to rank
higher or lower than the others. A significant result indicates that at least one group
differs from the others in terms of ranks.

Kruskal-Wallis Test: Assumptions

Before performing a Kruskal-Wallis test, make sure the following assumptions are
satisfied:

1. Ordinal or Continuous Response Variable: The dependent variable must be


either ordinal (e.g., survey responses) or continuous data that can be ranked.
2. Independence: The observations in each group should be independent of each
other. Typically, this can be ensured through random sampling or experimental
design.
3. Similar Shape of Distributions: While the Kruskal-Wallis test doesn’t require
normality, it assumes that the distributions of the groups being compared have
similar shapes. This means that the spread and skewness of the groups should
not differ drastically.

If these assumptions are met, you can proceed with conducting the Kruskal-Wallis test.

Interpreting the Kruskal-Wallis Test Results

The Kruskal-Wallis test uses a test statistic HHH, which is compared against a critical
value from the chi-square distribution table. The null hypothesis for the Kruskal-Wallis
test states that the groups have identical distributions (i.e., there are no significant
differences in their medians or ranks). A significant result (usually with p<0.05p <
0.05p<0.05) indicates that at least one group is different from the others.

However, the Kruskal-Wallis test only tells you that at least one group differs; it does not
tell you which group(s) are different. To identify which specific groups differ, you can
conduct post-hoc tests such as Dunn’s test or pairwise comparisons with Bonferroni
correction.

Calculate Kruskal-Wallis-Test
Example question: A shoe company wants to know if three groups of workers have
different salaries:
Women: 23K, 41K, 54K, 66K, 78K.
Men: 45K, 55K, 60K, 70K, 72K
Minorities: 20K, 30K, 34K, 40K, 44K.
Step 1: Sort the data for all groups/samples into ascending order in one combined set.
Step 2: Assign ranks to the sorted data points. Give tied values the average rank.
Step 3: Add up the different ranks for each group/sample.
Women: 23K, 41K, 54K, 66K, 90K = 2 + 6 + 9 + 12 + 15 = 44.
Men: 45K, 55K, 60K, 70K, 72K = 8 + 10 + 11 + 13 + 14 = 56.
Minorities: 20K, 30K, 34K, 40K, 44K = 1 + 3 + 4 + 5 + 7 = 20.
Step 4: Calculate the H statistic:

Where:
n = sum of sample sizes for all samples,
c = number of samples,
Tj = sum of ranks in the jth sample,
nj = size of the jth sample.

H = 6.72
Step 5: Find the critical chi-square value, with c-1 degrees of freedom. For 3 – 1
degrees of freedom and an alpha level of .05, the critical chi square value is 5.9915.
Step 6: Compare the H value from Step 4 to the critical chi-square value from Step 5.
If the critical chi-square value is less than the H statistic, reject the null hypothesis that
the medians are equal.
If the chi-square value is not less than the H statistic, there is not enough evidence to
suggest that the medians are unequal.
In this case, 5.9915 is less than 6.72, so you can reject the null hypothesis.

The Friedman test

The Friedman test is a non-parametric statistical test used to analyze repeated


measures data. It is commonly used when the assumptions of normality and
homogeneity of variances are not met, making it a robust alternative to repeated
measures ANOVA. The Friedman test evaluates whether there are significant
differences in treatments or conditions across multiple measurements taken from the
same subjects.
What is a Dependent Sample (Repeated Measures)?
In a dependent sample or repeated measures design, the same subjects are measured
multiple times. The measurements are linked because they come from the same
individuals or experimental units.
Example:
If a group of people undergoes knee surgery, and their pain levels are measured before
the surgery and at two subsequent time points (one and two weeks after surgery), this
forms a dependent sample. Each person is measured at all three time points, and their
pain levels are compared over time.
Friedman Test vs. ANOVA with Repeated Measures
You might wonder: Isn’t the Friedman test testing the same thing as ANOVA with
repeated measures?
Yes, both tests evaluate whether there are significant differences between three or more
dependent samples (groups). However, there are key differences:
• ANOVA with repeated measures: Assumes that the data are normally distributed
and that variances are homogeneous across groups. It tests the extent to which
the measured values of the dependent sample differ, using the actual measured
data.
• Friedman test: Is the non-parametric counterpart of repeated measures ANOVA.
It doesn’t assume normality or homogeneity of variances. Instead of working with
the original values, it ranks the data. The point in time with the highest value
receives rank 1, the second-highest value gets rank 2, and so on. After ranking,
the test evaluates whether the sums of ranks differ significantly across time
points or conditions.
In simple terms:
• Parametric (ANOVA): Uses the actual measured values.
• Non-parametric (Friedman test): Uses ranked data, making it more robust to
violations of assumptions like normality.
Why Are Ranks Used?
The use of ranks is the key feature of the Friedman test. Ranks are used instead of the
raw data because:
• They reduce the impact of outliers.
• The test becomes distribution-free, meaning it does not require the data to be
normally distributed.
The rank-based approach makes the Friedman test a flexible tool for analyzing
repeated measures when the data do not meet the assumptions required for parametric
tests.
When to Use the Friedman Test
The Friedman test is most applied in two scenarios:
1. Measuring changes in subjects over time (i.e., multiple time points):
Example: You want to assess whether a training program has a significant effect
on subjects' resting heart rate. You measure heart rate before the program starts,
one month after, and two months after. The Friedman test can help determine if
there is a significant difference in heart rate at these three time points.
2. Comparing subjects' responses across multiple conditions:
Example: You want to compare how much three different movies are enjoyed by
a group of subjects. Each subject rates all three movies. The Friedman test can
be used to assess whether there is a significant difference in ratings across the
three films.
Conditions for Using the Friedman Test
To run a Friedman test, your data should meet the following requirements:
• Ordinal or continuous data (e.g., Likert scale ratings, continuous measurements).
• Data collected from the same subjects at three or more different time points (or
under three or more conditions).
• The sample should be drawn from a random sampling method.
• The blocks (subjects) are mutually independent, meaning one subject's data
does not influence another’s.
• No tied ranks: Every measurement within a block should have a unique rank.
How the Friedman Test Works
• Rank the data: For each subject, rank the measurements across all time points
or conditions. The highest measurement gets rank 1, the second highest gets
rank 2, and so on.
• Sum the ranks: For each time point or condition, sum the ranks across all
subjects.
• Compare rank sums: The Friedman test then compares the sum of ranks for
each condition or time point to determine whether any of them differ significantly
from each other.
The test statistic for the Friedman test is based on the sum of ranks, and a significant
result indicates that at least one condition or time point is different from the others.
Interpreting the Friedman Test
• If the test statistic is significant, it suggests that there is a difference in the ranks
across the conditions or time points, meaning that the measurements are not the
same.
• However, the Friedman test does not tell you which conditions are different from
each other. Post-hoc tests (like pairwise comparisons) can be used to identify
specific differences.

Calculate Friedman test


1. Prepare your data for the test.
Step 1: Sort your data into blocks (columns in a spreadsheet). for this example, we
have 12 patients getting three different treatments.
Step 2: Rank each column separately. The smallest score should get a rank of 1. I am
ranking across rows here so each patient is being ranked a 1, 2, or 3 for each
treatment.

Step 3: Sum the ranks (find a total for each column).

2. Run the Test


Note: This test isn’t usually run by hand, as the calculations are time consuming and
labor-intensive. Nearly all popular statistical software packages can run this test.
However, I’m including the manual steps here for reference.

Step 4: Calculate the test statistic. You’ll need:

n: the number of subjects (12)


k: the number of treatments (3)
R: The total ranks for each of the three columns (32, 27, 13).

Insert these into the following formula and solve:

Step 5: Find the FM critical value from the table of critical values for Friedman (see table
below).
Use the k=3 table (as that is how many treatments we have) and an alpha level of 5%.
You could choose a higher or lower alpha level, but 5% if fairly common — so use the
5% table if you don’t know your alpha level.
Looking up n-12 in that table, we find a FM critical value of 6.17.
Step 6: Compare the calculated FM test statistic (Step 4) to the FM critical value (Step
5). Reject the null hypothesis if the calculated F value is larger than the FM critical
value.:
• Calculated FM Test Statistic = 15.526.
• FM Critical value from table = 6.17.
The calculated FM statistic is larger, so you would reject the null hypothesis.

You might also like