Thank you for this information! I have one query. What is the meaning of mean time series in Y that you have mentioned? Is it time series after subtracting mean? Thanks & regards, Priya On Sat, Jan 9, 2016 at 1:20 AM, Guillaume Flandin <[log in to unmask]> wrote: > Dear Priya, > > just to add that if Y contains a mean fMRI time series and X is a matrix > of confounds then you can compute: > > % residual forming matrix: > R = eye(size(X,1)) - X*pinv(X); > % residuals: > r = R * Y; > > A related function in SPM would be spm_ancova.m. > > Best regards, > Guillaume. > > > On 08/01/16 03:48, Priya Aggarwal wrote: > > Thank you so much! this code is very useful...:) > > > > On Thu, Jan 7, 2016 at 9:40 PM, <[log in to unmask] > > <mailto:[log in to unmask]>> wrote: > > > > The stats toolbox has a regress function. The neural network toolbox > > has a function regression, which I think is not as good as you would > > need to extract residuals on your own. ____ > > > > __ __ > > > > I attached a function I wrote for this, which also removed a 3^rd > > order poly from the data. It needs CSF and WM masks in nii files, > > and was really specifically written for one data set of mine, but > > you are free to steal any code if it is helpful. I certainly won’t > > work out of the box on anything though, it was a one-study-use > > function. : )____ > > > > __ __ > > > > __ __ > > > > Colin Hawco, PhD____ > > > > Neuranalysis Consulting____ > > > > Neuroimaging analysis and consultation____ > > > > www.neuranalysis.com <http://www.neuranalysis.com>____ > > > > [log in to unmask] <mailto:[log in to unmask]>____ > > > > __ __ > > > > __ __ > > > > __ __ > > > > *From:*SPM (Statistical Parametric Mapping) > > [mailto:[log in to unmask] <mailto:[log in to unmask]>] *On Behalf > > Of *Priya Aggarwal > > *Sent:* January-07-16 12:59 AM > > *To:* [log in to unmask] <mailto:[log in to unmask]> > > *Subject:* Re: [SPM] linear regression of cofounds____ > > > > __ __ > > > > Thank you for this information!____ > > > > __ __ > > > > I would like to use matlab for removing cofounds. Is there any > > inbuild command for running regression in matlab.____ > > > > __ __ > > > > Thanks,____ > > > > Priya____ > > > > __ __ > > > > On Thu, Jan 7, 2016 at 12:41 AM, <[log in to unmask] > > <mailto:[log in to unmask]>> wrote:____ > > > > You have a few options. You can download an existing Matlab toolbox, > > such as the Conn toolbox, which has some of this functionality built > in. > > > > Personally I tend to code these things myself. You can grab the > > nifti toolbox for Matlab (off NITRICS), which will allow you to load > > your images as Matlab variables (I find it a bit easier to use than > > SPM's functions). > > > > Then loop through voxels, run regress in matlab on the time series, > > and save the residuals into a new data structure. > > > > If you want to do a really good job removing motion effects, I would > > suggest using the Pythagorean transform of the motion parameters > > (Damion Faire did some good work on this), of if you are more > > ambitious use a voxel-specific set of regressors as done by Ted > > Satterthwaite > > > > http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3811142/ > > > > Which really seems to make a difference in removing motion effects, > > especially for analysis between groups where motion may differ, a > > major confound in most analyses. > > > > Good luck! > > > > Colin Hawco, PhD > > Neuranalysis Consulting > > Neuroimaging analysis and consultation > > www.neuranalysis.com <http://www.neuranalysis.com> > > [log in to unmask] <mailto:[log in to unmask]>____ > > > > > > > > > > -----Original Message----- > > From: SPM (Statistical Parametric Mapping) > > [mailto:[log in to unmask] <mailto:[log in to unmask]>] On Behalf Of > > Priya Aggarwal > > Sent: January-06-16 12:18 PM > > To: [log in to unmask] <mailto:[log in to unmask]> > > Subject: [SPM] linear regression of cofounds > > > > Hi everyone, > > > > I want to regress out various cofounds (such as realignment > > parameters and its derivative, white matter signal etc.) from my > > regional mean fMRI time series. This linear regression is essential > > step in resting state fMRI functional connectivity analysis. > > > > Can anyone please help me how can i do it? > > > > Thank you for this help! > > > > regards, > > Priya____ > > > > > > > > ____ > > > > __ __ > > > > -- ____ > > > > Thanks and Warm Regards,____ > > > > __ __ > > > > Priya Aggarwal____ > > > > Indraprastha Institute of Information Technology, Delhi (IIIT-D)____ > > > > Okhla Industrial Estate,Phase III > > (Near Govind Puri Metro Station) > > New Delhi, India - 110020____ > > > > > > > > > > -- > > Thanks and Warm Regards, > > > > Priya Aggarwal > > Indraprastha Institute of Information Technology, Delhi (IIIT-D) > > Okhla Industrial Estate,Phase III > > (Near Govind Puri Metro Station) > > New Delhi, India - 110020 > > -- > Guillaume Flandin, PhD > Wellcome Trust Centre for Neuroimaging > University College London > 12 Queen Square > London WC1N 3BG > -- Thanks and Warm Regards, Priya Aggarwal Indraprastha Institute of Information Technology, Delhi (IIIT-D) Okhla Industrial Estate,Phase III (Near Govind Puri Metro Station) New Delhi, India - 110020