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

5 ビュー (過去 30 日間)
Rahul Verma
Rahul Verma 2023 年 5 月 6 日
回答済み: Prasanna 2024 年 10 月 6 日
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?

回答 (1 件)

Prasanna
Prasanna 2024 年 10 月 6 日
Hi Rahul,
To check whether the partial correlations are significant at the 5% significance level, you can compare each p-value in your 3-D matrix to the significance level (0.05). If a p-value is less than 0.05, the corresponding partial correlation is considered significant.
For the same, in the code you have included, you can iterate through the 3D matrix of p-values and print each partial correlation to check if it is significant or not. A sample code to perform the same is given below assuming the ‘alldata’ variable refers to the table present in the ‘Dataset.xlsx’ file:
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);
% Check if the p-value is less than 0.05
if pval(i, j, k) < 0.05
fprintf('Partial correlation between variables %d, %d, and %d is significant (p = %.4f)\n', i, j, k, pval(i, j, k));
else
fprintf('Partial correlation between variables %d, %d, and %d is not significant (p = %.4f)\n', i, j, k, pval(i, j, k));
end
end
end
end
For more information regarding ‘partialcorri’, you can refer the following documentation: https://www.mathworks.com/help/releases/r2023a/stats/partialcorri.html
Hope this helps!

カテゴリ

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