Analysis of factors affecting the cause of Boston housing price

Boston.df <- read.csv(paste("Boston.csv", sep = ""))
View(Boston.df)
attach(Boston.df)
dim(Boston.df)
## [1] 506  14
library(psych)
describe(Boston.df)
##       vars   n   mean     sd median trimmed    mad    min    max  range
## CRIM     1 506   3.61   8.60   0.26    1.68   0.33   0.01  88.98  88.97
## ZN       2 506  11.36  23.32   0.00    5.08   0.00   0.00 100.00 100.00
## INDUS    3 506  11.14   6.86   9.69   10.93   9.37   0.46  27.74  27.28
## CHAS     4 506   0.07   0.25   0.00    0.00   0.00   0.00   1.00   1.00
## NOX      5 506   0.55   0.12   0.54    0.55   0.13   0.38   0.87   0.49
## RM       6 506   6.28   0.70   6.21    6.25   0.51   3.56   8.78   5.22
## AGE      7 506  68.57  28.15  77.50   71.20  28.98   2.90 100.00  97.10
## DIS      8 506   3.80   2.11   3.21    3.54   1.91   1.13  12.13  11.00
## RAD      9 506   9.55   8.71   5.00    8.73   2.97   1.00  24.00  23.00
## TAX     10 506 408.24 168.54 330.00  400.04 108.23 187.00 711.00 524.00
## PT      11 506  18.46   2.16  19.05   18.66   1.70  12.60  22.00   9.40
## B       12 506 356.67  91.29 391.44  383.17   8.09   0.32 396.90 396.58
## LSTAT   13 506  12.65   7.14  11.36   11.90   7.11   1.73  37.97  36.24
## MV      14 506  22.53   9.20  21.20   21.56   5.93   5.00  50.00  45.00
##        skew kurtosis   se
## CRIM   5.19    36.60 0.38
## ZN     2.21     3.95 1.04
## INDUS  0.29    -1.24 0.30
## CHAS   3.39     9.48 0.01
## NOX    0.72    -0.09 0.01
## RM     0.40     1.84 0.03
## AGE   -0.60    -0.98 1.25
## DIS    1.01     0.46 0.09
## RAD    1.00    -0.88 0.39
## TAX    0.67    -1.15 7.49
## PT    -0.80    -0.30 0.10
## B     -2.87     7.10 4.06
## LSTAT  0.90     0.46 0.32
## MV     1.10     1.45 0.41
# Display of the structure of the Boston.f data frames
str(Boston.df)
## 'data.frame':    506 obs. of  14 variables:
##  $ CRIM : num  0.00632 0.02731 0.02729 0.03237 0.06905 ...
##  $ ZN   : num  18 0 0 0 0 0 12.5 12.5 12.5 12.5 ...
##  $ INDUS: num  2.31 7.07 7.07 2.18 2.18 ...
##  $ CHAS : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ NOX  : num  0.538 0.469 0.469 0.458 0.458 ...
##  $ RM   : num  6.57 6.42 7.18 7 7.15 ...
##  $ AGE  : num  65.2 78.9 61.1 45.8 54.2 ...
##  $ DIS  : num  4.09 4.97 4.97 6.06 6.06 ...
##  $ RAD  : int  1 2 2 3 3 3 5 5 5 5 ...
##  $ TAX  : int  296 242 242 222 222 222 311 311 311 311 ...
##  $ PT   : num  15.3 17.8 17.8 18.7 18.7 ...
##  $ B    : num  397 397 393 395 397 ...
##  $ LSTAT: num  4.98 9.14 4.03 2.94 5.33 ...
##  $ MV   : num  24 21.6 34.7 33.4 36.2 ...
summary(Boston.df)
##       CRIM                ZN             INDUS            CHAS        
##  Min.   : 0.00632   Min.   :  0.00   Min.   : 0.46   Min.   :0.00000  
##  1st Qu.: 0.08205   1st Qu.:  0.00   1st Qu.: 5.19   1st Qu.:0.00000  
##  Median : 0.25651   Median :  0.00   Median : 9.69   Median :0.00000  
##  Mean   : 3.61352   Mean   : 11.36   Mean   :11.14   Mean   :0.06917  
##  3rd Qu.: 3.67708   3rd Qu.: 12.50   3rd Qu.:18.10   3rd Qu.:0.00000  
##  Max.   :88.97620   Max.   :100.00   Max.   :27.74   Max.   :1.00000  
##       NOX               RM             AGE              DIS        
##  Min.   :0.3850   Min.   :3.561   Min.   :  2.90   Min.   : 1.130  
##  1st Qu.:0.4490   1st Qu.:5.886   1st Qu.: 45.02   1st Qu.: 2.100  
##  Median :0.5380   Median :6.208   Median : 77.50   Median : 3.207  
##  Mean   :0.5547   Mean   :6.285   Mean   : 68.57   Mean   : 3.795  
##  3rd Qu.:0.6240   3rd Qu.:6.623   3rd Qu.: 94.08   3rd Qu.: 5.188  
##  Max.   :0.8710   Max.   :8.780   Max.   :100.00   Max.   :12.127  
##       RAD              TAX              PT              B         
##  Min.   : 1.000   Min.   :187.0   Min.   :12.60   Min.   :  0.32  
##  1st Qu.: 4.000   1st Qu.:279.0   1st Qu.:17.40   1st Qu.:375.38  
##  Median : 5.000   Median :330.0   Median :19.05   Median :391.44  
##  Mean   : 9.549   Mean   :408.2   Mean   :18.46   Mean   :356.67  
##  3rd Qu.:24.000   3rd Qu.:666.0   3rd Qu.:20.20   3rd Qu.:396.23  
##  Max.   :24.000   Max.   :711.0   Max.   :22.00   Max.   :396.90  
##      LSTAT             MV       
##  Min.   : 1.73   Min.   : 5.00  
##  1st Qu.: 6.95   1st Qu.:17.02  
##  Median :11.36   Median :21.20  
##  Mean   :12.65   Mean   :22.53  
##  3rd Qu.:16.95   3rd Qu.:25.00  
##  Max.   :37.97   Max.   :50.00
#number of house near Charles river 1= if tract bounds the river and 0 = otherwise
CharTable <- table(Boston.df$CHAS)
CharTable
## 
##   0   1 
## 471  35
#Distance of Radial highways access to boston houses
Acess <- table(Boston.df$RAD)
Acess
## 
##   1   2   3   4   5   6   7   8  24 
##  20  24  38 110 115  26  17  24 132
#pupil-teacher ratio by town
population <-table(Boston.df$PT)
population
## 
## 12.60000038          13 13.60000038 14.39999962 14.69999981 14.80000019 
##           3          12           1           1          34           3 
## 14.89999962 15.10000038 15.19999981 15.30000019        15.5 15.60000038 
##           4           1          13           3           1           2 
## 15.89999962          16 16.10000038 16.39999962 16.60000038 16.79999924 
##           2           5           5           6          16           4 
## 16.89999962          17 17.29999924 17.39999962 17.60000038 17.79999924 
##           5           4           1          18           7          23 
## 17.89999962          18 18.20000076 18.29999924 18.39999962        18.5 
##          11           5           4           4          16           4 
## 18.60000038 18.70000076 18.79999924 18.89999962          19 19.10000038 
##          17           9           2           3           4          17 
## 19.20000076 19.60000038 19.70000076 20.10000038 20.20000076 20.89999962 
##          19           8           8           5         140          11 
##          21 21.10000038 21.20000076          22 
##          27           1          15           2
mytab <-xtabs(~RAD + AGE,data=Boston.df)
addmargins(mytab)
##      AGE
## RAD   2.900000095   6 6.199999809 6.5 6.599999905 6.800000191 7.800000191
##   1             0   0           0   0           0           0           0
##   2             0   0           0   0           0           0           0
##   3             1   0           0   1           1           0           0
##   4             0   0           1   0           1           0           1
##   5             0   1           0   0           0           0           0
##   6             0   0           0   0           0           0           1
##   7             0   0           0   0           0           1           0
##   8             0   0           0   0           0           0           0
##   24            0   0           0   0           0           0           0
##   Sum           1   1           1   1           2           1           2
##      AGE
## RAD   8.399999619 8.899999619 9.800000191 9.899999619  10  13 13.89999962
##   1             0           0           0           1   0   0           0
##   2             0           0           0           0   0   0           0
##   3             0           0           0           0   0   0           1
##   4             0           0           1           0   0   0           0
##   5             0           0           0           0   1   0           0
##   6             0           0           0           0   0   0           0
##   7             1           1           0           0   0   1           0
##   8             0           0           0           0   0   0           0
##   24            0           0           0           0   0   0           0
##   Sum           1           1           1           1   1   1           1
##      AGE
## RAD   14.69999981 15.30000019 15.69999981 15.80000019 16.29999924  17
##   1             0           0           0           0           0   0
##   2             0           0           1           0           0   0
##   3             0           1           0           1           1   0
##   4             0           0           0           0           0   0
##   5             1           0           0           0           0   0
##   6             0           0           0           0           0   0
##   7             0           0           0           0           0   0
##   8             0           0           0           0           0   1
##   24            0           0           0           0           0   0
##   Sum           1           1           1           1           1   1
##      AGE
## RAD   17.20000076 17.5 17.70000076 17.79999924 18.39999962 18.5
##   1             0    0           0           0           0    0
##   2             0    0           0           0           0    0
##   3             0    0           0           0           0    0
##   4             1    1           0           1           1    1
##   5             0    0           0           0           0    0
##   6             0    0           0           0           0    1
##   7             0    1           1           0           1    0
##   8             0    0           0           0           0    0
##   24            0    0           0           0           0    0
##   Sum           1    2           1           1           2    2
##      AGE
## RAD   18.79999924 19.10000038 19.5 20.10000038 20.79999924 21.10000038
##   1             1           1    0           0           1           0
##   2             0           0    0           0           0           0
##   3             0           0    0           0           0           0
##   4             0           0    1           0           0           1
##   5             0           0    0           1           0           0
##   6             0           0    0           0           0           0
##   7             0           0    0           0           0           0
##   8             0           0    0           0           0           0
##   24            0           0    0           0           0           0
##   Sum           1           1    1           1           1           1
##      AGE
## RAD   21.39999962 21.5 21.79999924 21.89999962 22.29999924 22.89999962
##   1             0    0           0           0           0           0
##   2             0    0           0           0           0           0
##   3             0    0           1           0           0           0
##   4             2    0           0           1           1           0
##   5             0    1           0           1           0           0
##   6             0    0           0           0           0           1
##   7             0    0           0           0           0           0
##   8             1    0           0           0           0           0
##   24            0    0           0           0           0           0
##   Sum           3    1           1           2           1           1
##      AGE
## RAD   23.29999924 23.39999962 24.79999924 25.79999924 26.29999924
##   1             1           0           1           0           0
##   2             0           0           0           0           0
##   3             0           0           0           0           0
##   4             0           1           0           1           0
##   5             0           0           0           0           1
##   6             0           0           0           0           0
##   7             0           0           0           0           0
##   8             0           0           0           0           0
##   24            0           0           0           0           0
##   Sum           1           1           1           1           1
##      AGE
## RAD   27.60000038 27.70000076 27.89999962 28.10000038 28.39999962
##   1             0           0           0           0           1
##   2             0           0           0           0           0
##   3             0           0           0           0           0
##   4             1           2           1           0           0
##   5             0           0           0           1           0
##   6             0           0           0           0           0
##   7             0           0           0           0           0
##   8             0           0           0           0           0
##   24            0           0           0           0           0
##   Sum           1           2           1           1           1
##      AGE
## RAD   28.79999924 28.89999962 29.10000038 29.20000076 29.29999924
##   1             0           0           0           0           0
##   2             0           0           0           0           0
##   3             0           0           0           0           0
##   4             0           1           0           0           1
##   5             0           1           1           0           0
##   6             1           0           0           0           0
##   7             0           0           0           0           0
##   8             0           0           0           1           0
##   24            0           0           0           0           0
##   Sum           1           2           1           1           1
##      AGE
## RAD   29.70000076 30.20000076 30.79999924 31.10000038 31.29999924 31.5
##   1             0           0           0           0           0    1
##   2             0           0           0           0           0    0
##   3             0           0           0           0           0    0
##   4             1           0           0           2           0    0
##   5             0           1           1           0           0    0
##   6             0           0           0           0           1    0
##   7             0           0           0           0           0    0
##   8             0           0           0           0           0    0
##   24            0           0           0           0           0    0
##   Sum           1           1           1           2           1    1
##      AGE
## RAD   31.89999962  32 32.09999847 32.20000076 32.29999924 32.90000153  33
##   1             1   1           0           0           0           0   0
##   2             0   0           0           0           0           0   0
##   3             0   0           0           0           0           0   0
##   4             1   1           1           2           1           1   1
##   5             0   0           0           1           0           0   0
##   6             0   0           0           0           0           0   0
##   7             0   0           0           0           0           0   0
##   8             0   0           0           0           0           0   0
##   24            0   0           0           0           0           0   0
##   Sum           2   2           1           3           1           1   1
##      AGE
## RAD   33.09999847 33.20000076 33.29999924 33.5 33.79999924 34.09999847
##   1             0           0           0    0           0           0
##   2             0           0           0    0           0           1
##   3             0           0           1    0           1           0
##   4             0           1           0    1           0           0
##   5             1           0           0    0           0           0
##   6             0           0           0    0           0           0
##   7             0           0           0    0           0           0
##   8             0           0           0    0           0           0
##   24            0           0           0    0           0           0
##   Sum           1           1           1    1           1           1
##      AGE
## RAD   34.20000076 34.5 34.90000153 35.70000076 35.90000153 36.09999847
##   1             0    1           0           0           0           0
##   2             0    0           0           1           0           0
##   3             1    0           0           0           0           0
##   4             0    0           0           0           1           0
##   5             0    1           0           0           0           1
##   6             0    0           0           0           0           0
##   7             0    0           1           0           0           0
##   8             0    0           0           0           0           0
##   24            0    0           0           0           0           0
##   Sum           1    2           1           1           1           1
##      AGE
## RAD   36.59999847 36.79999924 36.90000153 37.20000076 37.29999924
##   1             0           0           0           0           0
##   2             1           0           1           0           0
##   3             0           0           0           0           0
##   4             1           1           0           0           0
##   5             1           0           0           1           1
##   6             0           0           0           0           0
##   7             0           0           0           0           0
##   8             0           0           0           0           0
##   24            0           0           0           0           0
##   Sum           3           1           1           1           1
##      AGE
## RAD   37.79999924 38.09999847 38.29999924 38.40000153 38.5 38.90000153  39
##   1             0           0           0           0    0           0   0
##   2             0           0           1           1    0           0   0
##   3             0           0           0           0    0           0   0
##   4             1           0           0           0    0           0   0
##   5             0           1           0           0    1           1   1
##   6             0           0           0           0    0           0   0
##   7             0           0           0           0    0           0   0
##   8             0           0           0           0    0           0   0
##   24            0           0           0           0    0           0   0
##   Sum           1           1           1           1    1           1   1
##      AGE
## RAD    40 40.09999847 40.29999924 40.40000153 40.5 41.09999847 41.5
##   1     0           0           0           0    0           0    0
##   2     0           0           0           0    0           0    0
##   3     1           0           0           0    0           0    0
##   4     0           0           0           0    0           0    0
##   5     0           1           0           0    1           1    1
##   6     0           0           0           0    0           0    0
##   7     0           0           0           1    0           1    0
##   8     0           0           0           0    0           0    0
##   24    0           0           1           0    0           0    0
##   Sum   1           1           1           1    1           2    1
##      AGE
## RAD   41.90000153 42.09999847 42.20000076 42.29999924 42.40000153
##   1             0           0           0           0           0
##   2             0           0           0           0           0
##   3             0           1           0           0           0
##   4             0           0           0           1           1
##   5             0           0           0           0           0
##   6             0           0           1           0           0
##   7             0           0           0           0           0
##   8             0           0           0           0           0
##   24            1           0           0           0           0
##   Sum           1           1           1           1           1
##      AGE
## RAD   42.59999847 42.79999924 43.40000153 43.70000076 44.40000153  45
##   1             0           0           0           0           1   0
##   2             0           0           0           0           0   0
##   3             0           0           0           0           0   0
##   4             0           1           0           0           0   0
##   5             0           0           0           1           0   1
##   6             1           0           0           0           0   0
##   7             0           0           0           0           0   0
##   8             0           0           1           0           0   0
##   24            0           0           0           0           0   0
##   Sum           1           1           1           1           1   1
##      AGE
## RAD   45.09999847 45.40000153 45.59999847 45.70000076 45.79999924
##   1             0           0           0           0           0
##   2             0           0           0           0           0
##   3             1           0           0           0           1
##   4             0           0           0           1           0
##   5             0           1           0           0           1
##   6             0           0           1           0           0
##   7             0           0           0           0           0
##   8             0           0           0           0           0
##   24            0           0           0           0           0
##   Sum           1           1           1           1           2
##      AGE
## RAD   46.29999924 46.70000076 47.20000076 47.40000153 47.59999847  48
##   1             0           0           0           0           0   0
##   2             0           0           0           0           0   0
##   3             0           0           0           0           1   1
##   4             0           1           0           0           0   0
##   5             1           0           1           1           0   0
##   6             0           0           0           0           0   0
##   7             0           0           0           0           0   0
##   8             0           0           1           0           0   0
##   24            0           0           0           0           0   0
##   Sum           1           1           2           1           1   1
##      AGE
## RAD   48.20000076 48.5  49 49.09999847 49.29999924 49.70000076 49.90000153
##   1             0    0   0           0           1           0           0
##   2             0    0   0           0           0           0           0
##   3             0    1   0           0           0           0           0
##   4             0    0   1           0           0           0           0
##   5             0    0   0           0           0           1           1
##   6             0    0   0           0           0           0           0
##   7             0    0   0           1           0           0           0
##   8             0    0   0           0           0           0           0
##   24            1    0   0           0           0           0           0
##   Sum           1    1   1           1           1           1           1
##      AGE
## RAD    51 51.79999924 51.90000153 52.29999924 52.5 52.59999847 52.79999924
##   1     0           0           0           0    0           0           0
##   2     0           0           0           0    0           0           0
##   3     0           1           0           1    0           0           0
##   4     1           0           0           0    1           0           1
##   5     0           0           0           1    0           1           0
##   6     0           0           0           0    0           0           0
##   7     0           0           0           0    0           0           0
##   8     0           0           0           0    0           0           0
##   24    0           0           1           0    0           0           0
##   Sum   1           1           1           2    1           1           1
##      AGE
## RAD   52.90000153 53.20000076 53.59999847 53.70000076 53.79999924  54
##   1             0           0           0           0           0   0
##   2             0           0           0           0           0   0
##   3             0           0           1           0           0   0
##   4             0           0           1           0           1   0
##   5             0           0           0           1           0   0
##   6             1           0           0           0           0   1
##   7             0           0           0           0           0   0
##   8             0           0           0           0           0   0
##   24            0           1           0           0           0   0
##   Sum           1           1           2           1           1   1
##      AGE
## RAD   54.20000076 54.29999924 54.40000153  56 56.09999847 56.40000153 56.5
##   1             0           0           0   0           0           0    0
##   2             0           0           0   0           0           0    0
##   3             1           0           0   0           1           0    0
##   4             0           0           0   0           0           0    1
##   5             0           1           1   1           0           1    0
##   6             0           1           0   0           0           0    0
##   7             0           0           0   0           0           0    0
##   8             0           0           0   0           0           0    0
##   24            0           0           0   0           0           0    0
##   Sum           1           2           1   1           1           1    1
##      AGE
## RAD   56.70000076 56.79999924 57.79999924  58 58.09999847 58.40000153 58.5
##   1             0           0           0   0           0           0    0
##   2             0           0           1   0           0           0    0
##   3             0           1           0   0           0           1    0
##   4             0           0           0   1           0           0    0
##   5             0           0           0   0           0           0    1
##   6             0           0           0   0           0           0    0
##   7             0           0           0   0           1           0    0
##   8             0           0           0   0           0           0    0
##   24            1           0           0   0           0           0    0
##   Sum           1           1           1   1           1           1    1
##      AGE
## RAD   58.70000076 58.79999924 59.09999847 59.5 59.59999847 59.70000076
##   1             0           0           0    0           0           1
##   2             0           0           0    0           0           0
##   3             2           0           0    1           0           0
##   4             0           1           1    0           0           0
##   5             0           0           0    0           1           0
##   6             0           0           0    0           0           0
##   7             0           0           0    0           0           0
##   8             0           0           0    0           0           0
##   24            0           0           0    0           0           1
##   Sum           2           1           1    1           1           2
##      AGE
## RAD   61.09999847 61.40000153 61.5 61.79999924  62 62.20000076 62.5
##   1             0           0    0           0   0           0    0
##   2             1           0    0           0   0           0    1
##   3             0           0    1           0   1           1    0
##   4             0           0    0           1   0           0    0
##   5             0           1    0           0   0           0    0
##   6             0           0    0           0   0           0    0
##   7             0           0    0           0   0           0    0
##   8             0           0    1           0   0           0    0
##   24            0           0    0           0   0           0    0
##   Sum           1           1    2           1   1           1    1
##      AGE
## RAD   62.79999924  63 63.09999847 64.5 64.69999695 65.09999847 65.19999695
##   1             0   0           0    0           0           0           1
##   2             0   0           1    0           0           0           0
##   3             0   0           0    0           0           0           0
##   4             0   1           0    0           0           0           0
##   5             1   0           0    1           0           0           0
##   6             0   0           0    0           0           1           1
##   7             0   0           0    0           0           0           0
##   8             0   0           0    0           0           0           0
##   24            0   0           0    0           1           0           0
##   Sum           1   1           1    1           1           1           2
##      AGE
## RAD   65.30000305 65.40000153 66.09999847 66.19999695 66.5 66.59999847  67
##   1             0           0           0           0    0           0   0
##   2             0           0           1           0    0           0   0
##   3             0           0           0           0    0           0   0
##   4             0           0           0           0    0           0   0
##   5             0           0           0           0    0           1   1
##   6             1           0           0           0    0           0   0
##   7             0           0           0           0    0           0   0
##   8             0           0           0           1    1           0   0
##   24            0           1           0           0    0           0   0
##   Sum           1           1           1           1    1           1   1
##      AGE
## RAD   67.19999695 67.59999847 67.80000305 68.09999847 68.19999695
##   1             0           0           0           0           0
##   2             0           0           0           0           0
##   3             0           0           0           0           0
##   4             1           0           0           0           0
##   5             0           0           0           0           1
##   6             0           0           0           0           0
##   7             0           0           0           0           0
##   8             0           0           1           1           0
##   24            0           1           0           0           0
##   Sum           1           1           1           1           1
##      AGE
## RAD   68.69999695 68.80000305 69.09999847 69.5 69.59999847 69.69999695
##   1             0           0           1    0           0           0
##   2             0           0           0    0           1           1
##   3             0           1           0    0           0           0
##   4             0           0           0    1           0           0
##   5             1           0           0    0           0           0
##   6             0           0           0    0           0           0
##   7             0           0           0    0           0           0
##   8             0           0           0    0           0           0
##   24            0           0           0    0           0           0
##   Sum           1           1           1    1           1           1
##      AGE
## RAD   70.19999695 70.30000305 70.40000153 70.59999847  71 71.30000305
##   1             0           0           0           0   0           0
##   2             0           0           0           0   0           0
##   3             0           0           0           0   0           0
##   4             0           0           1           0   0           0
##   5             0           0           0           0   0           1
##   6             0           0           0           1   0           0
##   7             1           1           0           0   0           0
##   8             0           0           1           0   0           0
##   24            0           0           0           1   1           0
##   Sum           1           1           2           2   1           1
##      AGE
## RAD   71.59999847 71.69999695 71.90000153 72.5 72.69999695 72.90000153
##   1             0           0           0    0           0           0
##   2             0           0           0    0           0           0
##   3             0           0           0    0           0           0
##   4             0           1           0    0           1           0
##   5             0           0           0    0           0           0
##   6             0           0           0    1           0           1
##   7             0           0           1    0           0           0
##   8             1           0           0    0           0           0
##   24            0           0           0    0           0           0
##   Sum           1           1           1    1           1           1
##      AGE
## RAD   73.09999847 73.30000305 73.40000153 73.5 73.90000153 74.30000305
##   1             0           0           0    0           0           0
##   2             0           0           0    0           1           0
##   3             0           0           0    0           0           0
##   4             0           0           0    0           0           0
##   5             0           0           1    0           0           1
##   6             1           0           0    1           0           0
##   7             0           0           0    0           0           0
##   8             0           1           0    0           0           0
##   24            0           0           0    0           0           0
##   Sum           1           1           1    1           1           1
##      AGE
## RAD   74.40000153 74.5 74.80000305 74.90000153  75  76 76.5 76.69999695
##   1             0    0           0           0   0   0    0           1
##   2             0    0           0           0   0   1    0           0
##   3             0    0           0           0   0   0    0           0
##   4             0    0           0           0   0   0    0           1
##   5             1    1           0           0   0   0    0           0
##   6             0    0           0           0   0   0    0           0
##   7             0    0           0           0   0   0    1           0
##   8             0    0           0           0   0   0    1           0
##   24            0    0           1           1   1   0    1           0
##   Sum           1    1           1           1   1   1    3           2
##      AGE
## RAD   76.90000153  77 77.30000305 77.69999695 77.80000305 78.09999847
##   1             0   0           0           0           0           0
##   2             0   0           0           0           0           0
##   3             0   0           0           0           0           0
##   4             0   0           1           1           0           0
##   5             0   0           0           0           0           0
##   6             0   0           0           0           0           0
##   7             0   0           0           0           0           0
##   8             1   0           0           1           0           0
##   24            0   1           0           0           1           1
##   Sum           1   1           1           2           1           1
##      AGE
## RAD   78.30000305 78.69999695 78.90000153 79.19999695 79.69999695
##   1             0           0           0           0           0
##   2             0           0           1           0           0
##   3             0           0           0           0           0
##   4             0           0           0           0           0
##   5             0           0           0           1           0
##   6             0           0           0           0           1
##   7             0           0           0           1           0
##   8             1           0           0           0           0
##   24            0           1           0           0           0
##   Sum           1           1           1           2           1
##      AGE
## RAD   79.80000305 79.90000153 80.30000305 80.80000305 81.30000305
##   1             0           0           0           1           0
##   2             0           0           0           0           0
##   3             0           0           0           0           0
##   4             0           0           0           0           0
##   5             0           1           0           0           0
##   6             0           0           0           0           0
##   7             0           0           0           0           0
##   8             0           1           0           1           0
##   24            1           0           1           0           1
##   Sum           1           2           1           2           1
##      AGE
## RAD   81.59999847 81.69999695 81.80000305  82 82.5 82.59999847 82.80000305
##   1             0           0           0   0    0           0           0
##   2             0           0           0   0    0           0           0
##   3             0           0           0   0    0           0           0
##   4             0           1           0   1    1           0           1
##   5             0           0           1   0    0           1           0
##   6             1           0           0   0    0           1           0
##   7             0           0           0   0    0           0           0
##   8             0           0           0   0    0           0           0
##   24            0           0           0   0    1           0           0
##   Sum           1           1           1   1    2           2           1
##      AGE
## RAD   82.90000153  83 83.19999695 83.30000305 83.40000153 83.5 83.69999695
##   1             0   0           0           0           0    0           0
##   2             0   0           0           0           0    0           0
##   3             0   0           0           1           0    0           0
##   4             0   0           1           0           0    1           0
##   5             1   0           0           0           0    0           0
##   6             0   0           0           0           0    0           0
##   7             0   0           0           0           0    0           0
##   8             0   1           0           0           0    0           0
##   24            1   1           0           0           1    0           1
##   Sum           2   2           1           1           1    1           1
##      AGE
## RAD    84 84.09999847 84.19999695 84.40000153 84.5 84.59999847 84.69999695
##   1     0           0           0           0    0           0           0
##   2     0           1           0           0    0           0           0
##   3     0           0           0           0    0           0           0
##   4     0           0           0           0    1           0           0
##   5     0           1           0           0    0           1           0
##   6     0           0           1           0    0           0           0
##   7     0           0           0           0    0           0           0
##   8     0           0           0           0    0           0           0
##   24    1           0           0           1    0           0           1
##   Sum   1           2           1           1    1           1           1
##      AGE
## RAD   85.09999847 85.19999695 85.40000153 85.5 85.69999695 85.90000153
##   1             0           0           0    0           0           0
##   2             0           0           0    0           0           0
##   3             0           0           0    1           0           0
##   4             0           0           0    0           1           0
##   5             1           1           1    0           0           1
##   6             0           0           0    0           0           0
##   7             0           0           0    0           0           0
##   8             0           0           0    0           0           0
##   24            1           0           1    0           0           0
##   Sum           2           1           2    1           1           1
##      AGE
## RAD   86.09999847 86.30000305 86.5 86.90000153 87.30000305 87.40000153
##   1             0           0    0           0           0           0
##   2             0           1    0           0           0           0
##   3             0           0    0           0           0           0
##   4             0           0    0           0           2           0
##   5             0           0    0           1           0           1
##   6             0           0    0           0           0           0
##   7             0           0    0           0           0           0
##   8             0           0    1           0           0           0
##   24            1           0    1           0           0           0
##   Sum           1           1    2           1           2           1
##      AGE
## RAD   87.59999847 87.90000153  88 88.19999695 88.40000153 88.5 88.59999847
##   1             0           0   0           0           0    0           0
##   2             0           0   0           0           1    0           0
##   3             0           0   0           0           0    0           0
##   4             0           0   0           0           0    0           1
##   5             0           0   1           0           0    1           0
##   6             0           0   0           1           0    0           0
##   7             0           0   0           0           0    0           0
##   8             0           0   0           0           0    1           0
##   24            1           4   2           0           1    0           0
##   Sum           1           4   3           1           2    2           1
##      AGE
## RAD   88.80000305  89 89.09999847 89.19999695 89.30000305 89.40000153 89.5
##   1             0   0           0           0           1           0    0
##   2             0   0           0           0           0           0    0
##   3             0   0           0           0           0           0    0
##   4             1   0           0           1           0           0    0
##   5             0   0           0           0           0           1    0
##   6             0   0           0           0           0           0    0
##   7             0   0           0           0           0           0    0
##   8             0   0           0           0           0           0    0
##   24            0   1           1           0           0           0    1
##   Sum           1   1           1           1           1           1    1
##      AGE
## RAD   89.59999847 89.80000305 89.90000153  90 90.30000305 90.40000153
##   1             0           0           0   0           0           0
##   2             0           0           0   0           0           0
##   3             0           1           0   0           0           0
##   4             0           0           0   0           1           1
##   5             0           0           0   1           0           0
##   6             0           0           0   0           0           0
##   7             0           0           0   0           0           0
##   8             0           0           0   0           0           0
##   24            1           0           1   1           0           0
##   Sum           1           1           1   2           1           1
##      AGE
## RAD   90.69999695 90.80000305  91 91.09999847 91.19999695 91.30000305
##   1             0           0   1           0           0           0
##   2             0           0   0           0           0           0
##   3             0           0   0           0           0           0
##   4             0           0   0           0           0           0
##   5             0           1   0           0           1           0
##   6             0           0   0           0           0           0
##   7             0           0   0           0           0           0
##   8             0           0   0           0           0           1
##   24            1           1   1           1           1           0
##   Sum           1           2   2           1           2           1
##      AGE
## RAD   91.40000153 91.5 91.59999847 91.69999695 91.80000305 91.90000153
##   1             0    0           0           0           0           0
##   2             0    0           0           0           0           0
##   3             0    0           0           0           0           0
##   4             0    0           0           1           0           0
##   5             0    1           1           0           1           1
##   6             0    0           0           0           0           0
##   7             0    0           0           0           0           0
##   8             0    0           0           0           0           0
##   24            1    0           0           0           1           1
##   Sum           1    1           1           1           2           2
##      AGE
## RAD   92.09999847 92.19999695 92.40000153 92.59999847 92.69999695
##   1             0           0           0           0           0
##   2             0           0           0           0           0
##   3             0           1           0           0           0
##   4             1           0           0           0           1
##   5             0           0           1           1           0
##   6             0           0           0           0           0
##   7             0           0           0           0           0
##   8             0           0           0           0           0
##   24            0           0           1           2           0
##   Sum           1           1           2           3           1
##      AGE
## RAD   92.90000153  93 93.30000305 93.40000153 93.5 93.59999847 93.80000305
##   1             0   0           0           0    0           0           0
##   2             1   0           0           0    0           0           0
##   3             0   0           0           0    0           0           0
##   4             0   0           0           0    1           1           0
##   5             0   1           0           0    0           0           2
##   6             1   0           0           0    0           0           0
##   7             0   0           0           0    0           0           0
##   8             0   0           0           1    0           0           0
##   24            0   0           2           0    0           1           0
##   Sum           2   1           2           1    1           2           2
##      AGE
## RAD   93.90000153  94 94.09999847 94.30000305 94.40000153 94.5 94.59999847
##   1             0   0           0           0           0    0           0
##   2             0   0           0           0           0    0           0
##   3             0   0           0           0           0    0           0
##   4             0   0           2           0           1    0           0
##   5             1   1           0           1           0    1           1
##   6             0   0           0           0           0    0           0
##   7             0   0           0           0           0    0           0
##   8             0   0           0           0           0    0           0
##   24            1   0           1           1           0    1           1
##   Sum           2   1           3           2           1    2           2
##      AGE
## RAD   94.69999695 94.80000305 94.90000153  95 95.19999695 95.30000305
##   1             0           0           0   0           0           0
##   2             0           0           0   0           0           0
##   3             0           0           0   0           0           1
##   4             1           0           0   1           0           0
##   5             0           0           1   0           1           0
##   6             0           0           0   0           0           0
##   7             0           0           0   0           0           0
##   8             0           0           0   0           0           0
##   24            1           1           0   1           0           1
##   Sum           2           1           1   2           1           2
##      AGE
## RAD   95.40000153 95.59999847 95.69999695 95.80000305  96 96.09999847
##   1             0           0           0           0   0           0
##   2             0           1           0           1   0           0
##   3             0           1           0           0   0           0
##   4             1           0           0           0   1           0
##   5             0           0           1           0   1           2
##   6             1           0           0           0   0           0
##   7             0           0           0           0   0           0
##   8             0           0           0           0   0           0
##   24            2           1           0           0   2           0
##   Sum           4           3           1           1   4           2
##      AGE
## RAD   96.19999695 96.40000153 96.59999847 96.69999695 96.80000305
##   1             0           0           0           0           0
##   2             0           0           0           0           0
##   3             0           0           0           0           0
##   4             0           0           0           0           0
##   5             1           0           0           1           0
##   6             0           0           0           0           0
##   7             0           0           0           0           0
##   8             0           0           0           0           0
##   24            2           1           2           1           1
##   Sum           3           1           2           2           1
##      AGE
## RAD   96.90000153  97 97.09999847 97.19999695 97.30000305 97.40000153 97.5
##   1             0   0           0           0           0           0    0
##   2             0   1           0           0           0           0    0
##   3             0   0           0           0           0           0    0
##   4             1   0           0           0           0           0    0
##   5             0   0           1           0           2           1    0
##   6             0   0           0           0           0           0    0
##   7             0   0           0           0           0           0    0
##   8             0   0           0           0           0           0    0
##   24            0   2           0           1           1           2    1
##   Sum           1   3           1           1           3           3    1
##      AGE
## RAD   97.69999695 97.80000305 97.90000153  98 98.09999847 98.19999695
##   1             0           0           0   0           0           0
##   2             0           0           0   0           0           0
##   3             0           0           0   0           0           0
##   4             1           0           2   1           1           2
##   5             0           1           0   0           0           1
##   6             0           0           0   0           0           0
##   7             0           0           0   0           0           0
##   8             0           0           0   0           0           0
##   24            0           0           2   0           1           1
##   Sum           1           1           4   1           2           4
##      AGE
## RAD   98.30000305 98.40000153 98.5 98.69999695 98.80000305 98.90000153
##   1             0           0    0           0           0           0
##   2             0           0    0           0           0           0
##   3             0           0    0           0           0           0
##   4             1           2    0           0           2           1
##   5             0           0    1           0           0           0
##   6             0           0    0           0           0           0
##   7             0           0    0           0           0           0
##   8             0           0    0           0           0           0
##   24            1           0    0           1           2           2
##   Sum           2           2    1           1           4           3
##      AGE
## RAD   99.09999847 99.30000305 100 Sum
##   1             0           0   0  20
##   2             0           0   0  24
##   3             0           0   0  38
##   4             0           0   4 110
##   5             0           0  10 115
##   6             0           0   0  26
##   7             0           0   0  17
##   8             0           0   0  24
##   24            1           1  29 132
##   Sum           1           1  43 506
boxplot(Boston.df$CRIM, main =" Crime rate distribution in Boston")

