regresfast: Fast linear regressions

View source: R/RcppExports.R

regresfastR Documentation

Fast linear regressions

Description

Takes a matrix of voxels and a vector of behavior and runs fast regressions for each voxel. Covariates can be defined (i.e. age) to find the effect of each voxel on behavior within the context of other predictive factors.

Usage

regresfast(X, y, covariates, hascovar = FALSE)

Arguments

X

matrix of voxlels (columns) for all subjects (rows).

y

vector of behavioral scores.

covariates

matrix with one or more columns. Must be of same length as behavior. This variable should always be set, and the next argument can tell if covariates should be used or not.

hascovar

logical to tell whether covariates should be used.

Value

List with:

  • statistic - regression t-score

  • n - number of subjects

  • kxfm - degrees of freedom.

Author(s)

Dorian Pustina

Examples

set.seed(1234)
lesmat = matrix(rbinom(40,1,0.2), ncol=2)
set.seed(1234)
behavior = rnorm(20)
test = LESYMAP::regresfast(lesmat, behavior, as.matrix(behavior), hascovar=FALSE)
test$statistic[,1] # 0.6915683 1.1434760
test$kxmat # 2


dorianps/LESYMAP documentation built on May 22, 2024, 1:41 p.m.