In this unit we write continue working on the linear regression example we have been building up to in the units 2 + 3 of the imaging part.
First, we need to modify the function makeDesignMatrix()
that you worked on last time. We want to add 2 more columns to X
inside your function:
These additional columns in the design matrix will capture any slow drift (1st additional column) and mean offset from 0 (2nd additional column). The logic of this will be discussed in class.
Next we will work on a function returnStats()
that will allow us to do some statistical significance calculations / parametric stats. The function should be called as returnStats(y, X, c)
, where
y
is the timeseries dataX
is the design matrixc
is a contrast vectorbeta = X\y;

using backslashbeta = inv(X'*X)*(X')*y;
modelfit = X*beta;
r2
- the coefficient of determinationt
for contrast c