Learn practical skills, build real-world projects, and advance your career

Q) A manufacturer of printer cartridge clams that a certain cartridge
manufactured by him has a mean printing capacity of at least 500 pages.
A wholesale purchaser selects a sample of 100 printers and tests them.
The mean printing capacity of the sample came out to be 490 pages with a
standard deviation of 30 printing pages.

Should the purchaser reject the claim of the manufacturer at a
significance level of 5%?

Ans. population mean = 500

Sample mean = 490

Sample standard deviation = 30

Significance level(alpha) = 5% = 0.05

Sample size = 100

H0: Mean printing capacity >=500

H1: Mean printing capacity < 500

We can clearly see it is one tailed test (left tail).

Here, the sample is large with an unknown population variance. Since, we
don’t know about the normality of the data, we will use the Z-test (from
the table above).

We will use the sample variance to calculate the critical value.

Standard error (SE) = Sample standard deviation/ (sample size) * 0.5

= 30 / (100) *0.5 = 3

Z(test) = (Sample mean - population mean)/ (SE)

= (490-500)/3 = -3.33

Let’s find out the critical value at 5% significance level using the
above Critical value table.

Z (0.05%) = - 1.645 (since it is left tailed test).

We can clearly see that Z(test) < Z (0.05%), that means our test value
lies in the rejection region.

Thus, we can reject the null hypothesis i.e. the manufacturer’s claim at
5% significance level.

Using p-value to test the above hypothesis:

p-value = P[T<=-3.33] (we know p(-x) = 1 -p(x) also, remember that
the p(x) represents the

cumulative probability from 0 to x)

let’s use z-table to find the p-value:

p-value = 1 – 0.9996 = 0.0004

Here, p-value is less than the significance level of 5%. So, we are
right to reject the null hypothesis.

Q) A company used a specific brand of Tube lights in the past which
has an average life of 1000 hours. A new brand has approached the
company with new Tube lights with same power at a lower price. A sample
of 120 light bulbs were taken for testing which yielded an average of
1100 hours with standard deviation of 90 hours. Should the company give
the contract to this new company at a 1% significance level.

Also, find the confidence interval.

Ans. Population mean = 1000

Sample mean = 1010

Significance level = 1% = 0.01

Sample size = 120

Sample standard deviation = 90

H0: average life of tube lights >= 1000

H1: average life of tube lights < 1000

Here, the sample is large with an unknown population variance. Since, we
don’t know about the normality of the data, we will use the Z-test (from
the table above).

Standard error (SE) = Sample standard deviation/ (sample size) * 0.5

= 90 / (120) *0.5 = 8.22

Z(test) = (Sample mean - population mean)/ (SE)

= (1010-1000)/8.22 = 1.22

Let’s find out the critical value at 1% significance level using the
above Critical value table.

Z (0.01%) = -2.33(since it is left tailed test).

We can clearly see that Z(test) >Z (0.01%), that means our test value
doesn’t lie in the rejection region.

Thus, we cannot reject the null hypothesis i.e. the company can give the
contract at 1% significance level.

Using p-value to test the above hypothesis:

p-value = P[T<1.22]

p-value = 0.88

Here, p-value is greater than the significance level of 1%. So, we do
not reject the null hypothesis.

Comparing two population samples mean using Z test

Q) In two samples of men from two different states A and B , the
height of of 1000 men and 2000 men respectively are 76.5 and 77 inches.
If population standard deviation for both states is same and is 7
inches, can we assume that mean hieghts of both sates can be regarde
same at 5% level of significance.

Ans. n1 = 1000

n2 = 2000

X1(mean) = 76.5

X2(mean) = 77

S1=S2= 7

Let’s µ(1) = µ(2) be the mean heights of men from states A and B

H0: µ(1) = µ(2)

H1: µ(1) is not equal to µ(2)

Standard error(SE) = [((S1)^2/n1 )+((S2)^2/n2)]^0.5 = 0.27

Z(test) = X1(mean)- X2(mean)/ (SE) = (76.5-77)/0.27 = -1.85

Since, it is a two tailed test, we need to find critical value for 2.5%
on each tail.

Z(2.5%) = 1.96 and Z(-2.5%) = -1.96

We can clearly see, Z(-2.5%) < Z(test) <Z(2.5%)

Thus, we cannot reject the null hypothesis.

Using p-value

p-value = 2* P[Z>=|-1.85|] = 2 * P[Z>=-1.85]

p-value = 2 * (1- 0.9678) (since we want z> 1.85) = 0.0644

We can clearly see, p-value is greater than 0.05% ,thus we cannot reject
the null hypothesis.

Hypothesis Testing for Small Size Samples

In real world scenarios, large sample sizes are possible most of times
because of the limited resources such as money. We generally do
hypothesis testing based on small samples, only assumption being the
normality of the sample data.

We will see how to use t- tests in this section and how to use the
t-score table (continued from the topic of student t’s distribution).

All the steps involved are similar to the z-test, only we will calculate
t-score instead of z-score.

Let’s start with an example:

Q) A tyre manufacturer claims that the average life of a particular
category of its tyre is 18000km when used under normal driving
conditions. A random sample of 16 tyres was tested. The mean and SD of
life of the tyres in the sample were 20000 km and 6000 km
respectively.

Assuming that the life of the tyres is normally distributed, test the
claim of the manufacture at 1% level of significance.

Construct the confidence interval also.

Ans: population mean = 18000 km

Sample mean = 20000 km

Standard deviation = 6000 km

Sample size = 16

H0: population mean = 18000km

H1: population mean is not equal to 18000km (It will be a two tailed
test.)

Since sample size is small, population variance is unknown and the
sample is normally distributed, we will used t-test for this.

Standard error = [6000/(16)^0.5] = 1500

