partial correlation
8 views (last 30 days)
Show older comments
Hello,
I'd like to calculate the partial correlation between a set of time series of 100 time points each. I put the time series into a matrix, in which the rows correspond to the 100 Time Points and the columns to the number of observations. I tried to calculate it with the following script:
s = size(matrix,2);
X = eye(s);
for i = 1:s; for j = 1:s; d=setdiff(1:s,[i j]); [X(i,j), P(i,j)]=partialcorr(matrix(:,i),matrix(:,j),matrix(:,d));end;end;
Unfortunately it doesn't work and Matlab generates the following error message:
??? Error using ==> corr
Too many input arguments.
Error in ==> partialcorr at 204
coef = corr(resid(:,1:dx),resid(:,dx+1:dx+dy),'type','pearson');
I can't work out a solution on my own. Can anybody help? I would greatly apreciate it.
Cheers, Jessica
0 Comments
Answers (1)
Peter Perkins
on 16 Apr 2012
Most likely you have a function named corr on your path other than the one in the Statistics Toolbox. Type "which corr -all" to find and remove it.
0 Comments
See Also
Categories
Find more on Frequently-used Algorithms 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!