# How can I calculate confidence intervals for epsilon-squared (Effect size for Kruskal-Wallis test) in R? [closed]

I'd like to calculate the confidence intervals for the epsilon-squared effect size statistic in R. Here is the code I'm using to calculate the epsilon-squared value:

#set up two vectors, a numerical vector and a factor vector (grouping variable)
x=c(3,2,4,7,4,6,9,2,3,4,1,0,8,6,9,5,3,3,6,7,8,2,8,9)
y=as.factor(c(rep("cond1",12),rep("cond2",12)))

#run kruskal-wallis test
kruskal.test(x~y)
library(rcompanion)
df=data.frame(x,y)

#calculate epsilon squared
epsilonSquared(x = df$$x, g = df$$y)


This gives me my effect size. But the function only outputs a single figure. How can I calculate the confidence intervals of the effect size, please?

## closed as off-topic by mkt, mdewey, Michael Chernick, Peter Flom♦Feb 9 at 11:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – mkt, mdewey, Michael Chernick, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

## 1 Answer

Have you checked the help file via ?epsilonSquared? You can simply set the corresponding argument in the function to be true (default is FALSE):

epsilonSquared(x = df$$x, g = df$$y, ci = TRUE, conf = 0.95)


This returns a 95% bootstrapped confidence interval. If you don't set a seed, it will be slightly different each time (since it's bootstrapped).

• Thank you! But even using conf=xx, only a single value is returned - no values for the upper/lower limit of the confidence intervals. Do you know if there is any way I can access those values? – clrp Feb 10 at 5:43
• Update: I reinstalled the package and now this returns the CI values as well - thank you so much!! – clrp Feb 10 at 6:10
• you're welcome! If you are familiar with the technical aspects of bootstrap you can also specify the type of bootstrap via the argument type. For the CIs, epsilonSquared makes use of boot.ci if you want more details. However, the default will work fine for most applications. – LuckyPal Feb 10 at 12:27