R Markdown

head(data)
##   ID city area rooms bathroom parking    animal     furniture floor rentAmount
## 1  0    1  240     3        3       4     acept     furnished     6      8,000
## 2  1    0   64     2        1       1     acept not furnished    10        820
## 3  2    1  443     5        5       4     acept     furnished     3      7,000
## 4  3    1   73     2        2       1     acept not furnished    12      1,250
## 5  4    1   19     1        1       0 not acept not furnished     6      1,200
## 6  5    1   13     1        1       0     acept not furnished     2      2,200
##   fireInsurance   hoa propertyTax
## 1           121     0       1,000
## 2            11   540         122
## 3            89 4,172       1,417
## 4            16   700         150
## 5            16     0          41
## 6            28     0          42
summary(data)
##        ID            city             area             rooms       
##  Min.   :   0   Min.   :0.0000   Min.   :   10.0   Min.   : 1.000  
##  1st Qu.:1520   1st Qu.:1.0000   1st Qu.:   58.0   1st Qu.: 2.000  
##  Median :3040   Median :1.0000   Median :  100.0   Median : 3.000  
##  Mean   :3040   Mean   :0.8633   Mean   :  151.1   Mean   : 2.493  
##  3rd Qu.:4559   3rd Qu.:1.0000   3rd Qu.:  200.0   3rd Qu.: 3.000  
##  Max.   :6079   Max.   :1.0000   Max.   :24606.0   Max.   :10.000  
##     bathroom         parking          animal           furniture        
##  Min.   : 1.000   Min.   : 0.000   Length:6080        Length:6080       
##  1st Qu.: 1.000   1st Qu.: 1.000   Class :character   Class :character  
##  Median : 2.000   Median : 1.000   Mode  :character   Mode  :character  
##  Mean   : 2.342   Mean   : 1.756                                        
##  3rd Qu.: 3.000   3rd Qu.: 2.000                                        
##  Max.   :10.000   Max.   :12.000                                        
##      floor         rentAmount        fireInsurance       hoa           
##  Min.   : 1.000   Length:6080        Min.   :  3.0   Length:6080       
##  1st Qu.: 4.000   Class :character   1st Qu.: 23.0   Class :character  
##  Median : 6.000   Mode  :character   Median : 41.0   Mode  :character  
##  Mean   : 7.207                      Mean   : 58.2                     
##  3rd Qu.: 9.000                      3rd Qu.: 77.0                     
##  Max.   :99.000                      Max.   :677.0                     
##  propertyTax       
##  Length:6080       
##  Class :character  
##  Mode  :character  
##                    
##                    
## 

Linear Regession

data$propertyTax <- as.numeric(gsub("\\.", "", data$propertyTax))
## Warning: NAs introduced by coercion
data$rentAmount <- as.numeric(gsub("\\.", "", data$rentAmount))
## Warning: NAs introduced by coercion
linear.model = lm(rentAmount~propertyTax, data = data)  # build linear regression model on full data
summary(linear.model)
## 
## Call:
## lm(formula = rentAmount ~ propertyTax, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -363.46  -82.75   25.21  117.27  216.51 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 7.825e+02  1.076e+01  72.721   <2e-16 ***
## propertyTax 3.723e-03  1.805e-01   0.021    0.984    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 140.8 on 299 degrees of freedom
##   (5779 observations deleted due to missingness)
## Multiple R-squared:  1.423e-06,  Adjusted R-squared:  -0.003343 
## F-statistic: 0.0004255 on 1 and 299 DF,  p-value: 0.9836