question about SVC

67 views
Skip to first unread message

Julie Spicer

unread,
Dec 19, 2012, 10:33:55 AM12/19/12
to wagerl...@googlegroups.com
Hello all,

I am looking to run SVC on some of our data, and Tor mentioned that Wani developed scripts to do this for the toolbox.  Would you have any advice on what function(s) to run, and/or where to find notation on this?

Thanks so much.
Best,
Julie

______________
Julie Spicer, Ph.D.
NIH Postdoctoral Research Fellow
Division of Behavioral Medicine
Department of Psychiatry
Columbia University Medical Center
1150 St. Nicholas Avenue, Suite 1-121
New York, NY 10032
phone: 212-851-5573
fax:  212-851-5580

Yoni K. Ashar

unread,
Dec 19, 2012, 12:07:11 PM12/19/12
to Julie Spicer, wagerl...@googlegroups.com
Hi Julie,

this hackpad page might be a good starting point:  https://hackpad.com/x5dN2j6ll7Z#Penalized-regression

in our code, we're referring to SVC as SVM, btw (suppor vector classification, right?)

In that hackpad, there's one line where predict is called with 'cv_svr' as a parameter -- you can change that value to 'cv_svm'  to run cross-validated SVM.

Hope this is a helpful start

Y



--
 
 

Julie Spicer

unread,
Dec 19, 2012, 12:19:18 PM12/19/12
to Wani (ChoongWan) Woo, Yoni K. Ashar, wagerl...@googlegroups.com
Hi Wani and Yoni,

Thanks for your feedback.  Indeed, I am referring to small-volume correction.  Sorry for any confusion.

Wani, I'd really appreciate the example code.

Thanks again!
Julie


______________
Julie Spicer, Ph.D.
NIH Postdoctoral Research Fellow
Division of Behavioral Medicine
Department of Psychiatry
Columbia University Medical Center
1150 St. Nicholas Avenue, Suite 1-121
New York, NY 10032
phone: 212-851-5573
fax:  212-851-5580

On Dec 19, 2012, at 12:12 PM, Wani (ChoongWan) Woo wrote:

Hi Julie,

I have a feeling that SVC means small-volume correction... I did not develop the script, but Tor developed it, and I used it before. robust_reg_nonparam.m is working for that. If you're mentioning small-volume correction, I can send an example code. Could you clarify what you're mentioning?

Thanks,
Wani


--
 
 


Wani (ChoongWan) Woo

unread,
Dec 19, 2012, 5:31:33 PM12/19/12
to Julie Spicer, wagerl...@googlegroups.com
Hi Julie,

I'm sending some explanation with the example code. Here, an important thing is design matrix for the second level. This is what I have understood about second-level design matrix. However, there could be different opinions about how to model subject effects (this is an issue only when you're using more than 2 images in the second level). Hope this helps!

% To use the robust_reg_nonparam, you need a design matrix. If you are only interested in difference from zero (ttest),
% you only need one intercept vector - i.e., ones(subj_n,1)
.
% If you want to test effects of one condition vs. another condition (so 2 images per subject),
% you will need a vector 1s and -1s for images (contrast vector), a matrix for subject intercept (modeling the subject effect),
% and overall intercept (see the following image). This could be one way to model subject effects.
% You can add covariates as well.

Inline image 1
% Let's assume you have design matrix (X) here.

cd(modeldir);

imgs = [data_images{1}; data_images{2}]; % Data image you're interested in. Here I'm using 2 images per subject
savename = 'nparam_model';
x_names = {'interest', 'sub_intercept1','sub_intercept2',...}; % You can provide names of regressors in design matrix. If you don't want, you don't need to provide this.
mask = 'xxx.img'; % enter mask image name;

Result = robust_reg_nonparam(X, 10000, 'mask', mask, 'data', imgs, 'names', x_names ,'file',savename,'startover');
save Result Result;  % I think saving Result could be a good idea.

% Then, you could find results in Result.svc.
% If you find only one significant voxel within the mask, we could say the ROI is significant.
% and There is a visualization function to show cluster extent of mask and significant voxel within the mask, but I don't know the name.
% Actually, help file of robust_reg_nonparm could be more helpful. :)

Thanks,
Wani


On Wed, Dec 19, 2012 at 1:08 PM, Julie Spicer <jas...@columbia.edu> wrote:
Hi Wani,

Sure, sounds good. Good luck with your meeting!

Best,
Julie


Sent from my iPhone

On Dec 19, 2012, at 1:53 PM, "Wani (ChoongWan) Woo" <clinp...@gmail.com> wrote:

Hi Julie,

Could I send it to you later today? I'm having a master's proposal meeting soon :) I will send it to you after it.
image.jpeg

Wani (ChoongWan) Woo

unread,
Dec 19, 2012, 5:50:46 PM12/19/12
to Julie Spicer, wagerl...@googlegroups.com
Hi Julie,