t-score(test) = (20000 - 18000)/1500 = 1.33

Let’s find out the critical t- value, for significance level 1% (two
tailed) and degree of freedom = 16-1 = 15

t(0.005) = 2.947 and t(-0.005) = -2.947

We can see that, t (- 0.005) < t-score(test) = 1.33 < t (0.005)

So, the value lies in non-rejection region and we cannot reject our null
hypothesis.

Using the p-value

p-value = P[t>|1.33|]

degree of freedom = 15

let’s see the p-value from the table for the above values:

from the table we can see: 0.20 < p < 0.30

Here, p > significance level (1%), thus we cannot reject the null
hypothesis.

Confidence interval = [20000 – 2.47*1500 , 20000 +2.47*1500]

= [ 16295, 23705]

Comparing two population samples mean using t test

Just like the case we saw with z-test, t-test is actually more suitable
for comparison of two populations samples because in practice population
standard deviations for both populations are not always known.

We assume a normal distribution of samples and though the population
standard deviations are unknown, we assume them to be equal.

Also, samples are independent to each other.

Let’s assume two independent samples with size n1 and n2:

Degree of freedom = n1 + n2 -2

Standard Error(SE):

Variance(Sample) = (∑[X-X(mean)]^2 + ∑[Y-Y(mean)]^2))/(n1 + n2
-2)

Test statistic t in this case is given as:

Q) The means of two random samples of sizes 10 and 8 from two normal
popultaion is 210.40 and 208.92. The sum of sqaures od deviation from
their means is 26.94 and 24.50 respectively.Assuming population with
equal variances, can we consider the normal populatiojns have equal
mean?(Significance level =5%)

Ans.

n1 =10 , n2= 8 , X(mean) = 210.40 , Y(mean) = 208.92

std. Deviation(sample) =[ (26.94 + 24.50)/(10 + 8 - 2)]^0.5 = 1.79

H0: Population means are equal

H1: Population means are not equal (two tailed test)

Standard errror = 1.79 * (1/10 + 1/8)^0.5 = 0.84

t(test) = X(mean)- Y(mean)/0.84 = 1.48/.84 = 1.76

Degree of freedom = 10 +8 -2 = 16

Let’s look for critical value in the t-table for significance 5%(two
tailed) and d.o.f 16:

t(0.005) = 2.120 and t(-0.005) = -2.120

We can see that, t (- 0.005) < t-score(test) = 1.76 < t (0.005)

So, the value lies in non-rejection region and we cannot reject our null
hypothesis.

Paired Sample t-Tests

A paired t-test is used to compare two population means where you have
two samples which are not independent e.g. Observations recorded on a
patient before and after taking medicine, weight of a person before and
after they started working out etc.

Now, instead of two separate populations, we create a new column with
difference of the populations, and instead of testing equality of two
population mean we test the hypothesis that mean of the population
difference is zero. Also, we assume the samples are of same size.
Population variances are not known and not necessarily equal.

Standard error = Deviation of differences/(n^0.5)

t= D(mean)/ standard error, where D(mean) is the men of the differences.

Q) A group 20 students were tested to see how many of them have
improved marks after a special lecture on the subject.

marks before the lecturemarks after the lectureDifference(D)(D-mean)^2
182243.24
212543.24
161711.44
222420.04
1915-438.44
242620.04
172030.64
212320.04
131857.84
182020.04
151504.84
1615-110.24
182130.64
141620.04
192230.64
202443.24
1218614.44
222530.64
141843.24
1918-110.24
44103.2
Difference mean = 2.25.43157895
Standard Deviation2.33057481

H0: Difference mean >= 0

H1: Difference mean < 0

Standard error = 2.33 /(20)^0.5 = 0.52

t= 2.2 / 0.52 = 4.23

D.o.f = 19

On significance level 5%. 19 d.o.f and a one tail test, let’s calculate
our critical level:

t(5%) = -1.729

Since, t is greater than critical t, thus it lies in non-rejection
region and hence we cannot reject the null hypothesis.

 

Q) The variance of a certain size of towel produced by a machine is 7.2
over a long period of time. A random sample of 20 towels gave a variance
of 8. You nee to check if the variability for towel has increased at 5%
level of significance, assuming a normally distributed sample.

Ans.

n = 20

sample variance = 8

population variance = 7.2

H0: variance <= 7.2

H1: variance > 7.2 (Right tailed test)

Using chi squared test,

ϗ-square = (20-1) * 8/7.2 = 21.11

Critical value for D.o.f = 19 and 5% significance level,

Critical value = 30.14 (using chi-table)

Here, chi value is less than the critical value, thus we do not reject
the null hypothesis.

 

Q) A survey conducted by a Pet Food Company determined that 60% of dog
owners have only one dog, 28% have two dogs, and 12% have three or more.
You were not convinced by the survey and decided to conduct your own
survey and have collected the data below,

Data: Out of 129 dog owners, 73 had one dog and 38 had two dogs

Determine whether your data supports the results of the survey by the
pet.

Use a significance level of 0.05

Ans: E(1 dog) =0.60

E(2 dog) = 0.28

E(3 dogs) = .12

H0: proportions of dogs is equal to survey data

H1: proportions of dogs is not equal to survey data

 1 Dog2 Dog3 DogTotal
Observed733818129
Expected0.60*129 = 77.40.28 *129=36.120.12 * 129 = 15.48129
Observed -Expected-4.41.882.52
(Observed -Expected) ^219.363.536.35

Chi statistics = 19.36/77.4 + 3.53/36.12 + 2.52/15.48 = 0.7533

Let’s see the critical value using d.o.f 2 and significance 5%:

Critical chi = 5.99

Here, our chi statistic is less than the critical chi. Thus, we will not
reject the null hypothesis.