API
Regular CD diagrams
A regular CD diagram with n
observations and k
treatments is created from an (n, k)
-shaped matrix, as described in the Quickstart section.
- class critdd.Diagram(X, *, treatment_names=None, maximize_outcome=False)
A regular critical difference diagram.
- Parameters:
X – An
(n, k)
-shaped matrix of observations, wheren
is the number of observations andk
is the number of treatments.treatment_names (optional) – The names of the
k
treatments. Defaults to None.maximize_outcome (optional) – Whether the ranks represent a maximization (True) or a minimization (False) of the outcome. Defaults to False.
- get_groups(alpha=0.05, adjustment='holm', return_names=False, return_singletons=True)
Get the groups of indistinguishable treatments.
- Parameters:
alpha (optional) – The threshold for rejecting a p value. Defaults to 0.05.
adjustment (optional) – The multiple testing adjustment. Defaults to “holm”. Another possible value is “bonferroni”.
return_names (optional) – Whether to represent the treatments in the groups by their names (True) or by their indices (False). Defaults to False.
return_singletons (optional) – Whether to return groups with single elements. Defaults to True.
- Returns:
A list of statistically indistinguishable groups.
- to_file(path, *args, **kwargs)
Store this diagram in a file.
Note
Storing Tikz code in a “.png” file or “.svg” file is not yet supported.
- Parameters:
path – The file path where this diagram is to be stored. Has to be ending on “.tex”, “.tikz”, “.pdf”, “.png”, or “.svg”.
*args (optional) – See
to_str
.**kwargs (optional) – See
to_str
.
- to_str(alpha=0.05, adjustment='holm', **kwargs)
Get a
str
object with the Tikz code for this diagram.- Parameters:
alpha (optional) – The threshold for rejecting a p value. Defaults to 0.05.
adjustment (optional) – The multiple testing adjustment. Defaults to “holm”. Another possible value is “bonferroni”.
reverse_x (optional) – Whether to reverse the x direction. Defaults to False.
as_document (optional) – Whether to include a
\documentclass
and adocument
environment. Defaults to False.tikzpicture_options (optional) – A
dict
with options for thetikzpicture
environment.axis_options (optional) – A
dict
with options for theaxis
environment.preamble (optional) – A
str
with LaTeX commands. Only used ifas_document==True
. Defaults to None.
- Returns:
A
str
object with the Tikz code for this diagram.
2D sequences of CD diagrams
A sequence of m
CD diagrams can be arranged in a single, 2-dimensional plot. The API for such a plot is similar to the API of Regular CD diagrams, but requires a tensor input of shape (m, n, k)
and an optional list of m
diagram names.
- class critdd.Diagrams(Xs, *, diagram_names=None, treatment_names=None, maximize_outcome=False)
A sequence of critical difference diagrams, plotted on a single 2-dimensional axis.
- Parameters:
Xs – Observations, given either as a list of length
m
of(n, k)
-shaped matrices or as an(m, n, k)
-shaped tensor, wherem
is the number of diagrams,n
is the number of observations, andk
is the number of treatments.diagram_names (optional) – The names of the
m
diagrams. Defaults to None.treatment_names (optional) – The names of the
k
treatments. Defaults to None.maximize_outcome (optional) – Whether the ranks represent a maximization (True) or a minimization (False) of the outcome. Defaults to False.
- to_file(path, *args, **kwargs)
Store this diagram in a file.
Note
Storing Tikz code in a “.png” file or “.svg” file is not yet supported.
- Parameters:
path – The file path where this diagram is to be stored. Has to be ending on “.tex”, “.tikz”, “.pdf”, “.png”, or “.svg”.
*args (optional) – See
to_str
.**kwargs (optional) – See
to_str
.
- to_str(alpha=0.05, adjustment='holm', **kwargs)
Get a
str
object with the Tikz code for this diagram.- Parameters:
alpha (optional) – The threshold for rejecting a p value. Defaults to 0.05.
adjustment (optional) – The multiple testing adjustment. Defaults to “holm”. Another possible value is “bonferroni”.
reverse_x (optional) – Whether to reverse the x direction. Defaults to False.
as_document (optional) – Whether to include a
\documentclass
and adocument
environment. Defaults to False.tikzpicture_options (optional) – A
dict
with options for thetikzpicture
environment.axis_options (optional) – A
dict
with options for theaxis
environment.preamble (optional) – A
str
with LaTeX commands. Only used ifas_document==True
. Defaults to None.
- Returns:
A
str
object with the Tikz code for this diagram.