Example with R
Suppose we are interested in calculating a95% confidence interval
for the mean hotel expenditures in Manhattan in New Year’s Evening. We collect a random sample of40bills (large enough for
the CLT to be applicable) and observe the following data:
hotels <-data.frame(bills =c(306, 446, 276, 235, 295, 302,
374, 339, 624, 266, 497, 384, 429, 497, 224, 157, 248, 349, 388,
391, 266, 230, 621, 314, 344, 413, 267, 380, 225, 418, 257, 466,
230, 548, 277, 354, 271, 369, 275, 272))
xbar<-mean(hotels$bills)
s <-sd(hotels$bills)
cbind(xbar, s)
cbind(xbar, s)
xbars
[1,] 345.6 108.8527
12