On Wed, 23 Mar 2005 17:17:08 +0100, Neggers, S.F.W. (Bas) <[log in to unmask]> wrote: >Dear all, > >interesting discussion. I was only referring to the observation that (X'*X)^(-1) can't be solved, it results in a singular matrix. When of course reducing the matrix to independent vectors spanning the space of the model, this wouldn't be a problem anymore mathematically, I agree. Didn't know spm2 would do that for you, I simply never tried for that reason. > >To illustrate, try this in matlab: > >Xc=[1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0]'; % a block regressor >X=[Xc,ones(size(Xc))]; % a correct design matrix with an intercept added >Y=Xc+rand(24,1)/2; % simulate some data with a block pattern + noise > >B=(X'*X)^(-1) * X'*Y; % estimate Betas. so far so good >X=[Xc,ones(size(Xc)),Xc]; % add an identical regressor >B=(X'*X)^(-1) * X'*Y; % estimate Betas again. problem: > >B=(X'*X)^(-1) * X'*Y >Warning: Matrix is singular to working precision. >(Type "warning off MATLAB:singularMatrix" to suppress this warning.) > >B = > > NaN > NaN > NaN > >Same results for adding Xc*3 for that matter. >This all only to illustrate that an extra constant regressor is not meaningful at all. >Wouldn't the contrasts to calculate be a little problematic to interprete when a reduced matrix is used? The Beta associated with an 'emty regressor' for such a session would mainly explain the baseline for that session, and not so much an activation amplitude for such a condition. I'm sure I am missing something here.... SPM dealt sensibly with the issues you're raising here years ago. See e.g. the sections "2.4 Overdetermined models" and "2.6.3 Estimable functions, contrasts" in Chapter 3 of the first _Human Brain Function_ book, at URL http://www.fil.ion.ucl.ac.uk/spm/doc/books/hbf1/Ch3.pdf Best, S > >Cheers, > >Bas > >-----Oorspronkelijk bericht----- >Van: SPM (Statistical Parametric Mapping) >[mailto:[log in to unmask]]Namens Stephen J. Fromm >Verzonden: woensdag 23 maart 2005 16:41 >Aan: [log in to unmask] >Onderwerp: Re: [SPM] empty conditions in design > > >On Wed, 23 Mar 2005 09:05:20 -0500, Satrajit Ghosh ><[log in to unmask]> wrote: > >>Dear Jan and list, >> >>Thanks you for your replies. I do have batch scripts which do pretty >>much what you suggest, but this is precisely what I wanted to avoid. >>Perhaps my matrix algebra is conflicting with my SPM estimation. >> >>To give a clearer example, lets look at the following code. >> >>a = kron(eye(2),rand(20,10)); >>a(:,[3,4,5,14,15,16]) = 0; >>[u,s,v] = svd(a); >> >>The empty columns would correspond to singular values of 0. And SPM >>does do a design matrix reduction to remove linear dependencies that >>exist. So, I don't see why specifying empty onsets is a problem >>mathematically. > >The problem isn't mathematical, really. By linear algebra convention, >matrices don't have empty columns. > >The issue is rather a computing language issue: It would be convenient if >columns could be designated as empty. I came across this problem while >scripting SPM2 stats to speed up design specification for some users with >unbalanced designs---if empty columns were allowed, I could specify the >order of conditions independently of runs (i.e., sessions). (This could >be done by making the columns of the design matrix elements of a cell >array.) > >The way SPM is written, however, the columns can't be empty (which of >course is perfectly reasonable). Therefore, as I believe Jan Gläscher >implied, you have to batch or script around this. > >> >>As Bas suggests and if X did have zeros in columns this estimation >>would be problematic. >> >>B= (X'X)^-1 x X'Y >> >>But, in SPM X is not really the created design matrix. It is a reduced >>form and contrasts get mapped to this reduced form. Hence, I'm trying >>to understand why the designers of SPM didn't allow empty conditions. >> >>Thanks again, >> >>Satra >> >>On Wed, 23 Mar 2005 12:47:32 +0100, Jan Gläscher >><[log in to unmask]> wrote: >>> Dear Satra and list, >>> >>> SPM won't let you estimate a design matrix with empty regressors as all >>> the other answers have correctly suggested. I will outline a solution >>> for a conditional design and contrast specification below, but I must >>> stress that it is complicated and therefore I would therefore strongly >>> recommend using the batching facilities in SPM2. If you are not >>> familiar with batching you will find a lot of sample batch files on this >>> list, e.g. Karl Friston's sample file >>> >>> http://www.jiscmail.ac.uk/cgi-bin/wa.exe?A2=ind02&L=spm&P=R282882&I=-1 >>> >>> Now, there are 3 constraints to this problem that have to be taken into >>> account: >>> >>> (1) There must not be any empty regressors. >>> (2) For a valid parametric modulation there must be at least 2 trials >>> (= 2 onset) in the "onset" regressors (i.e. the one where you >>> specify your onsets) >>> (3) Contrast specification is tricky (Therefore I recommend a spcific >>> naming scheme for your regressors (and parametric modulations) which >>> you can later reference) >>> >>> Here is some example code for solving problem (1) and (2) ...