train_model.rsa_model: Train an RSA Model

View source: R/rsa_model.R

train_model.rsa_modelR Documentation

Train an RSA Model

Description

This function trains an RSA (representational similarity analysis) model using the specified method and distance calculation.

Usage

## S3 method for class 'rsa_model'
train_model(obj, train_dat, y, indices, ...)

Arguments

obj

An object of class rsa_model.

train_dat

The training data.

y

The response variable.

indices

The indices of the training data.

...

Additional arguments passed to the training method.

Value

Depending on obj$regtype:

  • "lm" + no constraints + obj$semipartial=TRUE: semi-partial correlations

  • "lm" + no constraints + obj$semipartial=FALSE: T-values of each predictor

  • "lm" + nneg constraints: raw coefficients from constrained glmnet

  • "rfit": robust regression coefficients

  • "pearson" or "spearman": correlation coefficients

Examples


  dset_info <- gen_sample_dataset(D = c(8, 8, 8), nobs = 20,
    response_type = "categorical", data_mode = "image", nlevels = 2)
  dismat <- dist(matrix(rnorm(20 * 20), 20, 20))
  rdes <- rsa_design(~ dismat, list(dismat = dismat))
  rsa_mod <- rsa_model(dset_info$dataset, rdes, regtype = "lm")
  train_model(rsa_mod, dset_info$dataset$train_data,
    dset_info$design$y_train,
    indices = seq_len(ncol(dset_info$dataset$train_data)))


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