# kw_eta_h_ci

##### Confidence interval for effect size for Kruskal-Wallis test.

Custom function to get confidence intervals for effect size measure for Kruskal-Wallis Rank Sum Test.

- Keywords
- internal

##### Usage

```
kw_eta_h_ci(data, x, y, nboot = 100, conf.level = 0.95,
conf.type = "norm", ...)
```

##### Arguments

- data
A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will

**not**be accepted.- x
The grouping variable from the dataframe

`data`

.- y
The response (a.k.a. outcome or dependent) variable from the dataframe

`data`

.- nboot
Number of bootstrap samples for computing confidence interval for the effect size (Default:

`100`

).- conf.level
Scalar between 0 and 1. If unspecified, the defaults return

`95%`

lower and upper confidence intervals (`0.95`

).- conf.type
A vector of character strings representing the type of intervals required. The value should be any subset of the values

`"norm"`

,`"basic"`

,`"perc"`

,`"bca"`

. For more, see`?boot::boot.ci`

.- ...
Arguments passed on to

`boot::boot`

- data
The data as a vector, matrix or data frame. If it is a matrix or data frame then each row is considered as one multivariate observation.

- statistic
A function which when applied to data returns a vector containing the statistic(s) of interest. When

`sim = "parametric"`

, the first argument to`statistic`

must be the data. For each replicate a simulated dataset returned by`ran.gen`

will be passed. In all other cases`statistic`

must take at least two arguments. The first argument passed will always be the original data. The second will be a vector of indices, frequencies or weights which define the bootstrap sample. Further, if predictions are required, then a third argument is required which would be a vector of the random indices used to generate the bootstrap predictions. Any further arguments can be passed to`statistic`

through the`…`

argument.- R
The number of bootstrap replicates. Usually this will be a single positive integer. For importance resampling, some resamples may use one set of weights and others use a different set of weights. In this case

`R`

would be a vector of integers where each component gives the number of resamples from each of the rows of weights.- sim
A character string indicating the type of simulation required. Possible values are

`"ordinary"`

(the default),`"parametric"`

,`"balanced"`

,`"permutation"`

, or`"antithetic"`

. Importance resampling is specified by including importance weights; the type of importance resampling must still be specified but may only be`"ordinary"`

or`"balanced"`

in this case.- stype
A character string indicating what the second argument of

`statistic`

represents. Possible values of stype are`"i"`

(indices - the default),`"f"`

(frequencies), or`"w"`

(weights). Not used for`sim = "parametric"`

.- strata
An integer vector or factor specifying the strata for multi-sample problems. This may be specified for any simulation, but is ignored when

`sim = "parametric"`

. When`strata`

is supplied for a nonparametric bootstrap, the simulations are done within the specified strata.- L
Vector of influence values evaluated at the observations. This is used only when

`sim`

is`"antithetic"`

. If not supplied, they are calculated through a call to`empinf`

. This will use the infinitesimal jackknife provided that`stype`

is`"w"`

, otherwise the usual jackknife is used.- m
The number of predictions which are to be made at each bootstrap replicate. This is most useful for (generalized) linear models. This can only be used when

`sim`

is`"ordinary"`

.`m`

will usually be a single integer but, if there are strata, it may be a vector with length equal to the number of strata, specifying how many of the errors for prediction should come from each strata. The actual predictions should be returned as the final part of the output of`statistic`

, which should also take an argument giving the vector of indices of the errors to be used for the predictions.- weights
Vector or matrix of importance weights. If a vector then it should have as many elements as there are observations in

`data`

. When simulation from more than one set of weights is required,`weights`

should be a matrix where each row of the matrix is one set of importance weights. If`weights`

is a matrix then`R`

must be a vector of length`nrow(weights)`

. This parameter is ignored if`sim`

is not`"ordinary"`

or`"balanced"`

.- ran.gen
This function is used only when

`sim = "parametric"`

when it describes how random values are to be generated. It should be a function of two arguments. The first argument should be the observed data and the second argument consists of any other information needed (e.g. parameter estimates). The second argument may be a list, allowing any number of items to be passed to`ran.gen`

. The returned value should be a simulated data set of the same form as the observed data which will be passed to`statistic`

to get a bootstrap replicate. It is important that the returned value be of the same shape and type as the original dataset. If`ran.gen`

is not specified, the default is a function which returns the original`data`

in which case all simulation should be included as part of`statistic`

. Use of`sim = "parametric"`

with a suitable`ran.gen`

allows the user to implement any types of nonparametric resampling which are not supported directly.- mle
The second argument to be passed to

`ran.gen`

. Typically these will be maximum likelihood estimates of the parameters. For efficiency`mle`

is often a list containing all of the objects needed by`ran.gen`

which can be calculated using the original data set only.- simple
logical, only allowed to be

`TRUE`

for`sim = "ordinary", stype = "i", n = 0`

(otherwise ignored with a warning). By default a`n`

by`R`

index array is created: this can be large and if`simple = TRUE`

this is avoided by sampling separately for each replication, which is slower but uses less memory.- parallel
The type of parallel operation to be used (if any). If missing, the default is taken from the option

`"boot.parallel"`

(and if that is not set,`"no"`

).- ncpus
integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs.

- cl
An optional parallel or snow cluster for use if

`parallel = "snow"`

. If not supplied, a cluster on the local machine is created for the duration of the`boot`

call.

##### Examples

```
# NOT RUN {
# }
# NOT RUN {
ggstatsplot:::kw_eta_h_ci(
data = ggplot2::msleep,
x = vore,
y = sleep_rem,
nboot = 100,
conf.level = 0.90,
conf.type = "basic"
)
# }
# NOT RUN {
# }
```

*Documentation reproduced from package ggstatsplot, version 0.0.11, License: GPL-3 | file LICENSE*