baseline_terms | R Documentation |
Extract the baseline and nuisance terms from a model object, separating them from experimental event terms. Baseline terms represent non-experimental components of the fMRI signal, such as:
Drift terms (modeling scanner drift)
Block terms (modeling run-specific baselines)
Nuisance terms (e.g., motion parameters, physiological noise)
baseline_terms(x)
x |
The model object (typically an fmri_model) |
A list of baseline_term objects. Each baseline_term represents a different component of the non-experimental signal and contains:
varname: Name of the term (e.g., "drift", "block", "motion")
design_matrix: Matrix of baseline regressors
term_type: Type of baseline term ("drift", "block", or "nuisance")
event_terms()
, fmri_model()
, baseline_model()
Other model_components:
event_terms()
,
term_indices()
# Create a model with both event and baseline terms
event_data <- data.frame(
stimulus = factor(c("face", "house", "face", "house")),
onsets = c(1, 10, 20, 30),
run = c(1, 1, 1, 1)
)
# Create sampling frame
sframe <- sampling_frame(blocklens = 50, TR = 2)
# Create event model
evmodel <- event_model(
onsets ~ hrf(stimulus),
data = event_data,
block = ~run,
sampling_frame = sframe
)
# Create baseline model with drift and block terms
bmodel <- baseline_model(
basis = "bs", # B-spline basis for drift
degree = 3, # Cubic drift model
sframe = sframe
)
# Combine into full model
fmodel <- fmri_model(evmodel, bmodel)
# Extract only the baseline terms
baseline_terms(fmodel) # Returns list with drift and block terms
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.