event_basis: Create an event set from a ParametricBasis object.

View source: R/event-classes.R

event_basisR Documentation

Create an event set from a ParametricBasis object.

Description

This is a user-facing wrapper around the internal event() constructor, specifically for creating event sequences modulated by a basis set.

Usage

event_basis(
  basis,
  name = NULL,
  onsets,
  blockids = 1,
  durations = 0,
  subset = NULL
)

Arguments

basis

A ParametricBasis object (e.g., from BSpline, PolynomialBasis).

name

Optional name for the event variable. If NULL, uses basis$name.

onsets

Numeric vector of event onsets (seconds).

blockids

Numeric vector of block IDs.

durations

Numeric vector of event durations (seconds), or a scalar.

subset

Optional logical vector indicating which events to keep. If provided, the vector must match onsets in length and contain no NA values.

Value

An S3 object of class event and event_seq.

Examples

basis <- BSpline(1:21, 3)
onsets <- seq(0, 20, length.out = 21)
blockids <- rep(1, length(onsets))
ebasis <- event_basis(basis, onsets=onsets, blockids=blockids)
print(ebasis)
levels(ebasis)


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