I'm sending this again because there were some unclear sentences in the previous email. I'm somewhat conscious that this will be posted on the website. hmm.. pressure.. :) Okay, I'm sending a little bit of explanation along with a simple example code. Here, one important thing is to build a design matrix for the second level. The following example is what I've understood about the second-level design matrix. However, there could be different opinions about how to model subject effects (this is an issue only when you're using more than 2 images per subject in the second level). Hope this helps!

To use the robust_reg_nonparam, you need to provide a design matrix. If you are interested only in whether data are different from zero (i.e., simple t test), you only need one intercept vector - i.e., ones(subj_n,1). If you want to test effects of one condition vs. another condition (so 2 images per subject), you will need a vector of 1s and -1s for images (contrast vector), vectors that consists for subject intercepts (modeling the subject effect), and one intercept vector (see the following image). In addition to these, you can add covariates (which could be about individual differences).

Inline image 1
Let's assume you already build a design matrix (X) here.

cd(modeldir);
imgs = [data_images{1}; data_images{2}]; % Data image you're interested in. Here I'm using 2 images per subject
savename = 'nparam_model';
x_names = {'interest', 'sub_intercept1','sub_intercept2',...}; % You can provide names of regressors in design matrix. If you don't want, you don't need to provide this.
mask = 'xxx.img'; % enter mask image name;

Result = robust_reg_nonparam(X, 10000, 'mask', mask, 'data', imgs, 'names', x_names ,'file',savename,'startover');
save Result Result;  % Saving Result could be a good idea.

Then, you will be able to find results in Result.svc. If you find only one significant voxel within the mask, we could say the ROI is significant. There is a visualization function to show cluster extent of mask and significant voxel within the mask, but I don't know the name. Also, see help robust_reg_nonparm, which could be really helpful. :)

Thanks,
Wani


On Wed, Dec 19, 2012 at 3:31 PM, Wani (ChoongWan) Woo <clinp...@gmail.com> wrote:
Hi Julie,

I'm sending some explanation with an example code. Here, one important thing is the design matrix for the second level. The following example is what I have understood about the second-level design matrix. However, there could be other different opinions about how to model subject effects (this is an issue only when you're using more than 2 images per subject in the second level). Hope this helps!

% To use the robust_reg_nonparam, you need a design matrix. If you are only interested in whether data are different from zero (i.e., t test),
.
image.jpeg

Tor Wager

unread,
Dec 20, 2012, 11:05:29 AM12/20/12
to Wani (ChoongWan) Woo, Julie Spicer, wagerl...@googlegroups.com
Thank you, Wani!  When would you need to run a model with two+ images per subject?  It seems like for almost all applications, you can create within-subject contrast images and then enter those images (one per subject) into robust_reg_nonparam.  That's the way I've been recommending, so I've never run it with 2+ images per subject.

On Dec 19, 2012, at 3:50 PM, Wani (ChoongWan) Woo wrote:

Hi Julie,

I'm sending this again because there were some unclear sentences in the previous email. I'm somewhat conscious that this will be posted on the website. hmm.. pressure.. :) Okay, I'm sending a little bit of explanation along with a simple example code. Here, one important thing is to build a design matrix for the second level. The following example is what I've understood about the second-level design matrix. However, there could be different opinions about how to model subject effects (this is an issue only when you're using more than 2 images per subject in the second level). Hope this helps!

To use the robust_reg_nonparam, you need to provide a design matrix. If you are interested only in whether data are different from zero (i.e., simple t test), you only need one intercept vector - i.e., ones(subj_n,1). If you want to test effects of one condition vs. another condition (so 2 images per subject), you will need a vector of 1s and -1s for images (contrast vector), vectors that consists for subject intercepts (modeling the subject effect), and one intercept vector (see the following image). In addition to these, you can add covariates (which could be about individual differences).

<image.jpeg>
Let's assume you already build a design matrix (X) here.

cd(modeldir);
imgs = [data_images{1}; data_images{2}]; % Data image you're interested in. Here I'm using 2 images per subject
savename = 'nparam_model';
x_names = {'interest', 'sub_intercept1','sub_intercept2',...}; % You can provide names of regressors in design matrix. If you don't want, you don't need to provide this.
mask = 'xxx.img'; % enter mask image name;

Result = robust_reg_nonparam(X, 10000, 'mask', mask, 'data', imgs, 'names', x_names ,'file',savename,'startover');
save Result Result;  % Saving Result could be a good idea.

Then, you will be able to find results in Result.svc. If you find only one significant voxel within the mask, we could say the ROI is significant. There is a visualization function to show cluster extent of mask and significant voxel within the mask, but I don't know the name. Also, see help robust_reg_nonparm, which could be really helpful. :)

Thanks,
Wani
On Wed, Dec 19, 2012 at 3:31 PM, Wani (ChoongWan) Woo <clinp...@gmail.com> wrote:
Hi Julie,

I'm sending some explanation with an example code. Here, one important thing is the design matrix for the second level. The following example is what I have understood about the second-level design matrix. However, there could be other different opinions about how to model subject effects (this is an issue only when you're using more than 2 images per subject in the second level). Hope this helps!

