How can I extract the compact letter display from a Tukey's multiple comparison using the nparcomp package?

Viewed 313

The multcomp package has a nice compact letter display function built in, but I'm using the non-parametric multiple comparison package "nparcomp" which does not appear to have a similar feature. I've noticed there are a couple packages such as multcompView and rcompanion that have CLD functions, but I'm not sure how to get my nparcomp summary to cooperate with those tools. Maybe someone here can help me? Here's an example summary of an nparcomp Tukey test:

library(nparcomp)
pristineraw.tukey <- mctp(positif.prop.total ~ dose.log, data = pristineraw, type = "Tukey", conf.level = 0.95, asy.method = "fisher", info = FALSE)
pristineraw.tukey

$Data.Info
                Sample Size    Effect      Lower     Upper
1                   -4    4 0.7812500 0.65095081 0.8724403
2    -2.95860731484178    2 0.8229167 0.68706660 0.9077133
3    -1.99567862621736    4 0.6145833 0.49050216 0.7253656
4   -0.999565922520681    4 0.4166667 0.33069961 0.5080188
5 4.34272768626649e-05    4 0.1562500 0.08581288 0.2675807
6      1.0000043429231    2 0.2083333 0.12491776 0.3266579

$Contrast
       1  2  3  4  5 6
2 - 1 -1  1  0  0  0 0
3 - 1 -1  0  1  0  0 0
4 - 1 -1  0  0  1  0 0
5 - 1 -1  0  0  0  1 0
6 - 1 -1  0  0  0  0 1
3 - 2  0 -1  1  0  0 0
4 - 2  0 -1  0  1  0 0
5 - 2  0 -1  0  0  1 0
6 - 2  0 -1  0  0  0 1
4 - 3  0  0 -1  1  0 0
5 - 3  0  0 -1  0  1 0
6 - 3  0  0 -1  0  0 1
5 - 4  0  0  0 -1  1 0
6 - 4  0  0  0 -1  0 1
6 - 5  0  0  0  0 -1 1

$Analysis
      Estimator  Lower  Upper Statistic    p.Value
2 - 1     0.042 -0.431  0.496     0.343 0.99761714
3 - 1    -0.167 -0.586  0.323    -1.381 0.69088411
4 - 1    -0.365 -0.648  0.007    -4.062 0.05318202
5 - 1    -0.625 -0.867 -0.144    -5.151 0.02076608
6 - 1    -0.573 -0.838 -0.090    -4.801 0.02785983
3 - 2    -0.208 -0.609  0.277    -1.763 0.50620162
4 - 2    -0.406 -0.688 -0.019    -4.320 0.04250191
5 - 2    -0.667 -0.894 -0.164    -5.205 0.02026988
6 - 2    -0.615 -0.866 -0.115    -4.930 0.02523067
4 - 3    -0.198 -0.583  0.260    -1.775 0.50151321
5 - 3    -0.458 -0.746 -0.026    -4.365 0.04027067
6 - 3    -0.406 -0.712  0.028    -3.880 0.06346250
5 - 4    -0.260 -0.561  0.101    -2.997 0.14893258
6 - 4    -0.208 -0.559  0.206    -2.078 0.37679610
6 - 5     0.052 -0.380  0.466     0.476 0.99043710

$Analysis.Inf
        Estimator      Lower        Upper  Statistic    p.Value
