## Linear Model for fMRI data

### Description

Estimate the parameters and variances in a linear model.

### Usage

 1 2 3  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 Designmatrix specifying the expected BOLD response(s) and additional components for trend and other effects. 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-withened using the estimated (and possibly smoothed) AR-coefficients. Parameter and variance estimates are then obtained from the pre-withened data. The argument keep describes the amount of data which is returned. The estimated effects

\tilde{γ}_i = C^T\tilde{β}_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 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 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

The argument vvector is no longer supported.

### 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.

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

  1 2 3 4 5 6 7 8 9 10 11 12  ## Not run: # 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, verbose=TRUE) plot(extract.data(data)[16, 16, 16,]) lines(extract.data(data)[16, 16, 16, ] - extract.data(model, "residuals")[16, 16, 16, ], col=2) ## End(Not run) 

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.