boxplot(Boston.df$ZN, main="Proportion of residential land zoned for lots over 25,000 sq.ft in Boston ")

boxplot(Boston.df$INDUS, main = "Proportion of nonretail business acres per town in Boston")

boxplot(Boston.df$CHAS, main = "Charles River Dummy variable")

boxplot(Boston.df$NOX, main = "Nitric oxides Concentration in Boston(parts per million)")

boxplot(Boston.df$RM, main = "Average number of rooms per dwelling in Boston")

boxplot(Boston.df$AGE,main = "Proption of owner-occupied units built prior to 1940 in Boston")

boxplot(Boston.df$DIS, main ="weighted distances to five Boston employment centres")

boxplot(Boston.df$RAD, main = "Index of accessibility to radial highways in Boston")

boxplot(Boston.df$TAX, main = "Full-value property-tax rate per $10,000 in Boston")

boxplot(Boston.df$PT, main ="Pupil-teacher Ration by town")

boxplot(Boston.df$B, main ="1000(BK - 0.063)^2 where Bk is the proportion of blacks by town")

boxplot(Boston.df$LSTAT, main = "% of lower status of the population")

library(lattice)
histogram(~CRIM, data = Boston.df, main = "Crime Distribution in Boston city", xlab = "CRIME RATE in Boston")

