fmri.lm {fmri}R Documentation

Linear Model for fMRI data

Description

Estimate the parameters and variances in a linear model.

Usage

  fmri.lm(ds, z, mask = NULL,
          actype = c("smooth", "noac", "ac", "accalc"),
          contrast = c(1), verbose = FALSE)

Arguments

ds

Data object of class "fmridata"

z

Design matrix specifying the expected BOLD response(s) and additional components for trend and other effects. This can either be a matrix (in case that no slice timing is required at this stage) or an 3D - array with 3rd dimension corresponding to the slice number. It can be interpreted as stacked array of of design matrices for the individual slices.

mask

Array of dimensionality of the data describing a (brain) mask the computation should be restricted to. The default is the mask given with the data.

actype

String describing the type of handling autocorrelation of time series. One of "smooth", "nonac", "ac", "accalc".

contrast

Contrast vector for the covariates.

verbose

Verbose mode, default is FALSE.

Details

This function performs parameter estimation in the linear model. It implements a two step procedure. After primary estimation of the parameters in the first step residuals are obtained. If actype %in% c("ac", "accalc", "smooth") an AR(1) model is fitted, in each voxel, to the time series of residuals. The estimated AR-coefficients are corrected for bias. If actype=="smooth" the estimated AR-coefficients are spatially smoothed. If actype %in% c("ac", "smooth") the linear model is pre-whitened using the estimated (and possibly smoothed) AR-coefficients. Parameter and variance estimates are then obtained from the pre-whitened data. The argument keep describes the amount of data which is returned. The estimated effects

\tilde{\gamma}_i = C^T\tilde{\beta}_i

and their estimated variances are returned as well as the residuals and temporal autocorrelation. cbeta then contains the corresponding parameter estimates and thus is a vector of corresponding length in each voxel.

If z is an 3-dimensional array the third component is assumed to code the design matrix information for the corresponding slice, i.e. design matrices to differ with respect to slice timing effects. Note that if motion correction needs to be performed in preprocessing slice time correction may be better carried out on the data before image registration using, e.g., function slicetiming.

If warning "Local smoothness characterized by large bandwidth" occurs, check scorr elements. If correlation drops with lag towards zero, data has been pre-smoothed. Adaptive smoothing the SPM can then only be of limited use. If correlation does not go to zero, check the residuals of the linear model for unexplained structure (spin saturation in first scans? discard them!).

Value

object with class attributes "fmrispm" and "fmridata"

beta

estimated parameters

cbeta

estimated contrast of parameters

var

estimated variance of the contrast of parameters.

varm

covariance matrix of the parameters given by vvector

residuals

raw (integer size 2) vector containing residuals of the estimated linear model up to scale factor resscale.

resscale

resscale*extractData(object,"residuals") are the residuals.

dim

dimension of the data cube and residuals

arfactor

estimated autocorrelation parameter

rxyz

array of smoothness from estimated correlation for each voxel in resel space (for analysis without smoothing)

scorr

array of spatial correlations with maximal lags 5, 5, 3 in x,y and z-direction.

bw

vector of bandwidths (in FWHM) corresponding to the spatial correlation within the data.

weights

ratio of voxel dimensions

vwghts

ratio of estimated variances for the stimuli given by vvector

mask

head mask.

df

Degrees of freedom for t-statistics.

hrf

expected BOLD response for contrast

Author(s)

Karsten Tabelow tabelow@wias-berlin.de, Joerg Polzehl polzehl@wias-berlin.de

References

Worsley, K.J. (2005). Spatial smoothing of autocorrelations to control the degrees of freedom in fMRI analysis. NeuroImage, 26:635-641.

Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H., Morales, F., Evans, A.C. (2002). A general statistical analysis for fMRI data. NeuroImage, 15:1-15.

Tabelow, K., Polzehl, J., Voss, H.U., and Spokoiny, V. (2006). Analysing fMRI experiments with structure adaptive smoothing procedures, NeuroImage, 33:55-62.

See Also

fmri.design, fmri.stimulus

Examples

  ## Not run: 
  # Example 1
  data <- list(ttt=writeBin(rnorm(32*32*32*107), raw(), 4),
               mask=array(TRUE, c(32, 32, 32)), dim=c(32, 32, 32, 107))
  class(data) <- "fmridata"
  hrf <- fmri.stimulus(107, c(18, 48, 78), 15, 2)
  z <- fmri.design(hrf,2)
  model <- fmri.lm(data, z, verbose=TRUE)
  plot(extractData(data)[16, 16, 16,])
  lines(extractData(data)[16, 16, 16, ] - extractData(model, "residuals")[16, 16, 16, ], col=2)
  
## End(Not run)

[Package fmri version 1.9.12.1 Index]