# Comparison more groups in relation to a categorical value

Hello community

i have trouble in deciding which statistical test i have to use in R for comparing my groups (6 groups) in relation to a categorical value (yes or no). I can explain it like that. The six groups of the cohort are not interval scaled and the groups are also a categorical value and you can image it like 6 categories e.g category 1 non severe, category 2 less severe, 3 severe, 4 more severe, 5 tremendous severe 6, life threatening. I want to control if there is a statistical significance for each group in relation to my yes/no value.
Thanks and best regards

If I understand your data correctly, a Chi Squared test may be appropriate. I suggest you study that and decide if it makes sense.
A function in R that does the test is chisq.test()

thanks for your reply. but do i have to make a subset for each group? all patients belong to the cohort and are divided in these 6 groups in relation to the severity of their disease.

For a Chi Squared test, you need to know how many Yes and how many No responses are in each group. Here is a very simple example.

``````YesCounts <- c(5,8,5,8,9,3)
NoCounts <- c(15,13,14,12,11,15)
DataMat <- matrix(c(YesCounts,NoCounts),ncol = 2,nrow=6)
dimnames(DataMat) <- list(c("non","less","Severe","more","very","life"),
c("Yes","No"))
DataMat
#>        Yes No
#> non      5 15
#> less     8 13
#> Severe   5 14
#> more     8 12
#> very     9 11
#> life     3 15
#Test the data
chisq.test(DataMat)
#>
#>  Pearson's Chi-squared test
#>
#> data:  DataMat
#> X-squared = 5.1579, df = 5, p-value = 0.3969
``````

Created on 2022-02-04 by the reprex package (v2.0.1)
The result of the test says the six group seems to have the same Yes/No probability.

How exactly you would get the counts of Yes and No responses in your data depends on how it is structured.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.