Modeling Rent in India

Project M5120

Eva Kopřivová, Lucy Alexandra Mega, Aneta Minibergerová

Data

str(data)
## 'data.frame':    2295 obs. of  7 variables:
##  $ Rent             : num  7500 26000 10000 25000 5000 6500 5500 8500 40000 11000 ...
##  $ Size             : num  850 800 1000 1200 400 ...
##  $ BHK              : num  2 2 2 3 1 1 1 3 3 2 ...
##  $ Furnishing.Status: chr  "Unfurnished" "Unfurnished" "Semi-Furnished" "Semi-Furnished" ...
##  $ Bathroom.cat     : Factor w/ 4 levels "1","2","3","4+": 1 2 2 2 1 1 1 2 2 1 ...
##  $ Mumbai           : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...
##  $ Point.of.Contact : chr  "Contact Owner" "Contact Agent" "Contact Owner" "Contact Agent" ...
summary(data)
##       Rent             Size           BHK        Furnishing.Status 
##  Min.   :  1200   Min.   :  10   Min.   :1.000   Length:2295       
##  1st Qu.: 13000   1st Qu.: 590   1st Qu.:2.000   Class :character  
##  Median : 25000   Median : 850   Median :2.000   Mode  :character  
##  Mean   : 49971   Mean   :1017   Mean   :2.215                     
##  3rd Qu.: 55000   3rd Qu.:1250   3rd Qu.:3.000                     
##  Max.   :850000   Max.   :7000   Max.   :6.000                     
##  Bathroom.cat   Mumbai        Point.of.Contact  
##  1 : 586      Mode :logical   Length:2295       
##  2 :1067      FALSE:1475      Class :character  
##  3 : 467      TRUE :820       Mode  :character  
##  4+: 175                                        
##                                                 
## 

median(data$Rent) 
## [1] 25000

##              Rent              Size               BHK Furnishing.Status 
##              TRUE              TRUE              TRUE             FALSE 
##      Bathroom.cat            Mumbai  Point.of.Contact 
##             FALSE             FALSE             FALSE

Model 1

model1 <- lm(Rent ~ Mumbai + Size, data = data)
summary(model1)
## 
## Call:
## lm(formula = Rent ~ Mumbai + Size, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -135559  -27119   -4887   16223  614721 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -40498.581   2069.882  -19.57   <2e-16 ***
## MumbaiTRUE   71739.651   2160.792   33.20   <2e-16 ***
## Size            63.762      1.528   41.72   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 49420 on 2292 degrees of freedom
## Multiple R-squared:  0.5335, Adjusted R-squared:  0.5331 
## F-statistic:  1311 on 2 and 2292 DF,  p-value: < 2.2e-16

Model 2

mod2 <- lm(Rent ~ Mumbai + Size + Bathroom.cat + Furnishing.Status, data = data)
summary(mod2)
## 
## Call:
## lm(formula = Rent ~ Mumbai + Size + Bathroom.cat + Furnishing.Status, 
##     data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -155495  -19096    -299   11437  590794 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      -2048.395   3379.953  -0.606  0.54455    
## MumbaiTRUE                       58765.919   2192.653  26.801  < 2e-16 ***
## Size                                37.578      2.239  16.785  < 2e-16 ***
## Bathroom.cat2                    -5320.915   2520.698  -2.111  0.03489 *  
## Bathroom.cat3                     9440.697   3603.791   2.620  0.00886 ** 
## Bathroom.cat4+                   95144.316   5964.267  15.952  < 2e-16 ***
## Furnishing.StatusSemi-Furnished -14651.547   2760.772  -5.307 1.22e-07 ***
## Furnishing.StatusUnfurnished    -19123.738   2884.007  -6.631 4.15e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 45140 on 2287 degrees of freedom
## Multiple R-squared:  0.6116, Adjusted R-squared:  0.6104 
## F-statistic: 514.4 on 7 and 2287 DF,  p-value: < 2.2e-16

## 
##  Shapiro-Wilk normality test
## 
## data:  rstandard(mod2)
## W = 0.69171, p-value < 2.2e-16

