# API reference

Below, you find a listing of all public methods of this package. Any other method you might find in the source code is not intended for direct usage.

## Critical difference diagrams

If you do not want to generate a plot, but want to know about the semantic content of a CD diagram, you can use the function `ranks_and_cliques`

instead of `plot`

.

`CriticalDifferenceDiagrams.plot`

— Function```
plot(t_1 => x_1, t_2 => x_2, ..., t_k => x_k; kwargs...)
plot(df, treatment, observation, outcome; kwargs...)
```

Return a `PGFPlots`

axis which contains a critical difference diagram for `n`

repeated observations of `k`

treatments.

The input data are arranged in treatments `t_i => x_i`

, each of which has a name `t_i`

and `n`

associated observations `x_i`

. You can omit the names, either providing the separate `x_i`

alone or by providing all observations as a single `(n, k)`

-shaped matrix `X`

. Alternatively, you can provide a DataFrame `df`

with the columns `treatment`

, `observation`

, and `outcome`

.

The analysis starts with a `FriedmanTest`

to check if any of the treatments differ. If so, the differences between each pair of treatments is checked with a Holm-adjusted or Bonferroni-adjusted Wilcoxon `SignedRankTest`

. The cliques represent groups of treatments which are not significantly distinguishable from each other.

**kwargs**

`alpha=0.05`

is the significance level in the hypothesis tests.`maximize_outcome=false`

specifies whether the ranks represent a maximization or a minimization of the outcomes.`adjustment=:holm`

specifies the adjustment method (`:holm`

or`:bonferroni`

).`title=nothing`

is an optional string to be printed above the diagram.`reverse_x=false`

reverses the direction of the x axis from right-to-left (default) to left-to-right.

**2-dimensional sequences of CD diagrams**

You can arrange a sequence of CD diagrams in a single 2-dimensional axis. In the following, each item in the sequence consists of a pair `s_i => [args_i...]`

of the item's name `s_i`

and the regular CD diagram arguments `args_i...`

that are documented above.

```
plot(
s_1 => [t_11 => x_11, t_12 => x_12, ..., t_1k => x_1k],
s_2 => [t_21 => x_21, t_22 => x_22, ..., t_2k => x_2k],
...,
s_j => [t_j1 => x_j1, t_j2 => x_j2, ..., t_jk => x_jk];
kwargs...
)
```

`CriticalDifferenceDiagrams.ranks_and_cliques`

— Function```
ranks_and_cliques(t_1 => x_1, t_2 => x_2, ..., t_k => x_k; kwargs...)
ranks_and_cliques(x_1, x_2, ..., x_k; kwargs...)
ranks_and_cliques(X; kwargs...)
ranks_and_cliques(df, treatment, observation, outcome; kwargs...)
```

Return a tuple `(avg_ranks, cliques)`

of the average ranks of `k`

treatments in `n`

repeated observations, together with the cliques of indistinguishable treatments.

The input data are arranged in treatments `t_i => x_i`

, each of which has a name `t_i`

and `n`

associated observations `x_i`

. You can omit the names, either providing the separate `x_i`

alone or by providing all observations as a single `(n, k)`

-shaped matrix `X`

. Alternatively, you can provide a DataFrame `df`

with the columns `treatment`

, `observation`

, and `outcome`

.

The analysis starts with a `FriedmanTest`

to check if any of the treatments differ. If so, the differences between each pair of treatments is checked with a Holm-adjusted or Bonferroni-adjusted Wilcoxon `SignedRankTest`

. The cliques represent groups of treatments which are not significantly distinguishable from each other.

**kwargs**

`alpha=0.05`

is the significance level in the hypothesis tests.`maximize_outcome=false`

specifies whether the ranks represent a maximization or a minimization of the outcomes.`adjustment=:holm`

specifies the adjustment method (`:holm`

or`:bonferroni`

).

## Friedman test

The Friedman test might eventually be migrated to HypothesisTests.jl.

`CriticalDifferenceDiagrams.FriedmanTest`

— Type```
FriedmanTest(x_1, x_2, ..., x_k; kwargs...) = FDistFriedmanTest(x_1, x_2, ..., x_k; kwargs...)
FriedmanTest(X; kwargs...) = FDistFriedmanTest(X; kwargs...)
```

Test the null hypothesis that `n`

repeated observations of a set of `k`

treatments have the same distribution across all treatments. These observations are arranged in `k`

vectors `x_i`

of `n`

observations each or in an `(n, k)`

-shaped matrix `X`

.

The default version of this test, the `FDistFriedmanTest`

, uses an F-distributed statistic.

**See also:**`FDistFriedmanTest`

, `ChisqFriedmanTest`

**Keyword arguments**

`maximize_outcome=false`

specifies whether the ranks represent a maximization or a minimization of the outcomes.

`CriticalDifferenceDiagrams.FDistFriedmanTest`

— Type```
FDistFriedmanTest(x_1, x_2, ..., x_k; kwargs...)
FDistFriedmanTest(X; kwargs...)
```

Test the null hypothesis that `n`

repeated observations of a set of `k`

treatments have the same distribution across all treatments. These observations are arranged in `k`

vectors `x_i`

of `n`

observations each or in an `(n, k)`

-shaped matrix `X`

.

This version of the `FriedmanTest`

uses an F-distributed statistic.

**Keyword arguments**

`maximize_outcome=false`

specifies whether the ranks represent a maximization or a minimization of the outcomes.

`CriticalDifferenceDiagrams.ChisqFriedmanTest`

— Type```
ChisqFriedmanTest(x_1, x_2, ..., x_k; kwargs...)
ChisqFriedmanTest(X; kwargs...)
```

Test the null hypothesis that `n`

repeated observations of a set of `k`

treatments have the same distribution across all treatments. These observations are arranged in `k`

vectors `x_i`

of `n`

observations each or in an `(n, k)`

-shaped matrix `X`

.

This version of the `FriedmanTest`

uses a χ²-distributed statistic.

**Keyword arguments**

`maximize_outcome=false`

specifies whether the ranks represent a maximization or a minimization of the outcomes.

`CriticalDifferenceDiagrams.average_ranks`

— Function`average_ranks(x) where x <: FriedmanTest`

Return the average ranks of methods in the `FriedmanTest`

.