Recall the light bulb example from the lecture notes. The table below expands on the study where the company uses two different machines.
Halogen | Energy saver | LED | |
---|---|---|---|
Machine 1 | 86 | 81 | 68 |
Machine 2 | 282 | 105 | 84 |
Total | 368 | 186 | 152 |
bulbs <- rbind(c(86, 81, 68),c(282, 105, 84)) rownames(bulbs) <- c("Machine1","Machine2") colnames(bulbs) <- c("Halogen", "Energy saver", "LED") bulbs
Assume there is no difference between the bulb types, calculate the total number of rejected light bulbs for each machine.
M1 <- sum(bulbs[1,]) M2 <- sum(bulbs[2,])
Under this assumption, estimate the log-odds for the rejected bulbs made by machine 1 relative to machine 2. Also derive an approximate 95% confidence interval. What do you conclude.
LOR_total <- log(M1 / M2) se_total <- sqrt(1/M1 + 1/M2) LOR_total + c(-1.96, 1.96) * se_total
This confidence interval does not contain 0. We would then conclude in saying that there exists an association between the machines and the number of rejected light bulbs.
Perform the same analysis for each light bulb type.
#Halogen LOR_hal <- log(bulbs[1, 1] / bulbs[2, 1]) se_hal <- sqrt(1/bulbs[1, 1] + 1/bulbs[2, 1]) LOR_hal + c(-1.96, 1.96) * se_hal #Energy Saver LOR_ES <- log(bulbs[1, 2] / bulbs[2, 2]) se_ES <- sqrt(1/bulbs[1, 2] + 1/bulbs[2, 2]) LOR_ES + c(-1.96, 1.96) * se_ES #LED LOR_LED <- log(bulbs[1, 3] / bulbs[2, 3]) se_LED <- sqrt(1/bulbs[1, 3]+ 1/bulbs[2, 3]) LOR_LED + c(-1.96, 1.96) * se_LED
Only the confidence interval for Halogen does not contain 0. There is no evidence to distinguish between the machines regarding the number of rejected energy saver and LED light bulbs.