help > data mean adjustment
Showing 1-6 of 6 posts
Display:
Results per page:
May 9, 2016  05:05 PM | Gina Joue
data mean adjustment
Hi,

I have a question about the mean adjustment done in gPPI. I set P.contrast to the index of the effects of interest F-contrast (which I defined as [eye(nCondsAllRuns) zeros(nCondsAllRuns,nNuisanceRegr)]).

If you plot a regressor with its PPI regressor counterpart (from SPM.xX.X), should they both have a "zero" baseline? In the attached plot, I'm told that the one on the left looks like how it should be and the plot on the right looks suspicious and as if the adjustment were done over the entire time series rather than only on the events of interest. Is this grounds for concern?

Thanks very much in advance!
Gina
Attachment: gPPImeanAdj.jpg
May 10, 2016  12:05 AM | Donald McLaren
RE: data mean adjustment
Gina,

Could you please send the commands used to generate the plots and the input data? It's hard to tell what is going on as the graphs have different numbers trials and the events go in different directions.

I suspect that the regressors are simply being mean centered by SPM. This should not be an issue and should not impact the estimates. However, it would be good to know how these plots were generated to make sure nothing is wrong.

Best,
Donald
May 10, 2016  09:05 AM | Gina Joue
RE: data mean adjustment
Hiya,

Here is a sample SPM.mat for one subject and the commands:

xlvl = {'conCinsTrem0' 'conCinsTrem1' 'conCinsDrem0' 'conCinsDrem1' 'conIinsTrem0' 'conIinsTrem1' 'conIinsDrem0' 'conIinsDrem1'};

for i=1:length(xlvl)
xlvlPPI{i} = sprintf('PPI_%s',xlvl{i});
end

load('SPM.mat');

for c=1:length(xlvl)
   cinds = find(~cellfun(@isempty, regexp(SPM.xX.name,sprintf(' %s',xlvl{c})))); % need to add space or will also match PPI_
   pinds = find(~cellfun(@isempty, regexp(SPM.xX.name,xlvlPPI{c})));
   for i=1:length(cinds)
      figure(s*100+c*10+i)
      plot(SPM.xX.X(1:178,cinds(i)))
      hold on
      plot(SPM.xX.X(1:178,pinds(i)),'r')
      title(['sub' subj '\color{blue}' SPM.xX.name(cinds(i)) ' - ' '\color{red}' SPM.xX.name(pinds(i))])
   end
end

Thank you, Donald!!

Gina
Attachment: SPM.mat
May 11, 2016  12:05 AM | Donald McLaren
RE: data mean adjustment
I would not be concerned about this happening. The PPI terms are mean-centered as part of the code. The higher the amplitude of the PPI regressors or the more events, the more the DC shift will be in the data. The DC term is offset by the constant term in the model.
Originally posted by Gina Joue:
Hiya,

Here is a sample SPM.mat for one subject and the commands:

xlvl = {'conCinsTrem0' 'conCinsTrem1' 'conCinsDrem0' 'conCinsDrem1' 'conIinsTrem0' 'conIinsTrem1' 'conIinsDrem0' 'conIinsDrem1'};

for i=1:length(xlvl)
xlvlPPI{i} = sprintf('PPI_%s',xlvl{i});
end

load('SPM.mat');

for c=1:length(xlvl)
   cinds = find(~cellfun(@isempty, regexp(SPM.xX.name,sprintf(' %s',xlvl{c})))); % need to add space or will also match PPI_
   pinds = find(~cellfun(@isempty, regexp(SPM.xX.name,xlvlPPI{c})));
   for i=1:length(cinds)
      figure(s*100+c*10+i)
      plot(SPM.xX.X(1:178,cinds(i)))
      hold on
      plot(SPM.xX.X(1:178,pinds(i)),'r')
      title(['sub' subj '\color{blue}' SPM.xX.name(cinds(i)) ' - ' '\color{red}' SPM.xX.name(pinds(i))])
   end
end

Thank you, Donald!!

Gina
May 27, 2016  07:05 AM | Gina Joue
RE: data mean adjustment
Hi,
We've been playing around with mean centering and it seems like when we adjust it so that the PPI regressor and its counterpart have "zero" baseline that the design is more "estimable" (see attached figure -- on left is the design matrix when running gPPI as is, i.e. with mean calculated over the entire time series (with the graph of a culprit regressor underneath), and on the right is the design matrix with gPPI modified to mean center only over events of interest and the graph of one of the culprit regressors underneath showing that the PPI regressor and its counterpart has been mean centered. The modification our lab director made is around line 710 of PPI.m:

% **************************************
% EM within event "mean adjust"
em_tmp=zeros(length(ppit),1);

% need to do "event" first ...
em_PSYHRFtmp = conv(PSY(:,j),hrf);
em_PSYHRF = em_PSYHRFtmp((k-1) + fMRI_T0);
% PSY may be already "mean adj" at this point ...
% em_nZ=find(abs(em_PSYHRF)>0);
em_Mzero=mode(em_PSYHRF); % return most freq value; assume that this corresponds to "0"
em_nZ=find(em_PSYHRF~=em_Mzero);
em_tmp(em_nZ)=detrend(ppit(em_nZ),0);
ppi(:,j)=em_tmp;
% ppi(:,j) = spm_detrend(ppit);
% **************************************

Note that this modification only works when P.ConcatR=0.
Sorry, what do you mean by DC shift?

Comments and suggestions appreciated!
Thanks,
Gina

Originally posted by Donald McLaren:
I would not be concerned about this happening. The PPI terms are mean-centered as part of the code. The higher the amplitude of the PPI regressors or the more events, the more the DC shift will be in the data. The DC term is offset by the constant term in the model.
Originally posted by Gina Joue:
Hiya,

Here is a sample SPM.mat for one subject and the commands:

xlvl = {'conCinsTrem0' 'conCinsTrem1' 'conCinsDrem0' 'conCinsDrem1' 'conIinsTrem0' 'conIinsTrem1' 'conIinsDrem0' 'conIinsDrem1'};

for i=1:length(xlvl)
xlvlPPI{i} = sprintf('PPI_%s',xlvl{i});
end

load('SPM.mat');

for c=1:length(xlvl)
   cinds = find(~cellfun(@isempty, regexp(SPM.xX.name,sprintf(' %s',xlvl{c})))); % need to add space or will also match PPI_
   pinds = find(~cellfun(@isempty, regexp(SPM.xX.name,xlvlPPI{c})));
   for i=1:length(cinds)
      figure(s*100+c*10+i)
      plot(SPM.xX.X(1:178,cinds(i)))
      hold on
      plot(SPM.xX.X(1:178,pinds(i)),'r')
      title(['sub' subj '\color{blue}' SPM.xX.name(cinds(i)) ' - ' '\color{red}' SPM.xX.name(pinds(i))])
   end
end

Thank you, Donald!!

Gina
May 27, 2016  03:05 PM | Donald McLaren
RE: data mean adjustment
The change is not appropriate. You have fundamentally changed the interaction term. The model may be more estimable, but I have no idea what the model measures when you center based only on the events. 

DC offset -- the mean amplitude displacement from zero.

DC shift -- the amount you need to shift the data to have a DC offset of 0.