-----------------MBA-Starting salaries Harvard business case study Analysis under guidance  OF PROF.SAMEER    
                                         MATHUR(PH.D) IIM-LUCKNOW.-----------------------
  ##reading the data into R
   mbasal <- read.csv(paste( "MBA Starting Salaries Data.csv" ,sep=""))
##viewing the data.

library(psych)
View(mbasal)
##describing the data.
describe(mbasal)
##          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
##summary the data.
summary(mbasal)
##       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
##describing the dataset

str(mbasal)
## 'data.frame':    274 obs. of  13 variables:
##  $ age     : int  23 24 24 24 24 24 25 25 25 25 ...
##  $ sex     : int  2 1 1 1 2 1 1 2 1 1 ...
##  $ gmat_tot: int  620 610 670 570 710 640 610 650 630 680 ...
##  $ gmat_qpc: int  77 90 99 56 93 82 89 88 79 99 ...
##  $ gmat_vpc: int  87 71 78 81 98 89 74 89 91 81 ...
##  $ gmat_tpc: int  87 87 95 75 98 91 87 92 89 96 ...
##  $ s_avg   : num  3.4 3.5 3.3 3.3 3.6 3.9 3.4 3.3 3.3 3.45 ...
##  $ f_avg   : num  3 4 3.25 2.67 3.75 3.75 3.5 3.75 3.25 3.67 ...
##  $ quarter : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ work_yrs: int  2 2 2 1 2 2 2 2 2 2 ...
##  $ frstlang: int  1 1 1 1 1 1 1 1 2 1 ...
##  $ salary  : int  0 0 0 0 999 0 0 0 999 998 ...
##  $ satis   : int  7 6 6 7 5 6 5 6 4 998 ...
         --------------------Boxplot illustrations---------------------

    ------------------Histogram illustrations---------------------

      ------------------Scatter plots construction------------------------
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit

      ------------------corrgram construction-----------------------------

