mvpa_design: Create an MVPA Design Object

View source: R/design.R

mvpa_designR Documentation

Create an MVPA Design Object

Description

Constructs an MVPA design object, defining the classification or regression problem for Multi-Variate Pattern Analysis (MVPA). It handles different configurations of input datasets, response variables, and optional parameters, such as blocking variables and group structures.

Usage

mvpa_design(
  train_design,
  y_train,
  test_design = NULL,
  y_test = NULL,
  block_var = NULL,
  split_by = NULL
)

Arguments

train_design

A data.frame containing the training variables.

y_train

A formula, character name, or factor specifying the response variable for training. Must have at least 2 levels with one or more training instances.

test_design

An optional data.frame containing the test variables. Must be provided if y_test is specified.

y_test

An optional formula, character name, or factor specifying the response variable for testing. Requires test_design to be provided.

block_var

An optional formula, character name, or integer vector specifying the blocking variable, used for repeated measures designs.

split_by

An optional formula indicating the grouping structure for evaluating test performance. Splitting condition must result in at least 3 observations per group.

Value

An object of class mvpa_design, containing the training and optional test design, response variables, blocking variable, and group structure.

Examples

df1 <- data.frame(y = rep(letters[1:4], 5), x1 = rnorm(20), x2 = rnorm(20), block = rep(1:4, each = 5))
des <- mvpa_design(df1, ~ y, block_var = ~ block)

## With a test set
testdes <- data.frame(y = sample(letters[1:4], 10))
des <- mvpa_design(df1, ~ y, block_var = ~ block, test_design = testdes, y_test = ~ y)


bbuchsbaum/rMVPA documentation built on April 23, 2024, 7:35 a.m.