# P Value Calculator

### Calculate P value using Z score

**P Value calculator is a simple and easy to use tool which helps in calculating the P value using the Z score calculated by using the statistical measures of the sample.**

## What is P Value Calculator?

The sample mean, the hypothesised mean, the sample size and the standard deviation of the sample are the metrics used to calculate the Z score and based on this value the P value is calculated using the Z table.

This P value is then used to make a decision of either rejecting the null hypothesis or fail to reject the null hypothesis by comparing the P value to the Significance level or Alpha value.

The calculator will display the P value for One Tailed test as well as for Two Tailed Test. Along with the P-value it also displays the Z score.

The calculator also displays the decision for an alpha value or significance level of 5%. The decision is displayed for both One Tailed Test and Two Tailed Test as well.

**The formula for calculating the P-value is as follows:**

## P Value Formula

Zc = (X - U) / (Sigma/ Sqrt(n))

Where,

X is the Sample Mean,

U is the Hypothesised Mean,

Sigma is the Standard Deviation of the Sample,

and N is the Sample Size.

This is the Z score value calculated.

Now, this Z score is looked up on the Z table to find the corresponding cumulative probability till that point.

Further, if it was a two tailed test then this value is multiplied by 2 to get the final P value.

**To make the decision, we need to compare the Alpha or Significance level with the P value.**

## How to make the final decision of the Hypothesis Test?

If the P-value is less than the significance level, then the Null Hypothesis is rejected.

Otherwise, we fail to reject the Null Hypothesis if the P-value is greater than the significance level.

**The higher the p-value, the higher is the probability of failing to reject a null hypothesis.**

## Conceptual Understanding of the P-value

And the lower the p-value, the higher is the probability of the null hypothesis being rejected.

As you can observe from the image below, the higher the P-value the more close to the center of the graph we would be and hence more close to our claim in Null hypothesis and thus less chance of rejecting it.

On the other hand, lower the P-value the higher the chances of rejecting the null hypothesis since we would be more close to the ends of the graph.

## Examples and Use Cases

### Example 1 - Two Tailed Test

Let's say your comapny has a manufacturing plant and manufactures tablets (the medicine and not the gadget, mind you).Every day the plant manufactures one million tablets and thus within one month 30 million tablets are manufactured.

There is a chemical called Y in the tablet.

The government has made a regulatory norm that the chemical Y should not be more than 8 mg in the tablets since it could have adverse effects on the patients.

Your company claims that the average level of chemical Y in the batch of 30 million tablets (that were produced last month) is 7 mg.

Since you are the analyst in the company, the company has asked you to analyse this claim using the P value method of Hypothesis testing.

Taking a significance level of 5%.

Thus, you take a sample of 729 tablets and find the following statistical measures:

Mean chemical Y in the sample of 729 tablets: 7.5 mg

Standard Deviation of the sample taken: 1.2

Using the P value method you need to make the decision on the claim made by the company and if any regulatory alarm should be raised or not.

The steps to be taken would be as follows:

First, you would have to decide wether it is a one tailed test or two tailed test.

Here it is a Two tailed Test.

Second, formulate your null and alternate hypothesis.

Here, Null Hypothesis is Ho = 7mg and Alternate Hypothesis is H1 != 7mg.

Third, Using the formula of P value method (as mentioned above), calculate the Zc value.

Fourth, look up the Z table to find the corresponding P value for the calculated Zc value and multiply this P value with 2 since it is a Two tailed test.

Lastly, you can compare the P value with the significance level to make your decision. (as explained earlier).

### Example 2 - One Tailed Test

Let's say the company now changes it's claim and says that the average level of chemical Y in the batch of 30 million tablets (that were produced last month) is LESS THAN 7 mg.

Now, how will your calculations change?!

What will be the Null and Alternate Hypothesis here?

Think about it before scrolling further and reading the answer.

So,

The Null Hypothesis here would be

Ho >= 7mg and Alternate Hypothesis would be H1 < 7mg.

If you got this incorrect, then read through the post on Null and alternate Hypothesis again on how to choose the correct Null Hypothesis.

All the other steps would remain the same.

You would find the Zc value using the P-value formula mentioned earlier.

Then use the Z table to find the corresponding P value.

Note - We do not multiply with 2 here since this is a one tailed test.

Lastly, you compare the P value with the Significance level and if P-value is less than the significance level you reject the null hypothesis.

Otherwise, if P-value is greater than the significance level then you fail to reject the null hypothesis.

### Important Note:

One important point to note is that if the Zc comes out as positive, ie (X-U) is positive,Meaning, the sample mean lies on the right hande side of the hypothesised mean on the normal distribution graph,

then, after you look up the Z table to find the cumulative probability, you need to subtract it by 1 in order to get the P-value.

For example,

If the Zc comes out as +1.23 we would look up the Z table to find the Cumulative probability.

Cumulative probability comes out as 89% or 0.89.

Then our P value would be 1 - 0.89 = 0.11

Now, if it is a two tailed test we multiply it with two otherwise keep it as it is for a single tailed test.

### Use of the calculator

To make calculations easy and less error prone, this P value calculator tool could be used for making decisions on the Hypothesis.The decision for Single and Double, both tailed test would be directly displayed for a signifacne value of 5%.

Hence, this tool could be used by statisticians and analysts to perform Hypothesis testing or more specifically the P value method of Hypothesis testing smoothly.

Thank You!

For Left Ads

© Copyright www.hstatistics.com