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, ...)

Arguments

x

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

...

Additional arguments passed to methods. Common arguments include:

  • drop.emptyLogical; if TRUE, conditions with no events are dropped

  • exclude_basisLogical; if TRUE, basis function labels are excluded

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 March 1, 2025, 11:20 a.m.