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, wherenis the number of observations andkis the number of treatments.treatment_names (optional) – The names of the
ktreatments. 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
strobject 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
\documentclassand adocumentenvironment. Defaults to False.tikzpicture_options (optional) – A
dictwith options for thetikzpictureenvironment.axis_options (optional) – A
dictwith options for theaxisenvironment.preamble (optional) – A
strwith LaTeX commands. Only used ifas_document==True. Defaults to None.
- Returns:
A
strobject 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
mof(n, k)-shaped matrices or as an(m, n, k)-shaped tensor, wheremis the number of diagrams,nis the number of observations, andkis the number of treatments.diagram_names (optional) – The names of the
mdiagrams. Defaults to None.treatment_names (optional) – The names of the
ktreatments. 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
strobject 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
\documentclassand adocumentenvironment. Defaults to False.tikzpicture_options (optional) – A
dictwith options for thetikzpictureenvironment.axis_options (optional) – A
dictwith options for theaxisenvironment.preamble (optional) – A
strwith LaTeX commands. Only used ifas_document==True. Defaults to None.
- Returns:
A
strobject with the Tikz code for this diagram.