In earlier blogs we discussed about two sample z test,t test with equal and unequal variance.

Today we will talk about two sample paired t test and two sample p test.

**Paired t Test:**

- Two samples in which observations in one sample can be paired with observations in other sample.
- The samples are dependent, means values in one sample affect the other sample.
- Example:
*Blood sample before and after some medication.*

Below is the formula to calulate the paired t test:

Where d1, d2, d3..dn are difference of two sample and find the mean and standard deviation of these differences.

Let’s solve one problem to get clear understanding of paired t test:

**Problem: **BP is measured for few patients before and after some medication. Are there any difference at 95% confidence level?

Patient Name | Before Medication | After Medication |

John | 115 | 116 |

Harry | 110 | 108 |

Jason | 145 | 140 |

Bob | 130 | 128 |

Andrew | 140 | 140 |

**Solution:**

Null Hypothesis: Mean of sample before medication = Mean of sample after medication

Alternate Hypothesis: Mean of sample before medication not equal to the mean of sample after medication.

Patient Name | Before Medication | After Medication | differences |

John | 115 | 116 | -1 |

Harry | 110 | 108 | 2 |

Jason | 145 | 140 | 5 |

Bob | 130 | 128 | 2 |

Andrew | 140 | 140 | 0 |

d-bar= mean of differences=1.6

standard deviation(s)=2.3

n=5

Put all the values in paired t Test formula

t calculated=1.6

t critical=2.766

t calculated < t critical meaning **failed to reject the null hypothesis.**

There is no significant difference in BP after specific medication.

**Two sample p Test: **Here we calculate the proportion and find the z statistics. If z calculated is gerater than z critical value, can reject the null hypothesis otherwise failed to reject the null hypothesis.

Let’s try to understand the concept solving one of the practical problem.

**Problem: **In a factory, we picked 100 samples that are produced by machine A in which 10 are defective. We also picked other 200 samples that are produced by machine B in which 30 are defective. Is there any significant difference between two machines at 95% confidence level?

**Solution : **

Machine A | Machine B | Pooled | |

Total Items | 100 | 200 | 300 |

Defectives | 10 | 30 | 40 |

Percentage defective | 0.1 | 0.15 | 0.13 |

p1-bar=0.1

p2-bar=0.15

p-bar=0.13

n1=100

n2=200

When we keep these values in the pooled formula mentioned above :

**z calculated=1.2 **

z critical for 95% confidence level =1.96

z calculated < z critical

It means that we failed to reject the null hypothesis.

we can say that there is no significant difference between machine A and machine B.

## 0 Comments