Type: Package
Title: Thresholded Partial Least Squares Model for Neuroimaging Data
Version: 1.0.4
Description: Uses thresholded partial least squares algorithm to create a regression or classification model. For more information, see Lee, Bradlow, and Kable <doi:10.1016/j.crmeth.2022.100227>.
License: GPL-3
Depends: R (≥ 3.5), plotly (≥ 4.9.2.1)
Encoding: UTF-8
LazyData: true
NeedsCompilation: no
RoxygenNote: 7.2.0
LazyDataCompression: xz
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Packaged: 2022-06-10 21:09:04 UTC; sangil
Author: Sangil Lee [aut, cre]
Maintainer: Sangil Lee <sangillee3rd@gmail.com>
Repository: CRAN
Date/Publication: 2022-06-10 21:20:23 UTC

Constructor method for fitting a T-PLS model with given data X and Y.

Description

Constructor method for fitting a T-PLS model with given data X and Y.

Usage

TPLS(X, Y, NComp = 25, W = NULL, nmc = 0)

Arguments

X

Numerical matrix of predictors. Typically single-trial betas where each column is a voxel and row is observation

Y

Variable to predict. Binary 0 and 1 in case of classification, continuous variable in case of regression

NComp

(Optional) Number of PLS components to compute. Default is 25.

W

(Optional) Observation weights. By default, all observations have equal weight.

nmc

(Optional) 'no mean centering'. Default is 0. If 1, T-PLS will skip mean-centering. This option is only provided in case you already mean-centered the data and want to save some memory usage.

Value

A TPLS object that contains the following attributes. Most of the time, you won't need to access the attributes.

See vignettes for tutorial


Constructor method for fitting a cross-validation T-PLS model

Description

Constructor method for fitting a cross-validation T-PLS model

Usage

TPLS_cv(X, Y, CVfold, NComp = 25, W = NULL, nmc = 0)

Arguments

X

Numerical matrix of predictors. Typically single-trial betas where each column is a voxel and row is observation

Y

Variable to predict. Binary 0 and 1 in case of classification, continuous variable in case of regression

CVfold

Cross-validation testing fold information. Can either be a vector or a matrix, the latter being more general. Vector: n-by-1 vector. Each element is a number ranging from 1 ~ numfold to identify which testing fold each observation belongs to Matrix: n-by-numfold matrix. Each column indicates the testing data with 1 and training data as 0. Example: For leave-one-out CV, Vector would be 1:n, Matrix form would be eye(n) Matrix form is more general as it can have same trial be in multiple test folds

NComp

(Optional) Number of PLS components to compute. Default is 25.

W

(Optional) Observation weights. Optional input. By default, all observations have equal weight. Can either be a n-by-1 vector or a n-by-nfold matrix where each column is observation weights in that CV fold

nmc

(Optional) 'no mean centering'. See TPLS for more detail. Turning this on will skip mean centering on all cross validation folds, so they should all be mean-centered already

Value

A TPLS_cv object that contains the following attributes. Most of the time, you won't need to access the attributes.

See vignettes for tutorial


Sample participant data from a left-right button press task

Description

A dataset containing five sample participant's binary button presses inside the scanner (left/right).

Usage

TPLSdat

Format

A data frame with following variables

X

Brain image single trial coefficients. N-by-v matrix

Y

Left = 0, Right = 1, binary indicator of participant choice

subj

Subject number (i.e., 1, 2, 3)

run

Run number (i.e., 1, 2, 3, 4, 5, 6, 7, 8)

mask

Binary 3D brain image that indexes where the variables in X came from.

Source

Kable, J. W., Caulfield, M. K., Falcone, M., McConnell, M., Bernardo, L., Parthasarathi, T., ... & Diefenbach, P. (2017). No effect of commercial cognitive training on brain activity, choice behavior, or cognitive performance. Journal of Neuroscience, 37(31), 7390-7402.


Method for making predictions on a testing dataset testX

Description

Method for making predictions on a testing dataset testX

Usage

TPLSpredict(TPLSmdl, compval, threshval, testX)

Arguments

TPLSmdl

A TPLS object created from using function TPLS

compval

Vector of number of components to use in final predictor. Providing a vector will provide multiple predictions (e.g., c(3,4,5) will provide three prediction columns each with 3, 4, and 5 PLS components)

threshval

Threshold number between 0 and 1 (inclusive) for thresholding the betamap. This must be a scalar.

testX

Data that you want to predict the Y of

Value


Evaluating cross-validation performance of a TPLS_cv model at compvec and threshvec

Description

Evaluating cross-validation performance of a TPLS_cv model at compvec and threshvec

Usage

evalTuningParam(
  TPLScvmdl,
  type = c("Pearson", "negMSE", "ACC", "AUC", "LLbinary", "Spearman"),
  X,
  Y,
  compvec,
  threshvec,
  subfold = NULL
)

Arguments

TPLScvmdl

TPLS_cv model created from TPLS_cv

type

CV performance metric type. One of LLbinary, negMSE, Pearson, Spearman, AUC, ACC.

X

The same X as used in TPLScvmdl.

Y

The SAME Y as used in TPLScvmdl.

compvec

Vector of number of components to test in cross-validation.

threshvec

Vector of threshold level (0 ~ 1) to test in cross-validation.

subfold

(Optional) vector of subdivision within testing fold to calculate performance. For example scan run division within subject.

Value

A evalTuningParam object that contains the following attributes.


Method for extracting the T-PLS predictor at a given compval and threshval

Description

Method for extracting the T-PLS predictor at a given compval and threshval

Usage

makePredictor(TPLSmdl, compval, threshval)

Arguments

TPLSmdl

A TPLS object created from using function TPLS

compval

Vector of number of components to use in final predictor. Providing a vector will provide multiple betamaps (e.g., c(3,4,5) will provide three betamaps each with 3, 4, and 5 PLS components)

threshval

Threshold number between 0 and 1 (inclusive) for thresholding the betamap. This must be a scalar.

Value


Plots the tuning surface of TPLS

Description

Plots the tuning surface of TPLS

Usage

plotTuningSurface(object)

Arguments

object

: evalTuningParam object