histogram(~NOX, data = Boston.df, main = "Nitric Oxide Concentration in Boston city", xlab = "Nitric oxide concentration in Boston")

histogram(~DIS, data = Boston.df, main = "Pupil-teacher Concentration in Boston city", xlab = "Pupil-teacher concentration in Boston")

histogram(~LSTAT, data = Boston.df, main = "Lower status of population in Boston city", xlab = "Lower status population in Boston")

histogram(~RM, data = Boston.df, main = "Average number of rooms per dwelling in Boston city", xlab = "Average number of rooms per dwelling in Boston")

histogram(~B, data = Boston.df, main = "Median value of owner-occupied homes in $1000's Boston city", xlab = "Average number of rooms per dwelling in Boston")

plot(Boston.df[,c(3,5,6,11,13,14)],pch =3)

library(corrplot)
## Warning: package 'corrplot' was built under R version 3.4.2
## corrplot 0.84 loaded
colnames(Boston.df)
##  [1] "CRIM"  "ZN"    "INDUS" "CHAS"  "NOX"   "RM"    "AGE"   "DIS"  
##  [9] "RAD"   "TAX"   "PT"    "B"     "LSTAT" "MV"
datacolumns <- Boston.df[, c("CRIM","ZN","INDUS","CHAS","NOX","RM","AGE","DIS","RAD","TAX","PT","B","LSTAT","MV")]
N <-cor(datacolumns)
corrplot(N, method = "circle")

