Calculate Pvalue in T-Hypothesis

25 Views Asked by At

I have Test where i have found out T value −2.0083, Now i am to find a p value.

According to tables, this value is between $\alpha$ = 0.05 and $\alpha$ = 0.025.

However how can i calculate the exact $\alpha$ as P value? Is it possible or am i left with assunption or interval?

THanks for help!

2

There are 2 best solutions below

0
On

The CDF for the $t$ distribution with $\nu$ degrees of freedom is

$$P(T \leq x) = \frac{ \Gamma \left( \frac{\nu + 1}{2} \right) }{\sqrt{\nu \pi} \ \Gamma \left( \frac{\nu}{2} \right ) } \int_{-\infty} ^x \left( 1 + \frac{s^2}{\nu} \right)^ {-\left( \frac{\nu + 1}{2} \right)} \ ds $$

which, according to its Wikipedia page, is explicitly

$$\frac{1}{2} + x \ \Gamma \left( \frac{\nu + 1}{2} \right) \cdot \frac{ _2F_1 \left(\frac{1}{2}, \frac{\nu + 1}{2} ; \frac{3}{2} ; -\frac{x^2}{\nu} \right)}{ \sqrt{\nu \pi} \ \Gamma \left(\frac{\nu}{2} \right)} $$

where $_2F_1$ is the hypergeometric function.

This is why I said a numerical method is preferred. You can use a quadrature to approximate the integral, or just be smart and use one of the built-in functions that R, Excel, MATLAB, and the like provide. You'll have to read the documentation.

0
On

Suppose you are doing a left-sided test and your t statistic is $T = −2.0083.$ Also suppose you have $\nu = 15$ degrees of freedom.

Using printed tables. From row $\nu=15$ of a t table, you deduce that $-1.753$ cuts probability $0.05 = 5\%$ from the lower tail of Student's t distribution with 15 degrees of freedom, and that $-2.131$ cuts probability $0.025 = 2.5\%$ from its lower tail.

So, as you say in your question, the P-value must be bracketed by 0.025 and 0.05. From most printed t tables that is about all the information you can get about the P-value. (Linear interpolation is usually not sufficiently accurate to be useful.)

Using technology. P-values are 'creatures' of the computer age. Many statistical computer programs will compute the exact P-value corresponding to a particular computed value of $T.$ This requires numerical integration of the density function of the distribution $\mathsf{T}(\nu = 15)$ to get the CDF (formulas shown in @SeanRobertson's Answer).

Many statistical calculators and statistical computer programs have procedures for finding exact P-values. For example, in R statistical software the function pt with suitable arguments will do the job, giving the exact P-value $0.031 = 3.1\%,$ as shown below:

pt(-2.0083, 15)
[1] 0.0314845

In the figure below the vertical dotted red lines cut probabilities 0.025 and 0.05, respectively (left to right) from the lower tail of $\mathsf{T}(15).$ The solid vertical blue line is at $T = -2.0083;$ The area to the left of it is the P-value 0.0315.

enter image description here

Notes: (1) You didn't give the degrees of freedom for your test, so I guessed $\nu=15$ because it matched what you said. But other degrees of freedom would also match.

(2) For a right sided test, you need to cut the various probabilities from the upper tail of Student's t distribution with the appropriate degrees of freedom. For a two-sided test, you need to double the P-value that matches whether the t statistic is negative or positive.

(3) R is excellent software that can be installed free of charge on most operating systems; available at www.r-project.org. It may be useful to you if you use it just for topics you are studying at the moment. There is a lot of on-line help. But don't make the mistake of trying to learn 'all about R', because I don't know anyone who has done that.