is_event: Compare value to reference.

View source: R/event_testing.R

is_eventR Documentation

Compare value to reference.

Description

Check if an outcome value determines a valid worsening, or improvement, or change, from a given reference value.

Usage

is_event(
  x,
  baseline,
  type,
  outcome = "edss",
  worsening = NULL,
  delta_fun = NULL,
  sub_threshold = FALSE
)

Arguments

x

Outcome value to test.

baseline

Outcome value at baseline.

type

One of:

  • "wors" (worsening);

  • "impr" (improvement);

  • "change" (any valid change).

outcome

One of:

  • "edss" (Extended Disability Status Scale, default);

  • "nhpt" (Nine-Hole Peg Test);

  • "t25fw" (Timed 25-Foot Walk);

  • "sdmt" (Symbol Digit Modalities Test);

  • "custom" (only accepted when specifying non-NULL worsening – and delta_fun as well, if sub_threshold=FALSE).

Outcome type determines the direction of worsening (see worsening argument) and selects the default definition of clinically meaningful change given the reference value (using the built-in function compute_delta()). The latter can be replaced by a custom function using the delta_fun argument.

worsening

The direction of worsening ("increase" if higher values correspond to worse disease course, "decrease" otherwise). This argument is only used when outcome is set to "custom". Otherwise, worsening is automatically set to "increase" for EDSS, NHPT, T25FW, and to "decrease" for SDMT.

delta_fun

Custom function specifying the minimum clinically meaningful change in the outcome measure from the provided reference value. The function provided must take a numeric value (reference score) as input, and return a numeric value corresponding to the minimum relevant shift from baseline, see example below. If outcome is set to "custom", a custom delta function must be specified by the user. For other values of outcome, if no delta_fun is specified, the built-in function compute_delta() is used internally. The argument is ignored if sub_threshold=TRUE.

sub_threshold

If TRUE, any confirmed worsening, or improvement, or change in the outcome measure is valid, regardless of delta_fun.

Value

A boolean value specifying if a valid event was found.

Examples

is_event(x=4.5, baseline=4, type="wors", outcome="edss")
is_event(x=50, baseline=57, type="wors", outcome="sdmt")
is_event(x=3, baseline=3.5, type="impr", outcome="edss", sub_threshold=TRUE)

msprog documentation built on Sept. 4, 2026, 5:08 p.m.