Last updated: 22:50:43 IST, 05 September, 2023

Decision Scenario

There are two machines (A & B) available in your factory to manufacture nuts. There is an order from an important customer who expects less variation in the dimensions of nuts delivered.

The following data is available about the two machines.

The mean and standard deviation of 50 nuts in machine A are: 50 mm and 5 mm The mean and standard deviation of 50 nuts in machine B are: 20 mm and 2.5 mm

Which machine would you recommend to be used?

Solution Approach

Compute the Coefficient of Variation (CV) for each machine and then choose the machine which has lower CV.

CV_A <- 5/50
CV_A
## [1] 0.1
CV_B <- 2.5/20
CV_B
## [1] 0.125

Generate datasets as per given mean and sd.

Compare the variances of the two samples using var.test().

Observe the results.

data_A <- rnorm(100,mean=50,sd=5)
data_B <- rnorm(100,mean=20,sd=2.5)
summary(data_A)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   38.10   46.88   50.05   50.21   53.20   63.99
summary(data_B)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   14.24   17.78   19.77   19.48   20.84   24.70
var(data_A)/var(data_B)
## [1] 4.735639
res.ftest <- var.test(data_A, data_B,alternate = "two.sided")
res.ftest
## 
##  F test to compare two variances
## 
## data:  data_A and data_B
## F = 4.7356, num df = 99, denom df = 99, p-value = 1.648e-13
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  3.186335 7.038267
## sample estimates:
## ratio of variances 
##           4.735639