glmcoef: Fit GLM (general linear model) to the fMRI time-series of all...

View source: R/BHMSMA.R

glmcoefR Documentation

Fit GLM (general linear model) to the fMRI time-series of all voxels within a single 2D brain slice

Description

glmcoef fits a GLM to the fMRI time-series of all voxels within a single 2D brain slice for each subject, and returns standardized GLM coefficients along with their standard error for the included regressors (it does not add any intercept by itself).

Usage

glmcoef(n, grid, data, designmat)

Arguments

n

Number of subjects.

grid

The number of voxels in one row (or, one column) of the brain slice of interest. Must be a power of 2. The total number of voxels is grid^2. The maximum value of grid for this package is 512.

data

The data in the form of an array with dimension (n,grid,grid,ntime), where ntime is the size of the time series for each voxel.

designmat

The design matrix used to generate the data. An intercept column should be included unless not desired.

Value

A list containing the following.

GLMCoefStandardized

An array of dimension (n,grid,grid), containing for each subject the standardized GLM coefficients obtained by fitting GLM to the time-series corresponding to the voxels.

GLMCoefSE

An array of dimension (n,grid,grid), containing for each subject the estimated standard errors of the GLM coefficients.

Author(s)

Nilotpal Sanyal, Marco Ferreira

Maintainer: Nilotpal Sanyal <nilotpal.sanyal@gmail.com>

References

Friston, K.J., Holmes, A.P., Worsley, K.J., Poline, J., Frith, C.D., Frackowiak, R.S.J., 1994. Statistical parametric maps in functional imaging: a general linear approach. Hum. Brain Mapp. 2 (4), 189-210.

See Also

lm, waveletcoef

Examples

set.seed(1)
n <- 3
grid <- 8
ntime <- 10
designmat <- cbind(rep(1,10),c(rep(c(1,0),5)))
data <- array(dim=c(n,grid,grid,ntime),
  rnorm(n*grid*grid*ntime))
glm.fit <- glmcoef(n,grid,data,designmat)
dim(glm.fit$GLMCoefStandardized)
#[1] 3 8 8

BHMSMAfMRI documentation built on Oct. 2, 2022, 9:05 a.m.