Learn R Programming

fmri (version 1.0)

fmri.lm: 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 = "essential")

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: "essential", "diagnostic", "all"

Value

  • object with class attributes "fmrispm" and "fmridata"
  • betaEstimated parameters
  • cbetaEstimated contrast of parameters
  • varEstimated variance of the contrast of parameters.
  • varmCovariance matrix of the parameters given by vvector
  • resResiduals of the estimated linear model
  • arfactorEstimated autocorrelation parameter
  • scorrspatial correlation of data
  • weightsratio of voxel dimensions
  • vwghtsratio of estimated variances for the stimululi given by vvector
  • rxyzarray of smoothness from estimated correlation for each voxel in resel space (for analysis without smoothing)
  • hrfExpected BOLD response for contrast

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^T\tilde{\beta}_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.

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

Run this code
# Example 1
  data <- list(ttt=array(rnorm(32*32*32*107),c(32,32,32,107)),
               mask=array(1,c(32,32,32)))
  class(data) <- "fmri.data"
  hrf <- fmri.stimulus(107, c(18, 48, 78), 15, 2)
  z <- fmri.design(hrf,2)
  model <- fmri.lm(data,z,keep="all")
  plot(data$ttt[16,16,16,])
  lines(data$ttt[16,16,16,] - model$res[16,16,16,],col=2)

Run the code above in your browser using DataLab