How can I get the P value of the two-tail Student's test when I know the T value and Degree of Freedom?

조회 수: 17 (최근 30일)
I have already known the T and Degree of Freedom. I try to calculate the P value with tpdf and tcdf. They output the different answers. I would like to konw which one is right. Thank you!
  댓글 수: 2
the cyclist
the cyclist 2023년 3월 10일
Can you share your parameters and the code that you used to calculate the P value? (You can use the paper clip icon in the INSERT section of the toolbar.)
I would expect you are going to need the cdf, not the pdf, to calculate the P value.
Murong Qi
Murong Qi 2023년 3월 10일
편집: Murong Qi 2023년 3월 10일
This is an example of my code:
%eg:t-value:10 ; Degree of freedom: 20
%[method 1]:tpdf
p1 = tpdf(10,20);
%[method 2]:tcdf
p2 = 2*tcdf(-abs(10),20);

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

채택된 답변

the cyclist
the cyclist 2023년 3월 10일
Sorry for the delayed response. I did not get a notification that you had replied.
Your second method is the correct one (assuming you want 2-tailed P value):
t = 10;
DOF = 20;
twoTailedPValue = 2*tcdf(-t,DOF)
twoTailedPValue = 3.1638e-09
I verified the P values at this site (using a smaller value of t, that site won't calculate such a small P value exactly).
I'm not sure why you think your first method would be correct. The pdf value is not directly relevant; you need the integral under the pdf (which is of course the cdf).

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by