# Difference between revisions of "Eleisha's Segment 12: P-Value Tests"

To Calculate:

1. What is the critical region for a 5% two-sided test if, under the null hypothesis, the test statistic is distributed as $\displaystyle \text{Student}(0,\sigma,4)$ ? That is, what values of the test statistic disprove the null hypothesis with p < 0.05? (OK to use Python, MATLAB, or Mathematica.)

Let t = the value of the test statistic If the test statistic is distributed as $\displaystyle \text{Student}(0,\sigma,4)$ , then for a two sided test the critical region is when $\displaystyle |t| \approx 2.7765 \sigma$ . This can calculated by taking the inverse of the CDF of the probability distribution and and evaluating it at (1 - 0.05/2).

2. For an exponentially distributed test statistic with mean $\displaystyle \mu$ (under the null hypothesis), when is the the null hypothesis disproved with p < 0.01 for a one-sided test? for a two-sided test?

Let t = the value of the test statistic

The pdf for an exponentially distributed test statistic with parameter $\displaystyle \lambda$ is:

$\displaystyle p(x) = \lambda e^{- \lambda x}$

Since the mean of p(x) is $\displaystyle \frac{1}{\lambda}$ , we take $\displaystyle \lambda = \frac{1}{\mu}$

We can solve for the critical region in a similar manner to question one by determining the inverse of the CDF of p(x) and evaluating it a (1 - 0.01) for a one sided test and (1 - 0.01/2).

For a one- sided test the null hypothesis is disproved with p< 0.01 when $\displaystyle t> 4.60517 \mu$ .

For a two - sided test the null hypothesis is disproved with p< 0.01 when $\displaystyle |t|> 5.29832 \mu$ .

Below is the mathematica code that I used to solve for the critical regions: