conditions: Conditions

View source: R/all_generic.R

conditionsR Documentation

Conditions

Description

Return the set of condition labels associated with a model term. Conditions represent the unique experimental conditions in the design, typically formed from factor levels and/or basis functions. For example, a term with factor "stimulus" (levels: face, house) and two basis functions would have conditions: "stimulus[face]:basis1", "stimulus[face]:basis2", "stimulus[house]:basis1", "stimulus[house]:basis2".

Usage

conditions(x, ...)

## S3 method for class 'afni_hrf_convolved_term'
conditions(x, ...)

## S3 method for class 'afni_trialwise_convolved_term'
conditions(x, ...)

## S3 method for class 'convolved_term'
conditions(x, ...)

## S3 method for class 'event_term'
conditions(x, drop.empty = TRUE, expand_basis = FALSE, ...)

Arguments

x

The model term (typically an event_term, event_model, or convolved_term)

...

Additional arguments passed to methods

drop.empty

Logical; if TRUE, conditions with no events are dropped (default: TRUE)

expand_basis

Logical; if TRUE, basis function labels are included (default: TRUE)

Value

A character vector of condition labels

See Also

cells(), event_model(), hrf()

Examples

# Create a simple event model with a categorical predictor
event_data <- data.frame(
  stimulus = factor(c("face", "house", "face", "house")),
  onsets = c(1, 10, 20, 30),
  run = c(1, 1, 1, 1)
)

# Create a sampling frame
sframe <- sampling_frame(blocklens = 50, TR = 2)

# Create an event model with canonical HRF
evmodel <- event_model(
  onsets ~ hrf(stimulus),
  data = event_data,
  block = ~run,
  sampling_frame = sframe
)

# Get condition labels
conditions(evmodel)  # Returns: c("stimulus[face]", "stimulus[house]")

# Create model with multiple basis functions
evmodel2 <- event_model(
  onsets ~ hrf(stimulus, basis = "fourier", nbasis = 2),
  data = event_data,
  block = ~run,
  sampling_frame = sframe
)

# Get conditions with basis functions
conditions(evmodel2)  # Returns conditions with basis labels

bbuchsbaum/fmrireg documentation built on June 10, 2025, 8:18 p.m.