pearson and Spearman correlation and the corresponding 95% and 99% confidence level in Matlab

조회 수: 8 (최근 30일)
Hey Matlab users, i have copied a question asked in mathworks. i understand the answer of this question but i want how to find the corresponding 95% and 99% confidence level for both the pearson and spearman correlation coefficient. if I have two series of data:
a = [1 4 6 3 4 6 7 8]; b [34 56 34 56 79 23 48 28]; Then i can find the spearman and pearson correlation coefficient respectively as:
[RHO,PVAL] = corr(a',b','Type','Spearman'); for pearson, i can use r=corr2(a,b) or [R] = corr(a',b','Type','pearson') what will be the confidence leve(95% and 99%).i need result like in the given figure.the correlation result in fig is not related to the values of 'a' and 'b'.
Thanks for your help.

채택된 답변

Von Duesenberg
Von Duesenberg 2017년 2월 11일
Use de corrcoef function. In your case, it would be:
[R,P,RLO,RUP]= corrcoef(a, b, 'alpha', 0.05)
Where RLO and RUP give you the lower and upper limit of the confidence interval at the 95% level.
  댓글 수: 2
abdur rauf
abdur rauf 2017년 2월 11일
thanks for your reply, but i want to get single value for the confidence level like in the figure. 95% confidence level=0.34. i am not sure, which bound is taken here for the 95% confidence level.
abdur rauf
abdur rauf 2017년 2월 11일
Also, the function[R,P,RLO,RUP]= corrcoef(a, b, 'alpha', 0.05) is used for pearson correlation coefficient, how to find the upper and lower bound for spearman correlation coefficient. thanks

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mehri Mehrnia
Mehri Mehrnia 2023년 5월 21일
Is "corrcoef" for Spearman correlation?

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by