glmcoef.Rd
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).
glmcoef(n, grid, data, designmat)
Number of subjects.
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.
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.
The design matrix used to generate the data. An intercept column should be included unless not desired.
A list containing the following.
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.
An array of dimension (n,grid,grid)
, containing for each subject the estimated standard errors of the GLM coefficients.
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.
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)
#> Error in glmcoef_sub(grid, data[i, , , ], designmat): object '_BHMSMAfMRI_glmcoef_sub' not found
dim(glm.fit$GLMCoefStandardized)
#> Error in glm.fit$GLMCoefStandardized: object of type 'closure' is not subsettable
#[1] 3 8 8