library(corrgram)
corrgram(Boston.df, order = TRUE,upper.panel = panel.pie)

data(Boston.df)
## Warning in data(Boston.df): data set 'Boston.df' not found
my_data <- Boston.df[,c(3,5,6,11,13,14)]
head(my_data, 6)
##   INDUS   NOX    RM   PT LSTAT   MV
## 1  2.31 0.538 6.575 15.3  4.98 24.0
## 2  7.07 0.469 6.421 17.8  9.14 21.6
## 3  7.07 0.469 7.185 17.8  4.03 34.7
## 4  2.18 0.458 6.998 18.7  2.94 33.4
## 5  2.18 0.458 7.147 18.7  5.33 36.2
## 6  2.18 0.458 6.430 18.7  5.21 28.7
res <-cor(my_data)
round(res, 2)
##       INDUS   NOX    RM    PT LSTAT    MV
## INDUS  1.00  0.76 -0.39  0.38  0.60 -0.48
## NOX    0.76  1.00 -0.30  0.19  0.59 -0.43
## RM    -0.39 -0.30  1.00 -0.36 -0.61  0.70
## PT     0.38  0.19 -0.36  1.00  0.37 -0.51
## LSTAT  0.60  0.59 -0.61  0.37  1.00 -0.74
## MV    -0.48 -0.43  0.70 -0.51 -0.74  1.00
library(car)
## Warning: package 'car' was built under R version 3.4.3
## 
## Attaching package: 'car'
## The following object is masked from 'package:psych':
## 
##     logit
pairs(~CRIM+ZN+INDUS+CHAS+NOX+RM+AGE+DIS+RAD+TAX+PT+B+LSTAT, data =Boston.df, main ="Simple sctterplot matrix for Boston Housing prediction")

