nptrend: Nonparametric trend across ordered groups

View source: R/advanced-models.R

nptrendR Documentation

Nonparametric trend across ordered groups

Description

Tests for monotonic trend across ordered groups, including quantitative and binary outcomes and hierarchical strata.

Usage

nptrend(x,
  by,
  data = NULL,
  method = c("auto",
    "cuzick",
    "cochran-armitage",
    "spearman",
    "linear"),
  event = NULL,
  scores = NULL,
  digits = 3,
  p_digits = 3,
  show = TRUE,
  console = FALSE)

Arguments

x

Outcome variable.

by

Ordered group. With vars(...), the final variable is the ordered group and preceding variables are strata.

data

Data frame or active data.

method

Automatic, Cuzick-style rank trend, Cochran-Armitage, Spearman, or linear trend.

event

Event value for binary trend analysis.

scores

Optional numeric scores for group levels.

digits, p_digits, show, console

Formatting/display controls.

Value

An R4VN result object, invisibly.

See Also

kwallis

Examples

d <- data.frame(y = c(2,3,4,4,5,7,8,9,10), dose = ordered(rep(1:3, each=3)))
nptrend(y, by = dose, data = d)


R4VN documentation built on Sept. 30, 2026, 5:13 p.m.