Using the teengamb data, model gamble as the response and the other variables as predictors. Investigate the possibility of interactions between sex and the other predictors. Interpret your final model by explaining what the regression parameter estimates mean.
library(faraway)
data(teengamb)
teengamb
## sex status income verbal gamble
## 1 1 51 2.00 8 0.00
## 2 1 28 2.50 8 0.00
## 3 1 37 2.00 6 0.00
## 4 1 28 7.00 4 7.30
## 5 1 65 2.00 8 19.60
## 6 1 61 3.47 6 0.10
## 7 1 28 5.50 7 1.45
## 8 1 27 6.42 5 6.60
## 9 1 43 2.00 6 1.70
## 10 1 18 6.00 7 0.10
## 11 1 18 3.00 6 0.10
## 12 1 43 4.75 6 5.40
## 13 1 30 2.20 4 1.20
## 14 1 28 2.00 6 3.60
## 15 1 38 3.00 6 2.40
## 16 1 38 1.50 8 3.40
## 17 1 28 9.50 8 0.10
## 18 1 18 10.00 5 8.40
## 19 1 43 4.00 8 12.00
## 20 0 51 3.50 9 0.00
## 21 0 62 3.00 8 1.00
## 22 0 47 2.50 9 1.20
## 23 0 43 3.50 5 0.10
## 24 0 27 10.00 4 156.00
## 25 0 71 6.50 7 38.50
## 26 0 38 1.50 7 2.10
## 27 0 51 5.44 4 14.50
## 28 0 38 1.00 6 3.00
## 29 0 51 0.60 7 0.60
## 30 0 62 5.50 8 9.60
## 31 0 18 12.00 2 88.00
## 32 0 30 7.00 7 53.20
## 33 0 38 15.00 7 90.00
## 34 0 71 2.00 10 3.00
## 35 0 28 1.50 1 14.10
## 36 0 61 4.50 8 70.00
## 37 0 71 2.50 7 38.50
## 38 0 28 8.00 6 57.20
## 39 0 51 10.00 6 6.00
## 40 0 65 1.60 6 25.00
## 41 0 48 2.00 9 6.90
## 42 0 61 15.00 9 69.70
## 43 0 75 3.00 8 13.30
## 44 0 66 3.25 9 0.60
## 45 0 62 4.94 6 38.00
## 46 0 71 1.50 7 14.40
## 47 0 71 2.50 9 19.20
teengamb$sex <- as.factor(teengamb$sex)
teengamb
## sex status income verbal gamble
## 1 1 51 2.00 8 0.00
## 2 1 28 2.50 8 0.00
## 3 1 37 2.00 6 0.00
## 4 1 28 7.00 4 7.30
## 5 1 65 2.00 8 19.60
## 6 1 61 3.47 6 0.10
## 7 1 28 5.50 7 1.45
## 8 1 27 6.42 5 6.60
## 9 1 43 2.00 6 1.70
## 10 1 18 6.00 7 0.10
## 11 1 18 3.00 6 0.10
## 12 1 43 4.75 6 5.40
## 13 1 30 2.20 4 1.20
## 14 1 28 2.00 6 3.60
## 15 1 38 3.00 6 2.40
## 16 1 38 1.50 8 3.40
## 17 1 28 9.50 8 0.10
## 18 1 18 10.00 5 8.40
## 19 1 43 4.00 8 12.00
## 20 0 51 3.50 9 0.00
## 21 0 62 3.00 8 1.00
## 22 0 47 2.50 9 1.20
## 23 0 43 3.50 5 0.10
## 24 0 27 10.00 4 156.00
## 25 0 71 6.50 7 38.50
## 26 0 38 1.50 7 2.10
## 27 0 51 5.44 4 14.50
## 28 0 38 1.00 6 3.00
## 29 0 51 0.60 7 0.60
## 30 0 62 5.50 8 9.60
## 31 0 18 12.00 2 88.00
## 32 0 30 7.00 7 53.20
## 33 0 38 15.00 7 90.00
## 34 0 71 2.00 10 3.00
## 35 0 28 1.50 1 14.10
## 36 0 61 4.50 8 70.00
## 37 0 71 2.50 7 38.50
## 38 0 28 8.00 6 57.20
## 39 0 51 10.00 6 6.00
## 40 0 65 1.60 6 25.00
## 41 0 48 2.00 9 6.90
## 42 0 61 15.00 9 69.70
## 43 0 75 3.00 8 13.30
## 44 0 66 3.25 9 0.60
## 45 0 62 4.94 6 38.00
## 46 0 71 1.50 7 14.40
## 47 0 71 2.50 9 19.20
by(teengamb, teengamb$sex, summary)
## teengamb$sex: 0
## sex status income verbal gamble
## 0:28 Min. :18.00 Min. : 0.600 Min. : 1.000 Min. : 0.000
## 1: 0 1st Qu.:38.00 1st Qu.: 2.000 1st Qu.: 6.000 1st Qu.: 2.775
## Median :51.00 Median : 3.375 Median : 7.000 Median : 14.250
## Mean :52.00 Mean : 4.976 Mean : 6.821 Mean : 29.775
## 3rd Qu.:65.25 3rd Qu.: 6.625 3rd Qu.: 8.250 3rd Qu.: 42.175
## Max. :75.00 Max. :15.000 Max. :10.000 Max. :156.000
## ------------------------------------------------------------
## teengamb$sex: 1
## sex status income verbal gamble
## 0: 0 Min. :18.00 Min. : 1.500 Min. :4.000 Min. : 0.000
## 1:19 1st Qu.:28.00 1st Qu.: 2.000 1st Qu.:6.000 1st Qu.: 0.100
## Median :30.00 Median : 3.000 Median :6.000 Median : 1.700
## Mean :35.26 Mean : 4.149 Mean :6.421 Mean : 3.866
## 3rd Qu.:43.00 3rd Qu.: 5.750 3rd Qu.:8.000 3rd Qu.: 6.000
## Max. :65.00 Max. :10.000 Max. :8.000 Max. :19.600
plot(gamble~sex, teengamb)
plot(gamble~status, pch=as.character(sex), teengamb)
plot(gamble~income, pch=as.character(sex), teengamb)
plot(gamble~verbal, pch=as.character(sex), teengamb)
#lmod<-lm(gamble~sex+status+income+verbal, teengamb)
#sumary(lmod)
#lmod1<-lm(gamble~sex+status+sex:status+income+verbal, teengamb)
#sumary(lmod1)
t.test(gamble ~ sex, teengamb, var.equal=TRUE)
##
## Two Sample t-test
##
## data: gamble by sex
## t = 2.9961, df = 45, p-value = 0.004437
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 8.491931 43.326490
## sample estimates:
## mean in group 0 mean in group 1
## 29.775000 3.865789
In Male the amount spent on gambling is more as compared to Females. Lower the status score in male, more the gambling amount. Higher the income in males, more is the gmble maount. but the gambling events are less. Highr the verbal score in male, morre is the gambling