mba <- read.csv(paste("MBA Starting Salaries Data.csv", sep=""))
summary(mba)
## age sex gmat_tot gmat_qpc
## Min. :22.00 Min. :1.000 Min. :450.0 Min. :28.00
## 1st Qu.:25.00 1st Qu.:1.000 1st Qu.:580.0 1st Qu.:72.00
## Median :27.00 Median :1.000 Median :620.0 Median :83.00
## Mean :27.36 Mean :1.248 Mean :619.5 Mean :80.64
## 3rd Qu.:29.00 3rd Qu.:1.000 3rd Qu.:660.0 3rd Qu.:93.00
## Max. :48.00 Max. :2.000 Max. :790.0 Max. :99.00
## gmat_vpc gmat_tpc s_avg f_avg
## Min. :16.00 Min. : 0.0 Min. :2.000 Min. :0.000
## 1st Qu.:71.00 1st Qu.:78.0 1st Qu.:2.708 1st Qu.:2.750
## Median :81.00 Median :87.0 Median :3.000 Median :3.000
## Mean :78.32 Mean :84.2 Mean :3.025 Mean :3.062
## 3rd Qu.:91.00 3rd Qu.:94.0 3rd Qu.:3.300 3rd Qu.:3.250
## Max. :99.00 Max. :99.0 Max. :4.000 Max. :4.000
## quarter work_yrs frstlang salary
## Min. :1.000 Min. : 0.000 Min. :1.000 Min. : 0
## 1st Qu.:1.250 1st Qu.: 2.000 1st Qu.:1.000 1st Qu.: 0
## Median :2.000 Median : 3.000 Median :1.000 Median : 999
## Mean :2.478 Mean : 3.872 Mean :1.117 Mean : 39026
## 3rd Qu.:3.000 3rd Qu.: 4.000 3rd Qu.:1.000 3rd Qu.: 97000
## Max. :4.000 Max. :22.000 Max. :2.000 Max. :220000
## satis
## Min. : 1.0
## 1st Qu.: 5.0
## Median : 6.0
## Mean :172.2
## 3rd Qu.: 7.0
## Max. :998.0
attach(mba)
View(mba)
library(psych)
describe(mba)
## vars n mean sd median trimmed mad min max
## age 1 274 27.36 3.71 27 26.76 2.97 22 48
## sex 2 274 1.25 0.43 1 1.19 0.00 1 2
## gmat_tot 3 274 619.45 57.54 620 618.86 59.30 450 790
## gmat_qpc 4 274 80.64 14.87 83 82.31 14.83 28 99
## gmat_vpc 5 274 78.32 16.86 81 80.33 14.83 16 99
## gmat_tpc 6 274 84.20 14.02 87 86.12 11.86 0 99
## s_avg 7 274 3.03 0.38 3 3.03 0.44 2 4
## f_avg 8 274 3.06 0.53 3 3.09 0.37 0 4
## quarter 9 274 2.48 1.11 2 2.47 1.48 1 4
## work_yrs 10 274 3.87 3.23 3 3.29 1.48 0 22
## frstlang 11 274 1.12 0.32 1 1.02 0.00 1 2
## salary 12 274 39025.69 50951.56 999 33607.86 1481.12 0 220000
## satis 13 274 172.18 371.61 6 91.50 1.48 1 998
## range skew kurtosis se
## age 26 2.16 6.45 0.22
## sex 1 1.16 -0.66 0.03
## gmat_tot 340 -0.01 0.06 3.48
## gmat_qpc 71 -0.92 0.30 0.90
## gmat_vpc 83 -1.04 0.74 1.02
## gmat_tpc 99 -2.28 9.02 0.85
## s_avg 2 -0.06 -0.38 0.02
## f_avg 4 -2.08 10.85 0.03
## quarter 3 0.02 -1.35 0.07
## work_yrs 22 2.78 9.80 0.20
## frstlang 1 2.37 3.65 0.02
## salary 220000 0.70 -1.05 3078.10
## satis 997 1.77 1.13 22.45
library(lattice)
histogram(~sex ,main = "Gender Diversity", xlab="Sex", ylab = "Frequency", col='blue' )

histogram(~gmat_tot , col='red' )

boxplot(age)

histogram(~salary , col='red' )

histogram(~satis , col='red' )