% To use the robust_reg_nonparam, you need a design matrix. If you are only interested in whether data are different from zero (i.e., t test),
% you only need one intercept vector - i.e., ones(subj_n,1)
.
% If you want to test effects of one condition vs. another condition (so 2 images per subject),
% you will need a vector 1s and -1s for images (contrast vector), a matrix for subject intercept (modeling the subject effect),
% and overall intercept (see the following image). This could be one way to model subject effects.
% You can add covariates as well.

<image.jpeg>


--
 
 

Wani (ChoongWan) Woo

unread,
Dec 20, 2012, 12:27:28 PM12/20/12
to Tor Wager, Julie Spicer, wagerl...@googlegroups.com
Hi Tor,

Thanks for your comments. A while ago, I used 3 images per subjects to know the linear trend among three conditions. Yes, I think we can create contrast images first, then use it in the second-level analysis. Just out of curiosity, do you think the way I described is right to do as well? Or is it wrong? or worse than contrast method?

Thanks,
Wani

Tor Wager

unread,
Dec 20, 2012, 12:36:04 PM12/20/12
to Wani (ChoongWan) Woo, Julie Spicer, wagerl...@googlegroups.com
Hi Wani,

I think part of the repeated measures model involves modeling the effect of subject, but another part involves the statistical test and thus changes in how P-values are calculated.  You have to estimate the variance of the subject x condition interaction and use that as the error term when calculating F/T/P-values for the fixed effects (e.g., effects of condition).  This is part of what it means to model subject as a random effect.  So you can't simply use glmfit or another GLM procedure as-is.  That's why it's easier to create contrast images for within-subjects effects.

Tor

Wani (ChoongWan) Woo

unread,
Dec 20, 2012, 12:47:57 PM12/20/12
to Tor Wager, Julie Spicer, wagerl...@googlegroups.com
Thanks, Tor!

This is really helpful and good to know. Thanks!

Best,
Wani

Wani (ChoongWan) Woo

unread,
Dec 19, 2012, 12:12:23 PM12/19/12
to Yoni K. Ashar, Julie Spicer, wagerl...@googlegroups.com
Hi Julie,

I have a feeling that SVC means small-volume correction... I did not develop the script, but Tor developed it, and I used it before. robust_reg_nonparam.m is working for that. If you're mentioning small-volume correction, I can send an example code. Could you clarify what you're mentioning?

Thanks,
Wani
On Wed, Dec 19, 2012 at 10:07 AM, Yoni K. Ashar <yoni...@gmail.com> wrote:
--
 
 

jbeng...@gmail.com

unread,
Dec 16, 2016, 9:14:35 AM12/16/16
to WagerlabTools, torw...@gmail.com, jas...@columbia.edu
Dear Tor,

thanks for providing this wonderful tool.

I just wanted to report a potential error: in robust_nonpar_set_level_svc on line 24 it says "binomcdf". I think it needs to be changed to "binocdf" (sans the "m"). I am assuming that I am working with the most recent version, as I downloaded this today from github.

All best,
Jan

Wani (Choong-Wan) Woo

unread,
Dec 16, 2016, 7:17:19 PM12/16/16
to jbeng...@gmail.com, WagerlabTools, Tor Wager, Julie Spicer
Dear Jan, 

I think both functions should produce the same results. As far as I know, "binomcdf.m" is from our MKDA meta-analysis toolbox, and "binocdf.m" is from the matlab stat toolbox. I briefly tested and checked their outputs are exactly same. So I think both should work. 

Thanks,
Wani


--
You received this message because you are subscribed to the Google Groups "WagerlabTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wagerlabtools+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Choong-Wan (Wani) Woo, PhD
Web | Code | Google Scholar | Lab
Postdoctoral fellow/Research associate
Cognitive and Affective Neuroscience Lab
University of Colorado Boulder

Tor Wager

unread,
Dec 17, 2016, 10:08:41 AM12/17/16
to jbeng...@gmail.com, WagerlabTools, jas...@columbia.edu
Hi Jan,

Thanks! Binomcdf is an earlier function, and is in our toolbox /Users/tor/Documents/Code_Repositories/Canlab_MKDA_MetaAnalysis/studyplotUtility/chi2_tests/binomcdf.m

It’s likely that binocdf, now in the stats toolbox in Matlab, returns the identical results...it would be nice to verify this. Both are Mathworks functions. Updating to the new one is probably a good idea.

Cheers,
Tor
Reply all
Reply to author
Forward
0 new messages