Last chance! 50% off unlimited learning
Sale ends in
Calculates epsilon-squared for a table with one ordinal variable and one nominal variable; confidence intervals by bootstrap.
epsilonSquared(x, g = NULL, group = "row", ci = FALSE, conf = 0.95,
type = "perc", R = 1000, histogram = FALSE, digits = 3, ...)
Either a two-way table or a two-way matrix. Can also be a vector of observations of an ordinal variable.
If x
is a vector, g
is the vector of observations for
the grouping, nominal variable.
If x
is a table or matrix, group
indicates whether
the "row"
or the "column"
variable is
the nominal, grouping variable.
If TRUE
, returns confidence intervals by bootstrap.
May be slow.
The level for the confidence interval.
The type of confidence interval to use.
Can be any of "norm
", "basic
",
"perc
", or "bca
".
Passed to boot.ci
.
The number of replications to use for bootstrap.
If TRUE
, produces a histogram of bootstrapped values.
The number of significant digits in the output.
Additional arguments passed to the kruskal.test
function.
A single statistic, epsilon-squared. Or a small data frame consisting of epsilon-squared, and the lower and upper confidence limits.
Epsilon-squared is used as a measure of association for the Kruskal-Wallis test or for a two-way table with one ordinal and one nominal variable.
Currently, the function makes no provisions for NA
values in the data. It is recommended that NA
s be removed
beforehand.
Because epsilon-squared is always positive, the confidence interval will never cross zero. The confidence interval range should not be used for statistical inference.
When epsilon-squared is close to 0 or very large, or with small counts in some cells, the confidence intervals determined by this method may not be reliable, or the procedure may fail.
# NOT RUN {
data(Breakfast)
library(coin)
chisq_test(Breakfast, scores = list("Breakfast" = c(-2, -1, 0, 1, 2)))
epsilonSquared(Breakfast)
data(PoohPiglet)
kruskal.test(Likert ~ Speaker, data = PoohPiglet)
epsilonSquared(x = PoohPiglet$Likert, g = PoohPiglet$Speaker)
### Same data, as matrix of counts
data(PoohPiglet)
XT = xtabs( ~ Speaker + Likert , data = PoohPiglet)
epsilonSquared(XT)
# }
Run the code above in your browser using DataLab