2 - 1  0.04166667 -0.4310816  0.496466660  0.3426000 0.99761714
3 - 1 -0.16666667 -0.5861671  0.323305915 -1.3807046 0.69088411
4 - 1 -0.36458333 -0.6475061  0.006668684 -4.0618961 0.05318202
5 - 1 -0.62500000 -0.8671346 -0.143918870 -5.1509655 0.02076608
6 - 1 -0.57291667 -0.8375693 -0.090485809 -4.8010534 0.02785983
3 - 2 -0.20833333 -0.6088821  0.276867328 -1.7626807 0.50620162
4 - 2 -0.40625000 -0.6877026 -0.018637527 -4.3195377 0.04250191
5 - 2 -0.66666667 -0.8944430 -0.164222955 -5.2046137 0.02026988
6 - 2 -0.61458333 -0.8659606 -0.115293472 -4.9298694 0.02523067
4 - 3 -0.19791667 -0.5834144  0.260362074 -1.7746828 0.50151321
5 - 3 -0.45833333 -0.7460603 -0.026382368 -4.3654031 0.04027067
6 - 3 -0.40625000 -0.7115636  0.028113118 -3.8797113 0.06346250
5 - 4 -0.26041667 -0.5608547  0.100626889 -2.9973930 0.14893258
6 - 4 -0.20833333 -0.5594223  0.206138515 -2.0776563 0.37679610
6 - 5  0.05208333 -0.3804685  0.465937204  0.4758687 0.99043710

$Overall
  Quantile    p.Value
1 4.132777 0.02026988

$input
$input$formula
positif.prop.total ~ dose.log

$input$data
    dose positif negatif dead totalNb positif.prop.total      dose.log
1  0e+00      17      20    0      37         0.45945946 -4.000000e+00
2  0e+00      23      16    0      39         0.58974359 -4.000000e+00
3  0e+00      18      15    0      33         0.54545455 -4.000000e+00
4  0e+00      14      14    1      28         0.50000000 -4.000000e+00
5  1e-03      19      19    1      38         0.50000000 -2.958607e+00
6  1e-03      20      14    4      34         0.58823529 -2.958607e+00
7  1e-02      22      16    0      38         0.57894737 -1.995679e+00
8  1e-02      18      19    0      37         0.48648649 -1.995679e+00
9  1e-02      15      22    2      37         0.40540541 -1.995679e+00
10 1e-02      11      20    4      31         0.35483871 -1.995679e+00
11 1e-01      12      20    0      32         0.37500000 -9.995659e-01
12 1e-01      12      17    4      29         0.41379310 -9.995659e-01
13 1e-01       8      26    3      34         0.23529412 -9.995659e-01
14 1e-01       5      18   11      23         0.21739130 -9.995659e-01
15 1e+00       3      16   10      19         0.15789474  4.342728e-05
16 1e+00       1      16    5      17         0.05882353  4.342728e-05
17 1e+00       2      24    9      26         0.07692308  4.342728e-05
18 1e+00       7      23    6      30         0.23333333  4.342728e-05
19 1e+01       3      10    8      13         0.23076923  1.000004e+00
20 1e+01       2      20    8      22         0.09090909  1.000004e+00

$input$type
[1] "Tukey"

$input$conf.level
[1] 0.95

$input$alternative
[1] "two.sided"

$input$asy.method
[1] "fisher"

$input$plot.simci
[1] FALSE

$input$control
NULL

$input$info
[1] FALSE

$input$rounds
[1] 3

$input$contrast.matrix
NULL

$input$correlation
[1] FALSE

$input$effect
[1] "unweighted"

$input$const
[1] 0.5875441


$text.Output
[1] "True differences of relative effects are not equal to 0"

$text.output.W
[1] "Global Pseudo Ranks"

$connames
 [1] "2 - 1" "3 - 1" "4 - 1" "5 - 1" "6 - 1" "3 - 2" "4 - 2" "5 - 2" "6 - 2"
[10] "4 - 3" "5 - 3" "6 - 3" "5 - 4" "6 - 4" "6 - 5"

$AsyMethod
[1] "Fisher with 5 DF"

attr(,"class")
[1] "mctp"

1 Answers

You can use cldList in package rcompanion. You didn't provide reproducible data so I'll use the iris data set that is included with R:

data(iris)
library(rcompanion)
library(nparcomp)
iris.mc <- mctp(Sepal.Length~Species, iris)
comp <- iris.mc$connames
pv <- iris.mc$Analysis$p.Value
cldList(comparison=comp, p.value=pv)
#   Group Letter MonoLetter
# 1     2      a        a  
# 2     3      b         b 
# 3     1      c          c
Related