cor.test(Boston.df$CRIM,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$CRIM and Boston.df$MV
## t = -9.4597, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4599064 -0.3116859
## sample estimates:
##        cor 
## -0.3883046
cor.test(Boston.df$ZN,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$ZN and Boston.df$MV
## t = 8.6751, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2821414 0.4339786
## sample estimates:
##       cor 
## 0.3604453
cor.test(Boston.df$INDUS,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$INDUS and Boston.df$MV
## t = -12.408, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5477957 -0.4140137
## sample estimates:
##        cor 
## -0.4837252
cor.test(Boston.df$CHAS,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$CHAS and Boston.df$MV
## t = 3.9964, df = 504, p-value = 7.391e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.08945817 0.25848001
## sample estimates:
##       cor 
## 0.1752602
cor.test(Boston.df$RM,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$RM and Boston.df$MV
## t = 21.722, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.6474346 0.7378074
## sample estimates:
##       cor 
## 0.6953599
cor.test(Boston.df$NOX,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$NOX and Boston.df$MV
## t = -10.611, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4960135 -0.3533126
## sample estimates:
##        cor 
## -0.4273208
cor.test(Boston.df$AGE,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$AGE and Boston.df$MV
## t = -9.1366, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4493580 -0.2996314
## sample estimates:
##        cor 
## -0.3769546
cor.test(Boston.df$DIS,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$DIS and Boston.df$MV
## t = 5.7948, df = 504, p-value = 1.207e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1663849 0.3299100
## sample estimates:
##       cor 
## 0.2499287
cor.test(Boston.df$RAD,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$RAD and Boston.df$MV
## t = -9.269, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4537021 -0.3045900
## sample estimates:
##        cor 
## -0.3816262
cor.test(Boston.df$TAX,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$TAX and Boston.df$MV
## t = -11.906, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5338993 -0.3976061
## sample estimates:
##        cor 
## -0.4685359
cor.test(Boston.df$PT,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$PT and Boston.df$MV
## t = -13.233, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5697371 -0.4400981
## sample estimates:
##        cor 
## -0.5077867
cor.test(Boston.df$B,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$B and Boston.df$MV
## t = 7.9407, df = 504, p-value = 1.318e-14
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2536655 0.4087483
## sample estimates:
##       cor 
## 0.3334608
cor.test(Boston.df$LSTAT,Boston.df$MV)
## 
##  Pearson's product-moment correlation
## 
## data:  Boston.df$LSTAT and Boston.df$MV
## t = -24.528, df = 504, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.7749982 -0.6951959
## sample estimates:
##        cor 
## -0.7376627
t.test(Boston.df$CRIM,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$CRIM and Boston.df$MV
## t = -33.796, df = 1005.5, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -20.01781 -17.82076
## sample estimates:
## mean of x mean of y 
##  3.613524 22.532806
t.test(Boston.df$ZN,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$ZN and Boston.df$MV
## t = -10.022, df = 658.35, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -13.35760  -8.98074
## sample estimates:
## mean of x mean of y 
##  11.36364  22.53281
t.test(Boston.df$INDUS,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$INDUS and Boston.df$MV
## t = -22.342, df = 934.12, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -12.39706 -10.39499
## sample estimates:
## mean of x mean of y 
##  11.13678  22.53281
t.test(Boston.df$CHAS,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$CHAS and Boston.df$MV
## t = -54.921, df = 505.77, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -23.26722 -21.66005
## sample estimates:
##   mean of x   mean of y 
##  0.06916996 22.53280636
t.test(Boston.df$RM,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$RM and Boston.df$MV
## t = -39.625, df = 510.89, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -17.05377 -15.44258
## sample estimates:
## mean of x mean of y 
##  6.284634 22.532806
t.test(Boston.df$NOX,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$NOX and Boston.df$MV
## t = -53.75, df = 505.16, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -22.78145 -21.17477
## sample estimates:
##  mean of x  mean of y 
##  0.5546951 22.5328064
t.test(Boston.df$AGE,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$AGE and Boston.df$MV
## t = 34.974, df = 611.61, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  43.45674 48.62744
## sample estimates:
## mean of x mean of y 
##  68.57490  22.53281
t.test(Boston.df$DIS,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$DIS and Boston.df$MV
## t = -44.673, df = 557.8, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -19.56164 -17.91389
## sample estimates:
## mean of x mean of y 
##  3.795043 22.532806
t.test(Boston.df$RAD,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$RAD and Boston.df$MV
## t = -23.06, df = 1007, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -14.08824 -11.87855
## sample estimates:
## mean of x mean of y 
##  9.549407 22.532806
t.test(Boston.df$TAX,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$TAX and Boston.df$MV
## t = 51.403, df = 508.01, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  370.9626 400.4461
## sample estimates:
## mean of x mean of y 
## 408.23715  22.53281
t.test(Boston.df$PT,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$PT and Boston.df$MV
## t = -9.707, df = 560.79, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -4.902309 -3.252236
## sample estimates:
## mean of x mean of y 
##  18.45553  22.53281
t.test(Boston.df$B,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$B and Boston.df$MV
## t = 81.916, df = 515.25, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  326.1275 342.1549
## sample estimates:
## mean of x mean of y 
## 356.67403  22.53281
t.test(Boston.df$LSTAT,Boston.df$MV)
## 
##  Welch Two Sample t-test
## 
## data:  Boston.df$LSTAT and Boston.df$MV
## t = -19.086, df = 951.59, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -10.895584  -8.863902
## sample estimates:
## mean of x mean of y 
##  12.65306  22.53281

We see that the number of rooms RM has the strongest positive correlation with the median value of the housing price, while the percentage of lower status population, LSTAT and the pupil-teacher ratio, PTRATIO, have strong negative correlation. The feature with the least correlation to MEDV is the proximity to Charles River, CHAS.