Model 3

mod3 <- lm(log(Rent) ~ Mumbai + Size + Bathroom.cat 
     + Furnishing.Status, data = data)
summary(mod3)
## 
## Call:
## lm(formula = log(Rent) ~ Mumbai + Size + Bathroom.cat + Furnishing.Status, 
##     data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.8749 -0.2884 -0.0133  0.2816  3.6786 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      9.095e+00  3.545e-02  256.58  < 2e-16 ***
## MumbaiTRUE                       1.135e+00  2.299e-02   49.38  < 2e-16 ***
## Size                             4.981e-04  2.348e-05   21.22  < 2e-16 ***
## Bathroom.cat2                    3.856e-01  2.643e-02   14.59  < 2e-16 ***
## Bathroom.cat3                    8.242e-01  3.779e-02   21.81  < 2e-16 ***
## Bathroom.cat4+                   1.200e+00  6.255e-02   19.18  < 2e-16 ***
## Furnishing.StatusSemi-Furnished -1.755e-01  2.895e-02   -6.06 1.59e-09 ***
## Furnishing.StatusUnfurnished    -3.274e-01  3.024e-02  -10.82  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4734 on 2287 degrees of freedom
## Multiple R-squared:  0.7827, Adjusted R-squared:  0.782 
## F-statistic:  1177 on 7 and 2287 DF,  p-value: < 2.2e-16

Interpretation of log-transformation?

AIC and BIC comparison

AIC(mod2)
## [1] 55716.77
BIC(mod2)
## [1] 55768.42
AIC(mod3)
## [1] 3090.74
BIC(mod3) 
## [1] 3142.386

Model 4

model4 <- lm(log(Rent) ~ Mumbai + Size + Bathroom.cat 
     + Furnishing.Status + Mumbai:Size, data = data)
summary(model4)
## 
## Call:
## lm(formula = log(Rent) ~ Mumbai + Size + Bathroom.cat + Furnishing.Status + 
##     Mumbai:Size, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.8152 -0.2847 -0.0182  0.2698  3.6572 
## 
## Coefficients:
##                                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      9.1148712  0.0351611 259.232  < 2e-16 ***
## MumbaiTRUE                       0.9021330  0.0393602  22.920  < 2e-16 ***
## Size                             0.0004771  0.0000234  20.391  < 2e-16 ***
## Bathroom.cat2                    0.3878752  0.0261426  14.837  < 2e-16 ***
## Bathroom.cat3                    0.7885508  0.0376937  20.920  < 2e-16 ***
## Bathroom.cat4+                   1.0416204  0.0655743  15.885  < 2e-16 ***
## Furnishing.StatusSemi-Furnished -0.1588374  0.0287217  -5.530 3.56e-08 ***
## Furnishing.StatusUnfurnished    -0.3084501  0.0300222 -10.274  < 2e-16 ***
## MumbaiTRUE:Size                  0.0002629  0.0000362   7.262 5.20e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4682 on 2286 degrees of freedom
## Multiple R-squared:  0.7876, Adjusted R-squared:  0.7868 
## F-statistic:  1059 on 8 and 2286 DF,  p-value: < 2.2e-16
anova(mod3, model4)
## Analysis of Variance Table
## 
## Model 1: log(Rent) ~ Mumbai + Size + Bathroom.cat + Furnishing.Status
## Model 2: log(Rent) ~ Mumbai + Size + Bathroom.cat + Furnishing.Status + 
##     Mumbai:Size
##   Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
## 1   2287 512.60                                  
## 2   2286 501.04  1    11.559 52.737 5.204e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
AIC(mod3)
## [1] 3090.74
AIC(model4) 
## [1] 3040.397

Levarage points

data[c(2104,1557,995),]
##        Rent Size BHK Furnishing.Status Bathroom.cat Mumbai Point.of.Contact
## 4077   1200 2100   3         Furnished            3  FALSE    Contact Owner
## 2657 190000  200   5       Unfurnished           4+  FALSE    Contact Agent
## 1385 600000 4500   5         Furnished           4+   TRUE    Contact Agent