Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

friedman_test

Friedman Rank Sum Test


Description

Provides a pipe-friendly framework to perform a Friedman rank sum test, which is the non-parametric alternative to the one-way repeated measures ANOVA test. Wrapper around the function friedman.test(). Read more: Friedman test in R.

Usage

friedman_test(data, formula, ...)

Arguments

data

a data.frame containing the variables in the formula.

formula

a formula of the form a ~ b | c, where a (numeric) is the dependent variable name; b is the within-subjects factor variables; and c (factor) is the column name containing individuals/subjects identifier. Should be unique per individual.

...

other arguments to be passed to the function friedman.test.

Value

return a data frame with the following columns:

  • .y.: the y (dependent) variable used in the test.

  • n: sample count.

  • statistic: the value of Friedman's chi-squared statistic, used to compute the p-value.

  • p: p-value.

  • method: the statistical test used to compare groups.

Examples

# Load data
#:::::::::::::::::::::::::::::::::::::::
data("ToothGrowth")
df <- ToothGrowth %>%
    filter(supp == "VC") %>%
    mutate(id = rep(1:10, 3))
head(df)

# Friedman rank sum test
#:::::::::::::::::::::::::::::::::::::::::
df %>% friedman_test(len ~ dose | id)

rstatix

Pipe-Friendly Framework for Basic Statistical Tests

v0.7.0
GPL-2
Authors
Alboukadel Kassambara [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.