How can I perform a semipartial correlation with two covariates?
25 views (last 30 days)
Show older comments
Georgette Argiris
on 26 Mar 2019
Commented: Georgette Argiris
on 27 Mar 2019
Hello, I have fMRI functional connectivity data on which I want to test the correlation between two variables (task1 and task2 connectivity values across subjects) while controlling for the amount of 'cleaning' that was performed on the data (I have a different percentage of cleaning for task1 than for task2). I therefore thought that the correct way to control for this would be to do a semipartial correlation where I hold task1 cleaning (covariate 1) constant on the task1 connectivity values only and then task2 cleaning (covariate 2) constant on the task2 connectivity values. Can I ask how to go about performing this in matlab? Essentially it would be a semipartial correlation with two covariates but differentially holding them constant for each variable. Thank you.
0 Comments
Accepted Answer
Jeff Miller
on 26 Mar 2019
Not sure if this is what you want, but maybe:
[b1,bint1,resid1] = regress(task1,covar1);
[b2,bint2,resid2] = regress(task2,covar2);
finalans = corr(resid1,resid2);
The idea is that resid1 and resid2 are the parts of task1 and task2 scores left over after you control for the covariates, and you want to see (as I understand it) whether these left-over parts are correlated.
More Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!