Last updated: 07:42:32 IST, 24 August, 2023

library(BSDA,warn.conflicts=F, quietly=T)

Decision Scenario 1 (Involves One-sample, One-sided (right-tailed) Z-Test)

In a factory the bulb production process is mature and has achieved a mean lifetime of 1500 hours with a standard deviation of 20 hours. R & D team has proposed a process improvement.

The quality control team is to check and assess if the proposed process change increases the lifetime of bulbs by measuring the lifetime of 200 bulbs.

Solution Approach

# Create a bulb data sample of size 200, 
#   from a population with a mean of 1501 and a standard deviation of 20 hours
bulbdata1 <- rnorm(200,mean=1501,sd=20)
# View the summary of the data sample 
summary(bulbdata1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1445    1486    1501    1501    1515    1554
sd(bulbdata1)
## [1] 19.85402
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata1, alternative ="greater",mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata1
## z = 0.35868, p-value = 0.3599
## alternative hypothesis: true mean is greater than 1500
## 95 percent confidence interval:
##  1498.181       NA
## sample estimates:
## mean of x 
##  1500.507
# Create a bulb data sample of size 200, 
#   from a population with a mean of 1510 and a standard deviation of 20 hours
bulbdata2 <- rnorm(200,mean=1510,sd=20)
# View the summary of the data sample 
summary(bulbdata2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1469    1497    1510    1511    1525    1575
sd(bulbdata2)
## [1] 19.51987
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata2, alternative = 'greater',mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata2
## z = 7.8378, p-value = 2.331e-15
## alternative hypothesis: true mean is greater than 1500
## 95 percent confidence interval:
##  1508.758       NA
## sample estimates:
## mean of x 
##  1511.084
# Create a bulb data sample of size 200, 
#   from a population with a mean of 1520 and a standard deviation of 20 hours
bulbdata3 <- rnorm(200,mean=1520,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1457    1507    1519    1520    1534    1589
sd(bulbdata3)
## [1] 19.82026
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata3, alternative = 'greater', mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata3
## z = 14.37, p-value < 2.2e-16
## alternative hypothesis: true mean is greater than 1500
## 95 percent confidence interval:
##  1517.996       NA
## sample estimates:
## mean of x 
##  1520.322

Decision Scenario 2 (Involves One-sample, One-sided (left-tailed) Z-Test)

In a factory the bulb production process is mature and has achieved a mean lifetime of 1500 hours with a standard deviation of 20 hours. There has been a feedback from several industrial customers that the lifetime of the bulbs has reduced below 1500 hours.

The quality control team is to check and assess if the lifetime of bulbs manufactured in the factory has reduced using the lifetime data of 200 bulbs.

Solution Approach

# Create a bulb data sample of size 200, 
#   from a population with a mean of 1499 and a standard deviation of 20 hours
bulbdata1 <- rnorm(200,mean=1499,sd=20)
# View the summary of the data sample 
summary(bulbdata1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1432    1486    1498    1498    1512    1546
sd(bulbdata1)
## [1] 20.8393
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata1, alternative ='less',mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata1
## z = -1.217, p-value = 0.1118
## alternative hypothesis: true mean is less than 1500
## 95 percent confidence interval:
##        NA 1500.605
## sample estimates:
## mean of x 
##  1498.279
# Create a bulb data sample of size 200, 
#   from a population with a mean of 1490 and a standard deviation of 20 hours
bulbdata2 <- rnorm(200,mean=1490,sd=20)
# View the summary of the data sample 
summary(bulbdata2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1431    1475    1490    1490    1503    1566
sd(bulbdata2)
## [1] 19.36044
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata2, alternative = 'less',mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata2
## z = -7.3701, p-value = 8.523e-14
## alternative hypothesis: true mean is less than 1500
## 95 percent confidence interval:
##        NA 1491.903
## sample estimates:
## mean of x 
##  1489.577
# Create a bulb data sample of size 200, 
#   from a population with a mean of 1480 and a standard deviation of 20 hours
bulbdata3 <- rnorm(200,mean=1480,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1426    1467    1479    1480    1493    1537
sd(bulbdata3)
## [1] 19.86364
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata3, alternative = 'less', mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata3
## z = -14.247, p-value < 2.2e-16
## alternative hypothesis: true mean is less than 1500
## 95 percent confidence interval:
##        NA 1482.178
## sample estimates:
## mean of x 
##  1479.852

Decision Scenario 3 (Involves One-sample, Two-sided Z-Test)

In a factory the bulb production process is mature and has achieved a mean lifetime of 1500 hours with a standard deviation of 20 hours.

Recently, there has been claims from the large industrial customers that the lifetime of bulbs manufactured in the factory is not 1500 any longer.

The quality control team is tasked to do a test and determine if this is true by measuring the lifetime of 200 bulbs.

Solution Approach

# Create a bulb data sample of size 200, 
#   from a population with a mean of 1498 and a standard deviation of 20 hours
bulbdata1 <- rnorm(200,mean=1498,sd=20)
# View the summary of the data sample 
summary(bulbdata1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1439    1487    1502    1499    1512    1545
sd(bulbdata1)
## [1] 20.09334
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata1, alternative ='two.sided',mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata1
## z = -0.35396, p-value = 0.7234
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1496.728 1502.271
## sample estimates:
## mean of x 
##  1499.499
# Create a bulb data sample of size 200, 
#   from a population with a mean of 1502 and a standard deviation of 20 hours
bulbdata2 <- rnorm(200,mean=1502,sd=20)
# View the summary of the data sample 
summary(bulbdata2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1449    1490    1502    1503    1516    1551
sd(bulbdata2)
## [1] 19.11629
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata2, alternative = 'two.sided',mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata2
## z = 2.1674, p-value = 0.0302
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1500.293 1505.837
## sample estimates:
## mean of x 
##  1503.065
# Create a bulb data sample of size 200, 
#   from a population with a mean of 1490 and a standard deviation of 20 hours
bulbdata3 <- rnorm(200,mean=1490,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1438    1474    1489    1488    1502    1538
sd(bulbdata3)
## [1] 19.16297
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata3, alternative = 'two.sided', mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata3
## z = -8.4623, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1485.261 1490.804
## sample estimates:
## mean of x 
##  1488.033
# Create a bulb data sample of size 200, 
#   from a population with a mean of 1510 and a standard deviation of 20 hours
bulbdata3 <- rnorm(200,mean=1510,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1455    1497    1511    1512    1524    1576
sd(bulbdata3)
## [1] 21.21823
# One-sample, One-sided Z-Test.
ztest_res <- z.test(bulbdata3, alternative = 'two.sided', mu=1500, sigma.x=20)
ztest_res
## 
##  One-sample z-Test
## 
## data:  bulbdata3
## z = 8.1904, p-value = 2.604e-16
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1508.811 1514.355
## sample estimates:
## mean of x 
##  1511.583

Decision Scenario 4 (Involves One-sample, One-sided (right-tailed) t-Test)

In a factory the bulb production process is mature and has achieved a mean lifetime of 1500 hours with a standard deviation of 20 hours. R & D team has proposed a process improvement.

The quality control team is to check and assess if the proposed process change increases the lifetime of bulbs by measuring the lifetime of 18 bulbs.

Solution Approach

# Create a bulb data sample of size 18, 
#   from a population with a mean of 1501 and a standard deviation of 20 hours
bulbdata1 <- rnorm(18,mean=1501,sd=20)
# View the summary of the data sample 
summary(bulbdata1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1473    1485    1497    1500    1506    1553
sd(bulbdata1)
## [1] 19.8553
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata1, alternative ="greater",mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata1
## t = -0.085341, df = 17, p-value = 0.5335
## alternative hypothesis: true mean is greater than 1500
## 95 percent confidence interval:
##  1491.459      Inf
## sample estimates:
## mean of x 
##  1499.601
# Create a bulb data sample of size 18, 
#   from a population with a mean of 1510 and a standard deviation of 20 hours
bulbdata2 <- rnorm(18,mean=1510,sd=20)
# View the summary of the data sample 
summary(bulbdata2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1477    1493    1504    1505    1516    1541
sd(bulbdata2)
## [1] 17.80551
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata2, alternative = 'greater',mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata2
## t = 1.1761, df = 17, p-value = 0.1279
## alternative hypothesis: true mean is greater than 1500
## 95 percent confidence interval:
##  1497.635      Inf
## sample estimates:
## mean of x 
##  1504.936
# Create a bulb data sample of size 18, 
#   from a population with a mean of 1520 and a standard deviation of 20 hours
bulbdata3 <- rnorm(18,mean=1520,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1462    1509    1521    1517    1529    1567
sd(bulbdata3)
## [1] 24.52587
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata3, alternative = 'greater', mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata3
## t = 2.9456, df = 17, p-value = 0.004521
## alternative hypothesis: true mean is greater than 1500
## 95 percent confidence interval:
##  1506.972      Inf
## sample estimates:
## mean of x 
##  1517.028

Decision Scenario 5 (Involves One-sample, One-sided (left-tailed) t-Test)

In a factory the bulb production process is mature and has achieved a mean lifetime of 1500 hours with a standard deviation of 20 hours. There has been a feedback from several industrial customers that the lifetime of the bulbs has reduced below 1500 hours.

The quality control team is to check and assess if the lifetime of bulbs manufactured in the factory has reduced using the lifetime data of 18 bulbs.

Solution Approach

# Create a bulb data sample of size 18, 
#   from a population with a mean of 1499 and a standard deviation of 20 hours
bulbdata1 <- rnorm(18,mean=1499,sd=20)
# View the summary of the data sample 
summary(bulbdata1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1444    1473    1480    1488    1503    1529
sd(bulbdata1)
## [1] 23.61276
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata1, alternative ='less',mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata1
## t = -2.1954, df = 17, p-value = 0.02115
## alternative hypothesis: true mean is less than 1500
## 95 percent confidence interval:
##      -Inf 1497.463
## sample estimates:
## mean of x 
##  1487.781
# Create a bulb data sample of size 18, 
#   from a population with a mean of 1490 and a standard deviation of 20 hours
bulbdata2 <- rnorm(18,mean=1490,sd=20)
# View the summary of the data sample 
summary(bulbdata2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1445    1475    1485    1489    1511    1535
sd(bulbdata2)
## [1] 24.19678
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata2, alternative = 'less',mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata2
## t = -1.8962, df = 17, p-value = 0.03753
## alternative hypothesis: true mean is less than 1500
## 95 percent confidence interval:
##      -Inf 1499.107
## sample estimates:
## mean of x 
##  1489.185
# Create a bulb data sample of size 18, 
#   from a population with a mean of 1480 and a standard deviation of 20 hours
bulbdata3 <- rnorm(18,mean=1480,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1451    1467    1475    1481    1500    1522
sd(bulbdata3)
## [1] 22.60715
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata3, alternative = 'less', mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata3
## t = -3.4937, df = 17, p-value = 0.001391
## alternative hypothesis: true mean is less than 1500
## 95 percent confidence interval:
##      -Inf 1490.653
## sample estimates:
## mean of x 
##  1481.383

Decision Scenario 6 (Involves One-sample, Two-sided t-Test)

In a factory the bulb production process is mature and has achieved a mean lifetime of 1500 hours with a standard deviation of 20 hours.

Recently, there has been claims from the large industrial customers that the lifetime of bulbs manufactured in the factory is not 1500 any longer.

The quality control team is tasked to do a test and determine if this is true by measuring the lifetime of 18 bulbs.

Solution Approach

# Create a bulb data sample of size 18, 
#   from a population with a mean of 1498 and a standard deviation of 20 hours
bulbdata1 <- rnorm(18,mean=1498,sd=20)
# View the summary of the data sample 
summary(bulbdata1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1461    1493    1504    1500    1511    1523
sd(bulbdata1)
## [1] 17.95744
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata1, alternative ='two.sided',mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata1
## t = -0.049437, df = 17, p-value = 0.9611
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1490.861 1508.721
## sample estimates:
## mean of x 
##  1499.791
# Create a bulb data sample of size 18, 
#   from a population with a mean of 1502 and a standard deviation of 20 hours
bulbdata2 <- rnorm(18,mean=1502,sd=20)
# View the summary of the data sample 
summary(bulbdata2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1487    1493    1508    1507    1516    1538
sd(bulbdata2)
## [1] 15.2164
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata2, alternative = 'two.sided',mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata2
## t = 1.9098, df = 17, p-value = 0.07318
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1499.283 1514.417
## sample estimates:
## mean of x 
##   1506.85
# Create a bulb data sample of size 18, 
#   from a population with a mean of 1490 and a standard deviation of 20 hours
bulbdata3 <- rnorm(18,mean=1490,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1468    1482    1492    1495    1502    1531
sd(bulbdata3)
## [1] 18.24747
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata3, alternative = 'two.sided', mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata3
## t = -1.2739, df = 17, p-value = 0.2198
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1485.447 1503.595
## sample estimates:
## mean of x 
##  1494.521
# Create a bulb data sample of size 18, 
#   from a population with a mean of 1510 and a standard deviation of 20 hours
bulbdata3 <- rnorm(18,mean=1510,sd=20)
# View the summary of the data sample 
summary(bulbdata3)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1468    1490    1512    1507    1520    1543
sd(bulbdata3)
## [1] 22.12108
# One-sample, One-sided t-Test.
ttest_res <- t.test(bulbdata3, alternative = 'two.sided', mu=1500)
ttest_res
## 
##  One Sample t-test
## 
## data:  bulbdata3
## t = 1.2658, df = 17, p-value = 0.2226
## alternative hypothesis: true mean is not equal to 1500
## 95 percent confidence interval:
##  1495.600 1517.601
## sample estimates:
## mean of x 
##    1506.6

References