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

1 回表示 (過去 30 日間)
Rahul Verma
Rahul Verma 2023 年 5 月 2 日
回答済み: Rahul Verma 2023 年 5 月 4 日
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 Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by