library(car)
##
## Attaching package: 'car'
## The following object is masked from 'package:psych':
##
## logit
scatterplotMatrix(formula=~age + sex +gmat_tot + gmat_qpc + gmat_tpc + gmat_vpc + s_avg + f_avg + quarter + work_yrs + frstlang + salary + satis,cex=0.8)

library(corrgram)
corrgram(mba , order = T, text.panel=panel.txt,lower.panel = panel.shade,upper.panel = panel.pie, main="Corrgram of the variables")

cor(mba) # only numeric cols
## age sex gmat_tot gmat_qpc gmat_vpc
## age 1.00000000 -0.028106442 -0.14593840 -0.21616985 -0.04417547
## sex -0.02810644 1.000000000 -0.05336820 -0.16377435 0.07488782
## gmat_tot -0.14593840 -0.053368202 1.00000000 0.72473781 0.74839187
## gmat_qpc -0.21616985 -0.163774346 0.72473781 1.00000000 0.15218014
## gmat_vpc -0.04417547 0.074887816 0.74839187 0.15218014 1.00000000
## gmat_tpc -0.16990307 -0.008090213 0.84779965 0.65137754 0.66621604
## s_avg 0.14970402 0.127115144 0.11311702 -0.02984873 0.20445365
## f_avg -0.01744806 0.091663891 0.10442409 0.07370455 0.07592225
## quarter -0.04967221 -0.133533171 -0.09223903 0.03636638 -0.17460736
## work_yrs 0.85829810 -0.011296374 -0.18235434 -0.23660827 -0.06639049
## frstlang 0.05692649 0.001536205 -0.13503402 0.13892774 -0.38980465
## salary -0.06257355 0.068858628 -0.05497188 -0.04403293 -0.00613934
## satis -0.12788825 -0.054602220 0.08255770 0.06060004 0.06262375
## gmat_tpc s_avg f_avg quarter work_yrs
## age -0.169903066 0.14970402 -0.01744806 -4.967221e-02 0.858298096
## sex -0.008090213 0.12711514 0.09166389 -1.335332e-01 -0.011296374
## gmat_tot 0.847799647 0.11311702 0.10442409 -9.223903e-02 -0.182354339
## gmat_qpc 0.651377538 -0.02984873 0.07370455 3.636638e-02 -0.236608270
## gmat_vpc 0.666216035 0.20445365 0.07592225 -1.746074e-01 -0.066390490
## gmat_tpc 1.000000000 0.11736245 0.07973210 -8.303535e-02 -0.173361859
## s_avg 0.117362449 1.00000000 0.55062139 -7.621166e-01 0.129292714
## f_avg 0.079732099 0.55062139 1.00000000 -4.475064e-01 -0.039056921
## quarter -0.083035351 -0.76211664 -0.44750637 1.000000e+00 -0.086026406
## work_yrs -0.173361859 0.12929271 -0.03905692 -8.602641e-02 1.000000000
## frstlang -0.103362747 -0.13631308 -0.03705695 9.949226e-02 -0.027866747
## salary 0.004930901 0.14583606 0.02944303 -1.643699e-01 0.009023407
## satis 0.092934266 -0.03268664 0.01089273 -1.267198e-05 -0.109255286
## frstlang salary satis
## age 0.056926486 -0.062573547 -1.278882e-01
## sex 0.001536205 0.068858628 -5.460222e-02
## gmat_tot -0.135034017 -0.054971880 8.255770e-02
## gmat_qpc 0.138927742 -0.044032933 6.060004e-02
## gmat_vpc -0.389804653 -0.006139340 6.262375e-02
## gmat_tpc -0.103362747 0.004930901 9.293427e-02
## s_avg -0.136313080 0.145836062 -3.268664e-02
## f_avg -0.037056954 0.029443027 1.089273e-02
## quarter 0.099492259 -0.164369865 -1.267198e-05
## work_yrs -0.027866747 0.009023407 -1.092553e-01
## frstlang 1.000000000 -0.086592096 7.932264e-02
## salary -0.086592096 1.000000000 -3.352171e-01
## satis 0.079322637 -0.335217114 1.000000e+00
mbanew<-mba[which(mba$salary>0),]
detach(mba)
table(mbanew$salary , mbanew$age)
##
## 22 23 24 25 26 27 28 29 30 31 32 33 34 39 40
## 998 0 0 2 15 11 11 4 0 1 2 0 0 0 0 0
## 999 0 0 2 6 5 7 3 5 3 2 2 0 0 0 0
## 64000 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
## 77000 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
## 78256 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
## 82000 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## 85000 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0
## 86000 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
## 88000 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
## 88500 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## 90000 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0
## 92000 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0
## 93000 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0
## 95000 0 0 1 5 0 0 0 1 0 0 0 0 0 0 0
## 96000 0 0 1 1 2 0 0 0 0 0 0 0 0 0 0
## 96500 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
## 97000 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0
## 98000 0 1 3 2 1 1 1 1 0 0 0 0 0 0 0
## 99000 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
## 100000 0 1 4 1 1 1 0 0 0 1 0 0 0 0 0
## 100400 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
## 101000 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0
## 101100 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
## 101600 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## 102500 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
## 103000 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## 104000 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0
## 105000 0 1 1 2 3 1 0 0 1 1 0 0 1 0 0
## 106000 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0
## 107000 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## 107300 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
## 107500 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## 108000 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0
## 110000 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
## 112000 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0
## 115000 0 0 1 1 0 3 0 0 0 0 0 0 0 0 0
## 118000 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
## 120000 0 0 0 0 0 1 1 0 2 0 0 0 0 0 0
## 126710 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## 130000 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## 145800 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
## 146000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
## 162000 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
## 220000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
table(mbanew$salary , mbanew$sex)
##
## 1 2
## 998 37 9
## 999 30 5
## 64000 0 1
## 77000 1 0
## 78256 0 1
## 82000 0 1
## 85000 1 3
## 86000 0 2
## 88000 0 1
## 88500 1 0
## 90000 3 0
## 92000 2 1
## 93000 2 1
## 95000 4 3
## 96000 3 1
## 96500 1 0
## 97000 2 0
## 98000 6 4
## 99000 0 1
## 100000 4 5
## 100400 1 0
## 101000 0 2
## 101100 1 0
## 101600 1 0
## 102500 1 0
## 103000 1 0
## 104000 2 0
## 105000 11 0
## 106000 2 1
## 107000 1 0
## 107300 1 0
## 107500 1 0
## 108000 2 0
## 110000 0 1
## 112000 3 0
## 115000 5 0
## 118000 1 0
## 120000 3 1
## 126710 1 0
## 130000 1 0
## 145800 1 0
## 146000 1 0
## 162000 1 0
## 220000 0 1
table(mbanew$s_avg , mbanew$f_avg)
##
## 0 2 2.25 2.33 2.5 2.67 2.75 2.8 2.83 3 3.17 3.2 3.25 3.33 3.4 3.5
## 2.2 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
## 2.3 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0
## 2.4 0 1 1 0 2 0 3 0 0 0 0 0 0 0 0 0
## 2.45 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## 2.5 0 0 1 0 3 0 4 0 0 2 0 0 0 0 0 0
## 2.6 0 0 0 0 4 0 3 0 0 3 0 0 0 0 0 0
## 2.67 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 2.7 0 0 0 0 3 0 6 0 0 6 0 1 3 0 0 0
## 2.73 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
## 2.8 0 0 0 0 0 0 3 0 0 5 0 0 2 0 0 0
## 2.9 0 0 0 0 0 0 5 1 0 6 0 0 6 1 0 1
## 2.91 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
## 3 0 0 0 0 0 0 4 0 0 6 0 0 4 0 0 0
## 3.09 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
## 3.1 0 0 0 1 0 1 0 0 0 5 0 0 2 1 0 3
## 3.18 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
## 3.2 0 0 0 0 0 0 0 0 0 4 0 0 6 0 1 1
## 3.27 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
## 3.3 0 0 0 0 0 0 0 0 0 2 0 0 9 0 0 5
## 3.4 0 0 0 0 0 0 0 1 0 1 0 0 3 0 0 0
## 3.45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
## 3.5 0 0 0 0 0 1 0 0 0 2 0 0 3 0 0 4
## 3.56 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 3.6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4
## 3.7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 3.8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2
## 4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## 3.6 3.67 3.75 4
## 2.2 0 0 0 0
## 2.3 0 0 0 0
## 2.4 0 0 0 0
## 2.45 0 0 0 0
## 2.5 0 0 0 0
## 2.6 0 0 0 0
## 2.67 0 0 0 0
## 2.7 0 0 0 0
## 2.73 0 0 0 0
## 2.8 0 0 0 0
## 2.9 0 0 0 0
## 2.91 0 0 0 0
## 3 0 0 0 0
## 3.09 0 0 0 0
## 3.1 0 0 1 0
## 3.18 0 0 0 0
## 3.2 0 0 0 0
## 3.27 0 0 0 0
## 3.3 0 0 0 0
## 3.4 0 1 2 1
## 3.45 0 1 0 0
## 3.5 1 0 1 2
## 3.56 0 0 0 1
## 3.6 0 1 2 0
## 3.7 1 0 0 1
## 3.8 0 0 0 1
## 4 0 0 0 1
table(mbanew$salary , mbanew$gmat_tot)
##
## 450 460 500 520 530 540 550 560 570 580 590 600 610 620 630 640
## 998 1 1 0 0 0 0 0 3 0 2 2 5 4 0 7 3
## 999 0 0 1 0 0 0 1 2 4 1 2 3 0 4 2 2
## 64000 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
## 77000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 78256 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
## 82000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 85000 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 86000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
## 88000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 88500 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 90000 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0
## 92000 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 93000 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0
## 95000 0 0 0 0 1 0 0 2 0 0 0 0 2 0 0 0
## 96000 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0
## 96500 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
## 97000 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0
## 98000 0 0 0 0 0 0 0 1 3 1 1 0 1 0 0 0
## 99000 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
## 100000 0 0 0 0 0 0 0 2 0 1 0 1 1 0 1 0
## 100400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
## 101000 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0
## 101100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 101600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
## 102500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 103000 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 104000 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0
## 105000 0 0 0 0 0 0 2 0 2 3 0 1 0 1 0 0
## 106000 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 107000 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
## 107300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 107500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
## 108000 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0
## 110000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
## 112000 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
## 115000 0 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0
## 118000 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 120000 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0
## 126710 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## 130000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 145800 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 146000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
## 162000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 220000 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
##
## 650 660 670 680 690 700 710 720 730 740 790
## 998 2 3 5 2 2 0 1 1 0 2 0
## 999 2 3 1 1 2 0 1 0 1 1 1
## 64000 0 0 0 0 0 0 0 0 0 0 0
## 77000 0 1 0 0 0 0 0 0 0 0 0
## 78256 0 0 0 0 0 0 0 0 0 0 0
## 82000 0 0 1 0 0 0 0 0 0 0 0
## 85000 0 1 0 0 0 1 0 1 0 0 0
## 86000 0 0 0 1 0 0 0 0 0 0 0
## 88000 1 0 0 0 0 0 0 0 0 0 0
## 88500 0 0 0 0 0 0 0 0 0 0 0
## 90000 1 0 0 0 0 0 0 0 0 0 0
## 92000 0 1 0 0 0 0 1 0 0 0 0
## 93000 0 0 0 0 0 0 0 0 0 0 0
## 95000 0 0 2 0 0 0 0 0 0 0 0
## 96000 1 0 0 0 0 0 0 0 0 0 0
## 96500 0 0 0 0 0 0 0 0 0 0 0
## 97000 0 0 0 0 0 0 0 0 0 0 0
## 98000 0 0 1 1 0 0 1 0 0 0 0
## 99000 0 0 0 0 0 0 0 0 0 0 0
## 100000 2 0 0 0 0 0 1 0 0 0 0
## 100400 0 0 0 0 0 0 0 0 0 0 0
## 101000 0 0 0 0 0 0 0 0 0 0 0
## 101100 0 1 0 0 0 0 0 0 0 0 0
## 101600 0 0 0 0 0 0 0 0 0 0 0
## 102500 0 0 1 0 0 0 0 0 0 0 0
## 103000 0 0 0 0 0 0 0 0 0 0 0
## 104000 0 0 0 0 0 0 0 0 0 0 0
## 105000 1 0 0 1 0 0 0 0 0 0 0
## 106000 0 0 0 2 0 0 0 0 0 0 0
## 107000 0 0 0 0 0 0 0 0 0 0 0
## 107300 0 1 0 0 0 0 0 0 0 0 0
## 107500 0 0 0 0 0 0 0 0 0 0 0
## 108000 0 0 0 0 0 0 0 0 0 0 0
## 110000 0 0 0 0 0 0 0 0 0 0 0
## 112000 0 0 1 1 0 0 0 0 0 0 0
## 115000 0 0 0 0 0 0 1 0 0 0 0
## 118000 0 0 0 0 0 0 0 0 0 0 0
## 120000 0 0 1 0 0 1 0 0 0 0 0
## 126710 0 0 0 0 0 0 0 0 0 0 0
## 130000 1 0 0 0 0 0 0 0 0 0 0
## 145800 0 0 0 0 0 0 0 0 0 0 0
## 146000 0 0 0 0 0 0 0 0 0 0 0
## 162000 0 0 0 0 0 1 0 0 0 0 0
## 220000 0 0 0 0 0 0 0 0 0 0 0
chisq.test(mbanew$s_avg,mbanew$f_avg)
## Warning in chisq.test(mbanew$s_avg, mbanew$f_avg): Chi-squared
## approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: mbanew$s_avg and mbanew$f_avg
## X-squared = 1033.1, df = 494, p-value < 2.2e-16
chisq.test(mbanew$age,mbanew$sex)
## Warning in chisq.test(mbanew$age, mbanew$sex): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: mbanew$age and mbanew$sex
## X-squared = 15.118, df = 14, p-value = 0.3702
t.test(salary ~ sex , data=mbanew)
##
## Welch Two Sample t-test
##
## data: salary by sex
## t = -1.5302, df = 78.552, p-value = 0.13
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -30667.267 4010.795
## sample estimates:
## mean in group 1 mean in group 2
## 54854.72 68182.96
attach(mbanew)
model1 <- salary ~ age + sex +gmat_tot + gmat_qpc + gmat_tpc + gmat_vpc + s_avg + f_avg + quarter + work_yrs + frstlang + satis
fit1 <- lm(model1, data = mbanew)
summary(fit1)
##
## Call:
## lm(formula = model1, data = mbanew)
##
## Residuals:
## Min 1Q Median 3Q Max
## -103936 -13077 7917 20885 146540
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 228483.693 86388.607 2.645 0.00893 **
## age -1550.150 2104.014 -0.737 0.46228
## sex 5306.562 7117.925 0.746 0.45698
## gmat_tot -418.393 220.387 -1.898 0.05932 .
## gmat_qpc 408.102 609.343 0.670 0.50393
## gmat_tpc 786.043 487.510 1.612 0.10873
## gmat_vpc 369.579 576.719 0.641 0.52249
## s_avg 14107.508 14506.824 0.972 0.33219
## f_avg -2922.426 7048.776 -0.415 0.67895
## quarter -5499.290 4724.554 -1.164 0.24605
## work_yrs 3493.891 2229.411 1.567 0.11892
## frstlang -16423.566 10377.748 -1.583 0.11537
## satis -72.717 6.805 -10.685 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 38840 on 171 degrees of freedom
## Multiple R-squared: 0.4888, Adjusted R-squared: 0.453
## F-statistic: 13.63 on 12 and 171 DF, p-value: < 2.2e-16
library(leaps)
leap1 <- regsubsets(model1, data = mbanew, nbest=1)
# summary(leap1)
plot(leap1, scale="adjr2")

model2 <- salary ~ gmat_tot + gmat_tpc + s_avg + quarter + work_yrs + frstlang + satis
fit2 <- lm(model2, data = mbanew)
summary(fit2)
##
## Call:
## lm(formula = model2, data = mbanew)
##
## Residuals:
## Min 1Q Median 3Q Max
## -98441 -11784 9528 21140 148460
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 176769.764 64986.920 2.720 0.00718 **
## gmat_tot -314.940 103.357 -3.047 0.00267 **
## gmat_tpc 1014.152 432.971 2.342 0.02028 *
## s_avg 12434.965 13662.674 0.910 0.36399
## quarter -5578.065 4595.186 -1.214 0.22641
## work_yrs 2045.615 1172.885 1.744 0.08289 .
## frstlang -19251.721 8688.711 -2.216 0.02799 *
## satis -72.921 6.687 -10.905 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 38480 on 176 degrees of freedom
## Multiple R-squared: 0.4835, Adjusted R-squared: 0.463
## F-statistic: 23.54 on 7 and 176 DF, p-value: < 2.2e-16