###################################################################### # Light bulb example - see what happens when parts of the # # C.I. formula are changed # # # ###################################################################### #Want y-axis to be short to help display this plot win.graph(width = 7, height = 2, pointsize = 12) # Use dev.new() instead if have non-window based computer ybar <- 299.2 s <- 80 alpha <- 0.1 n <- 16 qt(p = 1 - alpha/2, df = n-1) #Interval lower <- ybar - qt(p = 1 - alpha/2, df = n-1) * s / sqrt(n) upper <- ybar + qt(p = 1 - alpha/2, df = n-1) * s / sqrt(n) data.frame(lower, upper) #Note that the x-axis limits are fixed plot(x = c(lower, upper), lty = 1, pch = 19, type = "o", y = c(1,1), xlim = c(100, 500), yaxt = "n", ylab = "", xlab = "Light bulb life", col = "red", lwd = 2) #