##covariance 
cov(mbasal)
##                    age           sex      gmat_tot      gmat_qpc
## age       1.376904e+01 -4.513248e-02 -3.115879e+01 -1.192655e+01
## sex      -4.513248e-02  1.872677e-01 -1.328841e+00 -1.053769e+00
## gmat_tot -3.115879e+01 -1.328841e+00  3.310688e+03  6.200233e+02
## gmat_qpc -1.192655e+01 -1.053769e+00  6.200233e+02  2.210731e+02
## gmat_vpc -2.763643e+00  5.463758e-01  7.260006e+02  3.814826e+01
## gmat_tpc -8.839978e+00 -4.908960e-02  6.839911e+02  1.357997e+02
## s_avg     2.116874e-01  2.096227e-02  2.480257e+00 -1.691233e-01
## f_avg    -3.399348e-02  2.082698e-02  3.154688e+00  5.753854e-01
## quarter  -2.045935e-01 -6.414267e-02 -5.891153e+00  6.001979e-01
## work_yrs  1.029494e+01 -1.580172e-02 -3.391634e+01 -1.137186e+01
## frstlang  6.796610e-02  2.138980e-04 -2.499933e+00  6.646346e-01
## salary   -1.183042e+04  1.518264e+03 -1.611600e+05 -3.335823e+04
## satis    -1.763499e+02 -8.780808e+00  1.765263e+03  3.348371e+02
##               gmat_vpc     gmat_tpc         s_avg        f_avg
## age         -2.7636427   -8.8399775    0.21168739  -0.03399348
## sex          0.5463758   -0.0490896    0.02096227   0.02082698
## gmat_tot   726.0006417  683.9910698    2.48025721   3.15468838
## gmat_qpc    38.1482581  135.7996845   -0.16912329   0.57538542
## gmat_vpc   284.2481217  157.4932488    1.31357023   0.67207000
## gmat_tpc   157.4932488  196.6057057    0.62710008   0.58698618
## s_avg        1.3135702    0.6271001    0.14521760   0.11016898
## f_avg        0.6720700    0.5869862    0.11016898   0.27567237
## quarter     -3.2676666   -1.2923719   -0.32237213  -0.26080880
## work_yrs    -3.6181653   -7.8575172    0.15926392  -0.06628700
## frstlang    -2.1145691   -0.4663244   -0.01671372  -0.00626026
## salary   -5273.8523836 3522.7500067 2831.60098580 787.65597177
## satis      392.3562739  484.2466779   -4.62884495   2.12532927
##                quarter      work_yrs      frstlang        salary
## age      -2.045935e-01   10.29493864  6.796610e-02 -1.183042e+04
## sex      -6.414267e-02   -0.01580172  2.138980e-04  1.518264e+03
## gmat_tot -5.891153e+00  -33.91633914 -2.499933e+00 -1.611600e+05
## gmat_qpc  6.001979e-01  -11.37186171  6.646346e-01 -3.335823e+04
## gmat_vpc -3.267667e+00   -3.61816529 -2.114569e+00 -5.273852e+03
## gmat_tpc -1.292372e+00   -7.85751718 -4.663244e-01  3.522750e+03
## s_avg    -3.223721e-01    0.15926392 -1.671372e-02  2.831601e+03
## f_avg    -2.608088e-01   -0.06628700 -6.260260e-03  7.876560e+02
## quarter   1.232119e+00   -0.30866822  3.553381e-02 -9.296214e+03
## work_yrs -3.086682e-01   10.44882490 -2.898318e-02  1.486147e+03
## frstlang  3.553381e-02   -0.02898318  1.035266e-01 -1.419586e+03
## salary   -9.296214e+03 1486.14704152 -1.419586e+03  2.596062e+09
## satis    -5.227133e-03 -131.24080907  9.484532e+00 -6.347115e+06
##                  satis
## age      -1.763499e+02
## sex      -8.780808e+00
## gmat_tot  1.765263e+03
## gmat_qpc  3.348371e+02
## gmat_vpc  3.923563e+02
## gmat_tpc  4.842467e+02
## s_avg    -4.628845e+00
## f_avg     2.125329e+00
## quarter  -5.227133e-03
## work_yrs -1.312408e+02
## frstlang  9.484532e+00
## salary   -6.347115e+06
## satis     1.380974e+05
##creating a dataset of the students who actually got the job
mba=mbasal[which(mbasal$salary!=0),]
View(mba) 
##creating tables.
table(mba$s_avg,mba$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
##creating tables.
table(mba$gmat_tot,mba$gmat_qpc)
##      
##       39 43 46 48 49 50 52 53 55 56 57 60 64 65 66 67 68 71 72 74 75 77 78
##   450  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   460  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0
##   500  0  0  1  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  1
##   520  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   530  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0
##   540  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
##   550  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  2  1  0  0  0
##   560  1  0  0  0  0  0  3  0  1  0  1  1  1  0  0  0  1  0  0  0  1  0  0
##   570  0  0  0  0  0  0  0  0  0  1  0  0  0  1  0  0  1  1  1  0  1  0  0
##   580  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  3  0  0  0  1
##   590  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  2  0  1  0  0  0  0
##   600  0  0  0  0  0  0  0  1  0  0  0  1  0  0  0  1  1  0  1  0  0  4  0
##   610  0  0  0  1  0  0  0  0  0  0  0  0  1  0  0  0  0  0  1  0  1  0  0
##   620  0  0  0  0  0  0  1  0  0  0  0  1  0  0  0  0  0  0  1  0  0  0  1
##   630  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  2  0  1  0  0
##   640  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0
##   650  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   660  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0
##   670  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   680  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   690  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   700  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   710  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   720  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   730  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   740  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   790  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##      
##       79 81 82 83 84 85 87 88 89 90 91 92 93 94 95 96 97 98 99
##   450  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   460  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   500  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   520  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   530  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   540  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   550  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   560  1  1  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0
##   570  0  0  2  0  0  0  0  0  1  0  0  0  1  0  1  0  0  0  0
##   580  2  0  0  2  0  0  0  0  1  0  1  0  0  0  0  0  0  0  0
##   590  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  1  0  0
##   600  0  0  1  0  1  0  1  0  2  0  1  0  0  0  0  0  1  0  1
##   610  0  0  1  1  0  0  1  0  2  0  0  0  0  0  0  0  0  0  0
##   620  1  1  1  0  1  1  1  1  2  0  0  0  1  0  0  0  2  0  0
##   630  3  0  1  2  1  1  2  0  0  0  0  0  2  0  0  1  0  0  0
##   640  2  0  0  0  0  0  1  0  1  0  0  0  1  0  0  0  0  0  0
##   650  2  0  1  0  0  0  1  0  3  0  1  0  1  0  1  0  0  0  1
##   660  0  1  0  1  1  0  0  1  0  1  1  0  0  0  2  0  1  0  1
##   670  0  0  0  3  1  0  2  0  0  0  1  0  0  0  1  0  2  1  2
##   680  1  0  0  0  1  0  1  0  0  0  1  1  0  0  0  2  1  0  1
##   690  0  0  0  0  0  0  1  0  0  0  0  0  0  1  0  1  0  0  1
##   700  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  0  0  1  0
##   710  0  0  0  0  0  0  0  0  0  0  0  0  2  0  2  1  0  0  1
##   720  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  0  0
##   730  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0
##   740  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  3
##   790  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1
##creating tables.
table(mba$gmat_vpc,mba$gmat_tpc)
##     
##      0 37 44 51 52 58 61 62 65 68 69 71 72 73 75 77 78 79 80 81 83 84 85
##   16 0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   22 0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   30 0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   33 0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0
##   37 0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0
##   41 0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  1  0  0  0
##   45 0  0  0  1  0  0  0  1  1  0  1  0  1  0  0  0  0  0  0  0  1  0  0
##   46 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   50 0  0  0  0  0  0  0  0  0  1  0  1  0  0  0  0  0  0  1  0  0  0  0
##   54 0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0
##   58 0  0  0  0  0  0  0  0  0  0  2  0  2  0  2  0  0  1  0  1  1  0  0
##   62 0  0  0  0  0  0  1  0  1  0  0  0  0  0  1  0  0  0  0  0  2  0  0
##   63 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   67 0  0  0  0  0  1  0  0  0  0  0  0  1  0  0  0  0  1  1  0  1  0  1
##   71 1  0  0  0  0  0  0  0  0  0  0  0  2  0  1  0  5  0  0  0  0  0  0
##   74 0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  0  0  0  0  0  1  0  0
##   75 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   78 0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  2  0
##   81 0  0  0  0  0  0  0  0  0  0  0  0  3  0  0  0  1  0  0  2  1  2  0
##   82 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0
##   84 0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  1  1  0  0
##   85 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   87 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0
##   89 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0
##   90 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   91 0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  1  0  0
##   92 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   93 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   95 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0
##   96 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   97 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   98 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   99 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##     
##      86 87 88 89 90 91 92 93 94 95 96 97 98 99
##   16  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   22  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   30  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   33  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   37  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   41  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   45  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   46  1  0  0  0  0  0  0  0  0  0  0  0  0  0
##   50  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   54  0  1  0  0  0  0  0  0  0  0  0  0  0  0
##   58  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   62  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   63  0  0  1  0  0  0  0  1  0  0  0  0  0  0
##   67  1  0  0  0  0  0  0  0  0  0  0  0  0  0
##   71  1  1  0  1  0  1  0  0  0  1  0  0  0  0
##   74  0  5  0  0  0  0  0  0  0  0  1  0  0  0
##   75  0  0  0  0  0  1  0  0  0  0  0  0  0  0
##   78  0  0  0  0  0  1  0  0  0  0  0  0  0  0
##   81  2  1  0  0  1  1  0  1  1  2  2  0  0  0
##   82  0  0  0  0  0  0  0  0  0  0  0  0  0  0
##   84  1  1  0  2  0  1  0  3  1  0  0  0  0  0
##   85  0  0  0  1  0  0  0  0  0  0  2  0  0  0
##   87  1  0  1  4  1  0  0  1  0  0  1  2  0  0
##   89  0  1  0  1  1  0  0  1  0  1  0  1  0  0
##   90  0  0  0  0  0  0  0  0  0  1  0  1  0  0
##   91  0  0  0  2  0  0  0  2  0  0  0  0  0  0
##   92  0  0  0  0  0  0  1  0  1  0  0  0  0  1
##   93  1  0  0  1  0  1  0  1  2  1  0  1  1  0
##   95  0  0  0  2  0  1  0  1  1  2  0  1  3  0
##   96  0  1  0  0  0  0  0  0  0  1  2  0  1  0
##   97  0  0  0  0  0  0  0  0  0  0  1  0  0  1
##   98  1  1  0  0  0  0  1  0  0  1  2  0  4  5
##   99  0  0  0  0  0  0  0  0  0  1  1  0  0  2
       --------------------chi-square test-------------------------
##chisquare test
chisq.test(mba$salary,mba$satis)
## Warning in chisq.test(mba$salary, mba$satis): Chi-squared approximation may
## be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  mba$salary and mba$satis
## X-squared = 391.04, df = 301, p-value = 0.0003578
##chisquare test
chisq.test(mba$s_avg,mba$f_avg)
## Warning in chisq.test(mba$s_avg, mba$f_avg): Chi-squared approximation may
## be incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  mba$s_avg and mba$f_avg
## X-squared = 1033.1, df = 494, p-value < 2.2e-16
chisq.test(mba$age,mba$sex)
## Warning in chisq.test(mba$age, mba$sex): Chi-squared approximation may be
## incorrect
## 
##  Pearson's Chi-squared test
## 
## data:  mba$age and mba$sex
## X-squared = 15.118, df = 14, p-value = 0.3702
        -------------------------T-test------------------------------
##t-test
attach(mba)
t.test(salary,sex)
## 
##  Welch Two Sample t-test
## 
## data:  salary and sex
## t = 15.012, df = 183, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  50475.22 65750.98
## sample estimates:
##    mean of x    mean of y 
## 58114.342391     1.244565
          -----------------------Regression model----------------------------
##regression model
reg <- lm(mba$salary~mba$gmat_tot+mba$gmat_qpc)
summary(reg)
## 
## Call:
## lm(formula = mba$salary ~ mba$gmat_tot + mba$gmat_qpc)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -80512 -53628  26771  42639 145813 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  130669.17   44862.42   2.913  0.00403 **
## mba$gmat_tot    -72.77      95.18  -0.765  0.44551   
## mba$gmat_qpc   -334.92     381.14  -0.879  0.38071   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 52210 on 181 degrees of freedom
## Multiple R-squared:  0.02226,    Adjusted R-squared:  0.01146 
## F-statistic:  2.06 on 2 and 181 DF,  p-value: 0.1304
fit <- lm(salary~work_yrs+gmat_tot+s_avg+f_avg,data = mba)
summary(fit)
## 
## Call:
## lm(formula = salary ~ work_yrs + gmat_tot + s_avg + f_avg, data = mba)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -89213 -49145  21292  43622 132708 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept) 44421.05   50786.86   0.875  0.38293   
## work_yrs     2550.59    1568.99   1.626  0.10579   
## gmat_tot     -132.34      69.73  -1.898  0.05932 . 
## s_avg       34331.82   11788.51   2.912  0.00404 **
## f_avg       -5471.92    8866.60  -0.617  0.53793   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 50600 on 179 degrees of freedom
## Multiple R-squared:  0.09184,    Adjusted R-squared:  0.07154 
## F-statistic: 4.525 on 4 and 179 DF,  p-value: 0.001661