How to check whether partial correlation is significant or not at 5% significance level?

조회 수: 3 (최근 30일)
I have to check check whether partial correlation is significant or not at 5% significance level. I have calculated the partial correlation by using the predefined command in Matlab "partialcorri''. Which gave me R values and P values. I have attached my code below:
Kindly suggest me whethe it is right or not??
alldata=xlsread('Dataset',1,'A2:H68');
datainput1=alldata(:,1);
for j=2:8
datainput2=alldata(:,j);
[rho(j),pval(j)] = partialcorri(datainput1,datainput2);
lprctl(j)=prctile(pval(:,j),2.5);
uprctl(j)=prctile(pval(:,j),97.5);
if (pval(j)<lprctl(j) || pval(j)>uprctl(j))
fprintf('input %d is significant\n',j)
else
fprintf('input %d is not significant\n',j)
end
end
I want to check the significant partial correlation of Data 1 (which is the 1st column in the Dataset) with other Data at 5% significance level.

답변 (2개)

MarKf
MarKf 2023년 5월 2일
편집: MarKf 2023년 5월 2일
A partial correlation means you are controlling or "partialing out" some variance that is explained by -usually- another (3rd) variable or a series of factors. The function partialcorri does take only 2 inputs, but then there should be some addtional variables (as columns I'm guessing) in x, for which the function is controlling for. So, since with your code both x and y have one column and the same n of values (67), then you are doing a simple correlation ([rho(j),pval(j)]=corr(datainput1,datainput2); would give the same results; btw y is datainput1).
After that there is no need to take a percentile of pval, that's already significant if <0.05 (by convention). So the above (normal, non partial) correlations are all significant, tho some much more. You may want to control for multiple comparisons (7 above) so maybe (conservatively) accept only pval<(0.05/7). Maybe you meant to include more variables to your partial correlation, something like this:
alldata = xlsread(websave('rd', "https://nl.mathworks.com/matlabcentral/answers/uploaded_files/1372129/Dataset.xlsx"),1,'A2:H68');
datainput1=alldata(:,1);
datainput2=alldata(:,2:5);
[rho,pval] = partialcorri(datainput1,datainput2);
pval = 1×4
0.0000 0.0770 0.8403 0.5945
log10(pval)
ans = 1×4
-12.1243 -1.1137 -0.0756 -0.2258
Which means the correlation between column 2 (x) and column 1 (y) after controlling for the effects of columns 3 to 5 has pval<10e-12.
% for j=2:8
% datainput2=alldata(:,j);
% [rho(j),pval(j)] = partialcorri(datainput1,datainput2);
% end

Rahul Verma
Rahul Verma 2023년 5월 4일
I tried this approach:
for i=1:6
datainput1=alldata(:,i);
for j=i+1:7
datainput2=alldata(:,j);
for k=i+2:8
datainput3=alldata(:,k);
[rho(i,j,k),pval(i,j,k)] = partialcorri(datainput1,datainput2,datainput3);
end
end
end
But this gave me a 3-D matrix of P values.
No how can I check for significant or not?

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by