define_missingnesses: Combine missingness definitions into a specification

View source: R/missingness.R

define_missingnessesR Documentation

Combine missingness definitions into a specification

Description

Combine missingness definitions into a specification

Usage

define_missingnesses(...)

Arguments

...

Either the columns of a specification given as named vectors (variable, formula, link, baseline, monotone), or objects created by define_missingness(). The two forms cannot be mixed in one call.

In the column form, variable and formula are required. A column given as a single value is recycled across every variable. link defaults to "identity", and baseline and monotone to FALSE.

Value

A simulab_missing_spec base data.frame with one row per target variable, in the order given, and the columns of define_missingness(): variable, formula, link, baseline and monotone. Target variables must be unique.

Examples

# One call, named arguments, one row per target variable.
define_missingnesses(
  variable = c("outcome", "baseline"),
  formula  = c("0.2", "0.1")
)

# `monotone` keeps a unit missing at every later period once it drops out.
define_missingnesses(
  variable = c("outcome", "baseline"),
  formula  = c("0.2", "0.1"),
  monotone = TRUE
)

# Definitions built one at a time are still accepted.
define_missingnesses(
  define_missingness("outcome", formula = "0.2"),
  define_missingness("baseline", formula = "0.1")
)

simulab documentation built on Oct. 15, 2026, 5:08 p.m.