As far as I know, the following packages are available:
DescTools
clinfun
PMCMRplus
fastJT
Due to availability in the company, DescTools version 0.99.55 is used to compare the results with SAS. Of these packages DescTools is the most common.
Data used
The data for testing is a sample dataset on a dose-response study.
The Group indicates a dose of a drug. The scores for Group represent ordering of dose arms. Then the boxplot implies a declining dose-response relationship.
Example Code
library(DescTools)library(ggplot2)library(readr)## Constantsk_n_samp <-10000set.seed(4989)## The input dataset is imported.#inds <-read_csv("../data/jonck.csv", col_select =c(DOSE, value))
New names:
Rows: 40 Columns: 2
── Column specification
──────────────────────────────────────────────────────── Delimiter: "," dbl
(2): DOSE, value
ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
Specify the column types or set `show_col_types = FALSE` to quiet this message.
• `` -> `...1`
## Analysis#jt_norm <- DescTools::JonckheereTerpstraTest( value ~ DOSE,alternative ="decreasing",data = inds)
Warning in JonckheereTerpstraTest.default(alternative = alternative, c(153, : Sample size > 100 or data with ties
p-value based on normal approximation. Specify nperm for permutation p-value
Warning in JonckheereTerpstraTest.default(alternative = alternative, nperm = nperm, : Sample size > 100 or data with ties
p-value based on normal approximation. Specify nperm for permutation p-value
jt_norm
Jonckheere-Terpstra test
data: value by DOSE
JT = 184.5, p-value = 0.002655
alternative hypothesis: decreasing
jt_resamp
Jonckheere-Terpstra test
data: value by DOSE
JT = 184.5, p-value = 0.0023
alternative hypothesis: decreasing
Reference
Signorell A (2024). DescTools: Tools for Descriptive Statistics. R package version 0.99.55, https://github.com/AndriSignorell/DescTools/, https://andrisignorell.github.io/DescTools/.