Learn R Programming

PASWR2 (version 1.0.5)

BATTERY: Lithium Batteries

Description

A manufacturer of lithium batteries has two production facilities, A and B. Facility A batteries have an advertised life of 180 hours. Facility B batteries have an advertised life of 200 hours. Fifty randomly selected batteries from Facility A are selected and tested. Fifty randomly selected batteries from Facility B are selected and tested. The lifetimes for the tested batteries are stored in the variable lifetime.

Usage

BATTERY

Arguments

Format

A data frame with 100 observations on the following two variables:

  • lifetime (life time measured in hours)

  • facility (factor with two levels A and B)

References

Ugarte, M. D., Militino, A. F., and Arnholt, A. T. 2015. Probability and Statistics with R, Second Edition. Chapman & Hall / CRC.

Examples

Run this code
# NOT RUN {
p <- ggplot(data = BATTERY, aes(x = lifetime, color = facility))
p + geom_density()
q <- ggplot(data = BATTERY, aes(x = facility, y = lifetime))
q + geom_violin()
ggplot(data = BATTERY, aes(x = facility, y = lifetime, fill = facility)) + 
geom_violin() + scale_fill_brewer() + guides(fill = "none")
ggplot(data = BATTERY, aes(sample = lifetime)) + stat_qq() + facet_grid(. ~ facility)
ggplot(data = BATTERY, aes(sample = lifetime, color = facility)) + stat_qq()
# lattice approach
qqmath(~ lifetime|facility, data = BATTERY)
qqmath(~ lifetime, group = facility, type = c('p', 'r'), auto.key=TRUE, data = BATTERY)
# }

Run the code above in your browser using DataLab