Estimate the parameters and variances in a linear model.
1 2 3 
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 
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
ARcoefficients are corrected for bias. If actype=="smooth"
the estimated ARcoefficients are spatially smoothed. If actype
%in%
c("ac", "smooth")
the linear model is prewithened
using the estimated (and possibly smoothed) ARcoefficients. Parameter
and variance estimates are then obtained from the prewithened
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 presmoothed. 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!).
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 
res 
raw (integer size 2) vector containing residuals of the estimated linear model up to scale factor resscale. 
resscale 

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

mask 
head mask. 
df 
Degrees of freedom for tstatistics. 
hrf 
expected BOLD response for contrast 
The argument vvector
is no longer supported.
Karsten Tabelow tabelow@wiasberlin.de
Worsley, K.J. (2005). Spatial smoothing of autocorrelations to control the degrees of freedom in fMRI analysis. NeuroImage, 26:635641.
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:115.
Tabelow, K., Polzehl, J., Voss, H.U., and Spokoiny, V. (2006). Analysing fMRI experiments with structure adaptive smoothing procedures, NeuroImage, 33:5562.
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? Tweet to @rdrrHQ 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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.