Learn R Programming

rcompanion (version 2.4.30)

pairwisePercentileTest: Pairwise permutation tests for percentiles

Description

Conducts pairwise permutation tests across groups for percentiles, medians, and proportion below a threshold value.

Usage

pairwisePercentileTest(
  formula = NULL,
  data = NULL,
  x = NULL,
  y = NULL,
  test = "median",
  tau = 0.5,
  type = 7,
  threshold = NA,
  comparison = "

Value

A dataframe of the groups being compared, the p-values, and the adjusted p-values.

Arguments

formula

A formula indicating the response variable and the independent variable. e.g. y ~ group.

data

The data frame to use.

x

If no formula is given, the response variable for one group.

y

The response variable for the other group.

test

The statistic to compare between groups. Can be "median", "percentile", "iqr", "proportion", "mean", or "variance".

tau

If "percentile" is chosen as the test, tau indicates the percentile to test. Expressed as a quantile. That is, 0.5 indicates a test for medians. 0.75 indicates a test for 75th percentiles.

type

The type value passed to the quantile function.

threshold

If "proportion" is chosen as the test, threshold indicates the value of the dependent variable to use as the threshold. For example, to test if there is a different in the proportion of observations below $10,000, threshold = 10000 would be used.

comparison

If "proportion" is chosen as the test, comparison indicates the inequality to use. Options are "<", "<=", ">", ">=", or , "=="

r

The number of replicates in the permutation test.

digits

The number of significant digits in the output.

progress

If TRUE, prints a dot for every 1 percent of the progress while conducting the test.

method

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

Author

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu

Details

The function conducts pairwise tests using the percentileTest function. The user can consult the documentation for that function for additional details.

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

References

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

See Also

percentileTest, groupwisePercentile

Examples

Run this code
if (FALSE) {
data(BrendonSmall)
PT = pairwisePercentileTest(Sodium ~ Instructor, 
                            data = BrendonSmall, 
                            test = "percentile", 
                            tau  = 0.75)
PT
cldList(p.adjust ~ Comparison,
        data       = PT,
        threshold  = 0.05)
        
data(BrendonSmall)
PT = pairwisePercentileTest(Sodium ~ Instructor, 
                            data       = BrendonSmall, 
                            test       = "proportion", 
                            threshold  = 1300)
PT
cldList(p.adjust ~ Comparison,
        data       = PT,
        threshold  = 0.05)                         
}

Run the code above in your browser using DataLab