#install.packages('faraway')
library(faraway)
data(teengamb)
summary(teengamb)
## sex status income verbal
## Min. :0.0000 Min. :18.00 Min. : 0.600 Min. : 1.00
## 1st Qu.:0.0000 1st Qu.:28.00 1st Qu.: 2.000 1st Qu.: 6.00
## Median :0.0000 Median :43.00 Median : 3.250 Median : 7.00
## Mean :0.4043 Mean :45.23 Mean : 4.642 Mean : 6.66
## 3rd Qu.:1.0000 3rd Qu.:61.50 3rd Qu.: 6.210 3rd Qu.: 8.00
## Max. :1.0000 Max. :75.00 Max. :15.000 Max. :10.00
## gamble
## Min. : 0.0
## 1st Qu.: 1.1
## Median : 6.0
## Mean : 19.3
## 3rd Qu.: 19.4
## Max. :156.0
teengamb$sex <- factor(teengamb$sex)
teengamb[1:5,]
## sex status income verbal gamble
## 1 1 51 2.0 8 0.0
## 2 1 28 2.5 8 0.0
## 3 1 37 2.0 6 0.0
## 4 1 28 7.0 4 7.3
## 5 1 65 2.0 8 19.6
levels(teengamb$sex) <- c('male', 'female')
summary(teengamb$sex)
## male female
## 28 19
hist(teengamb$status, breaks=20)
hist(teengamb$income, breaks=20)
hist(teengamb$verbal, breaks=20)
plot(gamble ~ status, teengamb)
So it seems that there is a negative correlation between these two variables.
plot(gamble ~ income, teengamb)
So it seems that there is a positive correlation between these two variables.
plot(gamble ~ verbal, teengamb)
So it seems that there is a negative correlation between these two variables.
plot(gamble ~ sex, teengamb)
So it seems that in general males are more likely to put more money on gambling.