msreve_design: Constructor for msreve_design

View source: R/msreve_design.R

msreve_designR Documentation

Constructor for msreve_design

Description

Creates an msreve_design object, which encapsulates the necessary design information for a Multi-Dimensional Signed Representational Voxel Encoding (MS-ReVE) analysis.

Usage

msreve_design(
  mvpa_design,
  contrast_matrix,
  name = "msreve_design_01",
  include_interactions = FALSE
)

Arguments

mvpa_design

An object of class \codemvpa_design, containing information about conditions, blocks, and cross-validation.

contrast_matrix

A numeric matrix (\codeK x Q) where \codeK is the number of conditions and \codeQ is the number of contrasts. Each column represents a contrast vector. It is highly recommended that columns are named to identify the contrasts.

name

An optional character string to name the design.

include_interactions

Logical. If TRUE, automatically add pairwise interaction contrasts using add_interaction_contrasts.

Value

An object of class \codemsreve_design, which is a list containing: \itemmvpa_designThe input \codemvpa_design object. \itemcontrast_matrixThe input \codecontrast_matrix. \itemnameThe name of the design.

Examples

# Assume 'mvpa_des_obj' is a pre-existing mvpa_design object
# e.g. from mvpa_design(data=my_data_frame, formula = ~ condition_labels + run_labels,
#                       block_var = "run_labels")
# Let\'s say mvpa_des_obj implies 6 conditions based on unique(my_data_frame$condition_labels)
K <- 6 # Number of conditions
Q <- 2 # Number of contrasts

# Example contrast matrix (K x Q)
C_mat <- matrix(c(
 # C1: Cond 1,2,3 vs 4,5,6
  1,  1,  1, -1, -1, -1,
 # C2: Cond 1,2 vs 3 (and 0 for 4,5,6 for simplicity here)
  1,  1, -2,  0,  0,  0
), nrow = K, ncol = Q, byrow = FALSE)
colnames(C_mat) <- c("GroupComparison", "SubComparison")

# if (inherits(mvpa_des_obj, "mvpa_design")) {
#  design_obj <- msreve_design(mvpa_des_obj, C_mat, name="example_msreve")
#  print(design_obj)
# }
#
# # Automatically add pairwise interactions
# design_obj_int <- msreve_design(mvpa_des_obj, C_mat,
#                                include_interactions = TRUE)
# colnames(design_obj_int$contrast_matrix)

bbuchsbaum/rMVPA documentation built on June 10, 2025, 8:23 p.m.