# BAC: Blood Alcohol Content In PASWR2: Probability and Statistics with R, Second Edition

## Description

Two volunteers weighing 180 pounds each consumed a twelve ounce beer every fifteen minutes for one hour. One hour after the fourth beer was consumed, each volunteer's blood alcohol was measured with ten different breathalyzers from the same company. The numbers recorded in data frame `BAC` are the sorted blood alcohol content values reported with breathalyzers from company `X` and company `Y`.

## Usage

 `1` ```BAC ```

## Format

A data frame with 10 observations of the following 2 variables:

• `X` (blood alcohol content measured in g/L)

• `Y` (blood alcohol content measured in g/L)

## References

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

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```with(data = BAC, var.test(X, Y, alternative = "less")) # Convert data from wide to long format # library(reshape2) # BACL <- melt(BAC, variable.name = "company", value.name = "bac") # ggplot(data = BACL, aes(x = company, y = bac, fill = company)) + # geom_boxplot() + guides(fill = "none") + scale_fill_brewer() + # labs(y = "blood alcohol content measured in g/L") # Convert with reshape() BACL <- reshape(BAC, varying = c("X", "Y"), v.names = "bac", timevar = "company", direction = "long") ggplot(data = BACL, aes(x = factor(company), y = bac, fill = factor(company))) + geom_boxplot() + guides(fill = "none") + scale_fill_brewer() + labs(y = "blood alcohol content measured in g/L", x = "") + scale_x_discrete(breaks = c(1, 2), labels = c("Company X", "Company Y")) # Base graphics boxplot(BAC\$Y, BAC\$X) ```

PASWR2 documentation built on Sept. 5, 2021, 5:44 p.m.