Learn R Programming

vows (version 0.5)

lm4d: Voxelwise linear models

Description

This is a wrapper function for lm.mp to handle 3D image responses.

Usage

lm4d(arr4d, formula, store.fitted = FALSE)

Arguments

arr4d
a 4-dimensional response array, where the first 3 dimensions refer to spatial coordinates and the last dimension corresponds to different images.
formula, store.fitted
see lm.mp.

Value

An object of class "lm.mp", with two changes. (1) If store.fitted = TRUE, the fitted values are given as a 4-dimensional array. (2) A call component is included.

See Also

lm.mp

Examples

Run this code

data(test)
d4 = test$d4
x = test$x
lmobj = lm4d(d4, ~x)

# Convert d4 to a matrix, and confirm that lm.mp() gives the same results as lm4d()
d4.2 = d4
dim(d4.2) = c(prod(dim(d4)[1:3]), dim(d4)[4])
Y = t(d4.2)
lmobj2 = lm.mp(Y, ~x)
all.equal(lmobj$coef, lmobj2$coef)

Run the code above in your browser using DataLab