Learn R Programming

rcompanion (version 1.13.2)

pairwiseSignMatrix: Pairwise sign tests for paired data with matrix output

Description

Conducts pairwise sign tests across groups for paired data.

Usage

pairwiseSignMatrix(formula = NULL, data = NULL, x = NULL, g = NULL,
  method = "fdr", ...)

Arguments

formula

A formula indicating the measurement variable and the grouping variable. e.g. y ~ group.

data

The data frame to use.

x

The response variable as a vector.

g

The grouping variable as a vector.

method

The p-value adjustment method to use for multiple tests. See p.adjust.

...

Additional arguments passed to SIGN.test.

Value

A list consisting of: A matrix of p-values; the p-value adjustment method; a matrix of adjusted p-values.

Details

The input should include either formula and data; or x, and g.

The two sample paired sign test compares medians among two groups with paired data. See http://rcompanion.org/handbook/F_07.html for futher discussion of this test.

The pairwiseSignTest function can be used as a post-hoc method following an omnibus Friedman test. The matrix output can be converted to a compact letter display.

The function assumes that the data frame is already ordered by the blocking variable, so that the first observation of Group 1 is paired with the first observation of Group 2, and so on.

References

http://rcompanion.org/handbook/F_10.html

See Also

pairwiseSignTest

Examples

Run this code
# NOT RUN {
data(BobBelcher)
friedman.test(Likert ~ Instructor | Rater,
              data = BobBelcher)
BobBelcher$Instructor = factor( BobBelcher$Instructor, 
                  levels = c("Linda Belcher", "Louise Belcher",
                             "Tina Belcher", "Bob Belcher",
                             "Gene Belcher"))          
PT = pairwiseSignMatrix(Likert ~ Instructor,
                        data   = BobBelcher,
                        method = "fdr")$Adjusted
PT
library(multcompView)
multcompLetters(PT,
                compare="<",
                threshold=0.05,
                Letters=letters)
                 
# }

Run the code above in your browser using DataLab