How do I exclude data from statistics (Kruskal-Wallis test)?

Hi everyone,
I have loaded a table into matlab using T = readtable(filename). The table contains two columns where data is grouped by five concentrations like this example:
data concentration
23 1
32 1
45 2
44 2
22 3
21 3
26 4
26 4
41 5
44 5
Lets say I only want to test the data of groups 3 - 5. How do I exclude data (1 and 2) from the statistical test?
I want to carry out a Kruskal-Wallis test for this.
p = kruskalwallis(x,group)
How do i exclude data from a Kruskal-Wallis test?
Any help would be highly appreciated!

1 Comment

You could get a subset of your table with
subset = T(any(T.concentration==[3 4 5],2),:)
so that subset only contains the data in groups 3 through 5.
Then the test might be
p = kruskalwallis(subset.data, subset.concentration)
but not 100% sure on that.

Sign in to comment.

Answers (0)

Categories

Asked:

on 28 Mar 2020

Commented:

on 28 Mar 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!