AP Stats Casino Lab
Introduction
This lab will introduce you to the basics of applied statistics using data from a casino. We will be using the American Roulette Data Set from the Rdatasets package. This data set contains information on 10,000 roulette spins from a single casino.
Objectives
By the end of this lab, you will be able to:
- Load data into R
- Perform descriptive statistics on data
- Create and interpret scatterplots
- Conduct a hypothesis test
Getting Started
First, we need to load the data into R. We can do this using the read.csv()
function.
data <- read.csv("roulette.csv")
This will create a data frame called data
that contains the data from the roulette data set.
Descriptive Statistics
We can use the summary()
function to get a quick overview of the data.
summary(data)
This will show us the mean, median, standard deviation, and range for each of the variables in the data set.
We can also use the plot()
function to create a histogram of the data.
plot(data$Winnings)
This will create a histogram of the Winnings
variable.
Scatterplots
We can use the plot()
function to create a scatterplot of two variables.
plot(data$Winnings, data$Number)
This will create a scatterplot of the Winnings
and Number
variables.
Hypothesis Testing
We can use the t.test()
function to conduct a hypothesis test.
t.test(data$Winnings, mu = 0)
This will conduct a t-test to test the hypothesis that the mean of the Winnings
variable is equal to 0.
Conclusion
In this lab, we introduced you to the basics of applied statistics using data from a casino. We loaded data into R, performed descriptive statistics on the data, created and interpreted scatterplots, and conducted a hypothesis test.
Resources
Thank you for your visit!