# Statistical test to check whether an item meets the specification

I have a data on emission of an automobile which a company manufactures. The emission test was conducted on roads near towns and villages and the data is as follows.

According to a new rule passed by the govt., all automobiles emission should be below 550. Does the vehicle manufactured by the company meet the specification? If not, where is it being breached?

Can I do this using a t-test, using group average as population mean and checking for how many standard deviations is 550 from this mean? How do I approach the other problem?

town = c(520, 520, 525, 487.5, 480, 475, 480)
vill = c(555, 547.5, 530, 550, 555, 600, 530,
610, 600, 580, 600, 580)

boxplot(town, vill, names=c("Town", "Village"),
horizontal=T, col="skyblue2")
stripchart(town, at=1, add=T, meth="stack", pch=19, col="red")
stripchart(vill, at=2, add=T, meth="stack", pch=19, col="red")


According to the Welch two-sample t test (not assuming equal variances) there a highly significant difference between Town and Village emissions: P-value nearly 0.

t.test(town, vill)

Welch Two Sample t-test

data:  town and vill
t = -6.057, df = 15.367, p-value = 1.979e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-96.71324 -46.44152
sample estimates:
mean of x mean of y
498.2143  569.7917


This should be no surprise. The boxplot (with individual data values as red dots) shows that there is a complete separation in the scores; the largest Town value is below the smallest Village value.

If we use all 19 values (Town and Village taken together, sample mean 543.42) to test $$H_0: \mu \le 550$$ against $$H_a: \mu > 550,$$ then a t test (obviously) will not reject $$H_0.$$

all = c(town, vill)
t.test(all, mu=550, alte="gr")

One Sample t-test

data:  all
t = -0.65323, df = 18, p-value = 0.7391
alternative hypothesis: true mean is greater than 550
95 percent confidence interval:
525.9566      Inf
sample estimates:
mean of x
543.4211


However, if we test the same hypothesis, using only the (higher-emission) Village data, then $$H_0$$ is rejected at the 5% level, but not at the 1% level---with P-value 0.018.

t.test(vill, mu=550, alte="gr")

One Sample t-test

data:  vill
t = 2.3895, df = 11, p-value = 0.01795
alternative hypothesis: true mean is greater than 550
95 percent confidence interval:
554.9168      Inf
sample estimates:
mean of x
569.7917


If the rules of the 'emission violation' game are to use all 19 observations without further investigation, then we can't claim that the cars are 'dirty.' However, the manufacturer would be well advised to expect that violations will likely be found in more-localized studies.