Botany krishna series 2nd semester Only Mcq type questions
Kruskal Wallis Test in R
1. Kruskal-Wallis Test in R
W Roseybala Devi,
PG Bioinformatics, First Year
JSS Academy of Higher Education and Research, Mysore.
2. Non-parametric test
• Non parametric tests are used when our data isn't normal. If the data
is approximately normal, then we can use parametric statistical tests.
• Therefore the key is to figure out if we have normally distributed data.
• Nonparametric tests are sometimes called distribution-free tests
because they are based on fewer assumptions (e.g., they do not
assume that the outcome is approximately normally distributed).
• nonparametric tests are methods of statistical test/analysis that do
not require a distribution to meet the required assumptions to be
analyzed.
3. Examples of non-parametric test
• Wilcoxon Rank sum Test
• Mann-Whitney U test
• Spearman correlation
• Kruskal Wallis Test
4. Kruskal-Wallis Test
• The Kruskal–Wallis test was developed in1952 by Kruskal, W.H. and
Wallis, W.A..
• The Kruskal-Wallis rank-sum test is a non-parameteric method for
testing whether samples originate from the same distribution
• its parametric equivalent is One-way ANOVA. This test is useful for
cases where the data does not meet the assumptions for ANOVA.
5. Assumptions in Kruskal-Wallis test
• dependent variable should be measured at the ordinal or continuous
level (i.e., interval or ratio).
• independent variable should consist of two or more categorical,
independent groups.
• should have independence of observations, which means that there is
no relationship between the observations in each group or between
the groups themselves.
6. Hypotheses
• H₀ : All k populations have the same distribution.
• H₁ : Not all k populations have the same distribution.
7. Computation of Kruskal-Wallis Test in R
Step 1: Import the data into R.
my_data <- read.csv (file.choose()) for comma separated values
my_data <- read.delim (file.choose()) for files with delimiters or
text files
We will use in inbuilt data called PlantGrowth which contains the weight of plants
obtained under a control and two different treatment conditions.
The data PlantGrowth is imported using:
my_data <- PlantGrowth
8. Step 2: Check the data
check the head of the data using: head (my_data)
Output:
• In R terminology, the column “group” is called factor and the different categories
are named factor levels. The levels are ordered alphabetically.
• To check group levels: (my_data$group)
[1] "ctrl" "trt1" "trt2"
9. Step 3: Computing Kruskal-Wallis Test
The test can be performed using the function kruskal.test( ) as follow:
Output:
10. Step 4: Interpretation of results:
The value of the test statistic is 7.9882. If the calculated value is less than the critical
chisquared value, then the null hypothesis cannot be rejected.
here, 7.988 > 5.99
The p-value is less than the significance level 0.05, we can conclude that there are
significant differences between the treatment groups.
we reject the null hypothesis.