help
help > RE: data mean adjustment
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:
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:
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
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
Threaded View
Title | Author | Date |
---|---|---|
Gina Joue | May 9, 2016 | |
Donald McLaren | May 10, 2016 | |
Gina Joue | May 10, 2016 | |
Donald McLaren | May 11, 2016 | |
Gina Joue | May 27, 2016 | |
Donald McLaren | May 27, 2016 | |