Creates a hyperdesign object, which represents a collection of related multivariate datasets (multidesign instances) that share common design variables. This class is particularly useful for modeling multi-block data, where you want to analyze multiple related matrices, such as: * Multiple subjects in an experiment * Multiple sessions or runs * Multiple data modalities (e.g., fMRI, EEG, behavioral) * Multiple response measures
Usage
# S3 method for class 'list'
hyperdesign(
x,
block_names = NULL,
id = NULL,
space = NULL,
positional = FALSE,
aggregate = NULL
)Arguments
- x
A list of multidesign instances. Each instance should represent a related block of data
- block_names
Optional character vector of names for each block. If NULL, blocks will be automatically named as "block_1", "block_2", etc.
- id
Optional length-one character string naming the design column whose values identify corresponding entities across blocks.
- space
Optional column-space declaration: `"common"` when all blocks inhabit the same column space, or `"block"` when columns are block-specific.
- positional
Logical; if `TRUE`, declare positional row correspondence. This requires `id = NULL` and equal row counts in every block.
- aggregate
Optional duplicate-entity aggregation rule. `NULL` preserves the duplicate-key error. `"mean"` or a scalar-returning function collapses within-block replicates after requiring all non-key design fields to agree.
Value
A hyperdesign object with the following components:
- blocks
List of multidesign objects
- block_names
Names of each block
- col_indices
Matrix of column start/end indices for each block
- row_indices
Matrix of row start/end indices for each block
Details
Rows may represent independent trials or entities that correspond across blocks. Supplying `id` declares the latter role by naming a design column to join on. It does not change the row-by-column storage orientation. `common_vars` records shared design-column names (schema); `id` records the values that link rows (correspondence). `space = "common"` requires equal column counts and identical column designs, while `space = "block"` allows block-specific columns.
See also
df_to_hyperdesign for creating hyperdesign objects from data frames,
multidesign for the underlying multidesign structure,
design.hyperdesign for extracting design information
Other hyperdesign functions:
as_multidesign(),
design.hyperdesign(),
df_to_hyperdesign(),
init_transform.hyperdesign(),
subset.hyperdesign(),
xdata.hyperdesign()
Examples
# Create three multidesign objects (e.g., for three subjects)
d1 <- multidesign(
matrix(rnorm(10*20), 10, 20),
data.frame(y=1:10, subject=1, run=rep(1:5, 2))
)
d2 <- multidesign(
matrix(rnorm(10*20), 10, 20),
data.frame(y=1:10, subject=2, run=rep(1:5, 2))
)
d3 <- multidesign(
matrix(rnorm(10*20), 10, 20),
data.frame(y=1:10, subject=3, run=rep(1:5, 2))
)
# Combine into a hyperdesign
hd <- hyperdesign(
list(d1, d2, d3),
block_names = c("subject1", "subject2", "subject3")
)