fmri.lm {fmri}R Documentation

Linear Model For FMRI Data

Description

Estimate the parameters and variances in a linear model.

Usage

  fmri.lm(data, z, actype = "accalc", hmax = 3.52, vtype = "var",
          step = 0.01, contrast = c(1), vvector = c(1),
          keep = "all")

Arguments

data object of class "fmridata"
z designmatrix specifying the expected BOLD response(s) and additional components for trend and other effects.
actype string describing the type of handling autocorrelation of time series. "nonac", "ac", "accalc", "smooth"
hmax bandwidth for smoothing autocorrelation parameter if actype = "smooth"
vtype method of estimating residual variance (only "var" implemented)
step step size for binning autocorrelations (see details)
contrast contrast vector
vvector vector defining the parameters for which the covariance matrix is returned as well as the corresponding length of the vector cbeta in each voxel
keep string describing the amount of data returned. If keep=="all" residuals are included in the returned object. This triggers variance estimation in fmri.smooth to based on adaptively smoothed residuals. Otherwise variance estimation is based on the estimated smootheness of the measured data. This is less memory and time consuming, but expected to be less accurate.

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-coefficient is corrected for bias. If actype=="smooth" the estimated AR-coefficients are spatially smoothed using bandwidth hmax. If actype %in% c("ac", "smooth") the linear model is prewithened using the estimated (smoothed) AR-coefficients. Parameter and variance estimates are then obtained from the prewithened data. The argument keep describes the amount of data which is returned. If "essential" only the estimated effects

tilde{gamma}_i = C^Ttilde{β}_i

and their estimated variances are returned. "all" gives the full data, including residuals, temporal autocorrelation. If vvector is given and has length greater than 1, the covariance matrix for the stimuli given therein are returned (varm) and vwghts contains an estimate for the ratio of the variances of the parameter for the stimuli indicated in vvector. cbeta then contains the corresponding parameter estimates and thus is a vector of corresponding length in each voxel.

If warning "Local smoothness characterized by large bandwidth" occurs, check scorr elements. If correlation drops with lag towards zero, data has been pre-smoothed. Adaption 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? discuard 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
res raw (integer size 2) vector containing residuals of the estimated linear model up to scale factor resscale.
resscale resscale*extract.data(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 stimululi given by vvector
mask head mask.
df Degrees of freedom for t-statistics.
hrf expected BOLD response for contrast

Note

vvector is intended to be used for delay of the HRF using its first derivative. Do not mix with the contrast argument, since unexpected side effects may occur. Look out for updates of this package.

Author(s)

Karsten Tabelow tabelow@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.

See Also

fmri.design, fmri.stimulus

Examples

  # Example 1
  data <- list(ttt=writeBin(rnorm(32*32*32*107),raw(),4),
               mask=array(1,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,keep="all")
  plot(extract.data(data)[16,16,16,])
  lines(extract.data(data)[16,16,16,] - extract.data(model,"residuals")[16,16,16,],col=2)

[Package fmri version 1.2-6 Index]