Closed 0todd0000 closed 2 years ago
(Here are some answers)
(1) Yes, that is a suitable design matrix definition. The order of the variables doesn't matter, provided the contrast vector is updated according to the new order of the variables.
(2) The latter contrast vector: c = [1, 0, 0, 0, 0]
is likely the better choice. To see why, consider the contrast vector in the context of simpler designs...
First, consider simple linear regression. Using a similar pseudo-code approach to the one presented above:
X = [x1, 1]
, where the two columns' parameters are a1
and a2
, corresponding to slope and intercept, respectively.c = [1, 0]
H0: (1)a1 + (0)a2 = 0
or, equivalently: H0: a1 = 0
Next consider a two-sample t-test.
X = [x1, x2]
, where x1
and x2
are binary vectors indicating group inclusion/exclusion, and where the two columns' parameters are a1
and a2
, corresponding to group means.c = [1, -1]
H0: a1 - a2 = 0
The two simple examples above clarify that the contrast vector follows directly from the null hypothesis, and vice versa. Once you specify the null hypothesis, then it should be easy to construct the contrast vector.
I am not sure what H0 is your case, but from the proposed contrast vector it sounds like:
x1
is the variable of interest and that the others are covariates or nuisance variables.H0: a1 = 0
, where a1
is the fitted parameter corresponding to the first column.c = [1, 0, 0, 0, 0]
The other proposed contrast vector (c = [3, -1, -1, -1, 0]
) is also valid, it just corresponds to a different hypothesis. The hypothesis is:
H0: 3a1 - a2 - a3 - a4 = 0
I am not certain whether this H0 is suitable for your experiment.
Todd,
Thank you for the helpful clarification on contrast vectors. I have a follow-up question about the design matrix that accompanies the contrast vector:
Does the design matrix need to consist of only binary vectors? I notice the example (ex1d_glm.m) in the spm1d package contains continuous values for the parameter, x.
No, continuous variables are fine too. The simple linear regression example above uses a continuous variable x1
. The design matrix can consist of binary vectors, continuous vectors, a constant (i.e., intercept) or any mix of these.
Good to know, thank you for the help!
No problem!
(This is paraphrased from an email discussion.)
X = [x1, x2, x3, x4, 1]
where the last column contains 1’s as the intercept?c = [3, -1, -1, -1, 0]
orc = [1, 0, 0, 0, 0]
?