Data Wrangling

  1. Wczytanie danych i wyświetlenie
id city type squareMeters rooms
727a1427f156535fc0531e59a27e7988 szczecin blockOfFlats 34.00 1
a640ac5f62cce4d6806a7b7d73b5cd52 szczecin apartmentBuilding 39.00 2
40cb3c6185236a3e4f136641ab7099a4 szczecin apartmentBuilding 47.00 2
4f9fd13b91ba19534fc3db3fc93fa392 szczecin blockOfFlats 28.00 1
f14a3f2d0d1d1a8ec896e9587d2c9760 szczecin blockOfFlats 46.70 2
ffab4c61e84e7db6f8463cd54f063d74 szczecin blockOfFlats 47.55 2
96c00429abefa4106839308ec7ed583c szczecin NA 71.00 3
ed78ca4227139d1c315f77fefe5057d9 szczecin apartmentBuilding 47.00 2
7b4e4b5bf7a8961e85866933a25f7558 szczecin tenement 51.92 3
ae7c68136c6e6d48de9813576fe100d5 szczecin apartmentBuilding 58.66 2
5b19ddba129f30e8bb8ddc229bfba94d szczecin blockOfFlats 47.10 2
3bd174c07f4421de5944a81ce99d55bd szczecin apartmentBuilding 65.00 2
a30d24cc16d45c7490b663439e315b4f szczecin NA 35.70 2
3ac22f3a833b2897e4822688443e9e40 szczecin blockOfFlats 48.35 2
a6dab00b051818490767d45ad2e32b94 szczecin blockOfFlats 47.50 2
071386970ab38fe50093eebdf4b911f9 szczecin NA 38.00 2
7d90f1d548f53c8ab40363a36ce782ce szczecin blockOfFlats 47.68 2
c1bb0592e89ff7f821bec51a4e7a91c1 szczecin apartmentBuilding 64.00 3
04125be3a2a06e0290338496ec7b3aec szczecin NA 38.00 2
f1a8fd415fb78723fb7591c1821eeb19 szczecin blockOfFlats 35.00 2
becf991d7348cd4f1de25d6704f05eb3 szczecin apartmentBuilding 28.16 1
35e6a9d438ee83c4746161321e5a8dec szczecin NA 53.40 4
2738b1ff4036611262b9d221c9717195 szczecin apartmentBuilding 39.00 2
4bce3a89d7038f503d63557acb794de3 szczecin blockOfFlats 57.00 3
7949813676709732ab7955fdce822af8 szczecin blockOfFlats 37.00 2
d5cb22914efed08b52450dc8defd133d szczecin apartmentBuilding 47.90 2
886049efb66197c117cdc5e056c7459d szczecin NA 42.00 2
dafd7be49c765e50ce19c4e174ff8b34 szczecin NA 42.00 2
cf74cebe24c137cfa234860b85b5cd44 szczecin blockOfFlats 48.30 3
8d9ad7ea2bc195124a1878918cfc8b44 szczecin blockOfFlats 32.00 1
6ca04498446cba01735e370e2b8372cb szczecin blockOfFlats 39.95 2
8f3de06540c0e014239da125113d24ca szczecin blockOfFlats 39.00 2
dd850d435bdc1584a3c2d36f72de84c7 szczecin apartmentBuilding 43.00 2
528af8b64101835e1cff90b894bde4dc szczecin blockOfFlats 45.80 2
444964cb2f78edfaaef4f9dd8005fe63 szczecin blockOfFlats 57.30 2
53aa4f12b7a3accd00a1fcf705de1d98 szczecin tenement 26.00 1
ccaf50212bbef1e41b60137e7ba16144 szczecin blockOfFlats 60.00 3
501fa815814f27ab728e264fb3eaf29f szczecin tenement 54.00 2
213971e2e8156e434bc965a2fd31126a szczecin blockOfFlats 47.50 2
1434d5f6bdbff4cb3015e9503eb9d4ad szczecin tenement 49.50 2
c5994e1a3b33b4759e4e036abe36b65c szczecin tenement 81.04 4
bd0df9e50b9b8c132f335811c1789e2d szczecin blockOfFlats 50.00 2
2ff1a7a847124e32e34a348d6e4de002 szczecin NA 32.00 1
96433eb04954b87642036ead6fc91440 szczecin NA 51.65 2
a9b102a2835c29c475838ed0e169ba91 szczecin tenement 80.00 3
b72016618efdbe64f8bee9f3e30f5e53 szczecin blockOfFlats 44.00 2
2b71e4bb55c30a245fa69ea70a38f28c szczecin blockOfFlats 32.42 1
dcc5d2c661f1c4bb4b25be337039a6da szczecin blockOfFlats 54.00 3
29538bbf4be725b8cdc5ea3c4ed44d00 szczecin NA 31.00 2
9f964398451fe3dfef1418aea2d2768e szczecin apartmentBuilding 58.00 2
55c9a4056989ba2fa833283fb823f7d3 szczecin apartmentBuilding 31.00 1
1ba9277796daaa21b0c4ead2ce3c0196 szczecin NA 43.24 2
be1283ee2beab0f903f76ad8ff78017e szczecin NA 52.00 2
8395c3302cef8ffb0ad1b3cee7544a12 szczecin NA 48.00 2
1aedec05fcd08a036eec1bf830430e8a szczecin blockOfFlats 57.35 2
10f1e47ca6fcb0d5cb64cf03c47aa4a1 szczecin blockOfFlats 74.00 3
6de674d83516952b34fe2e28f1334f66 szczecin tenement 33.14 2
985ecd766dd0ffc59c1c85058097ea6e szczecin blockOfFlats 30.00 2
3d5eac03b08fabc37bc2a66569e41e70 szczecin apartmentBuilding 38.00 2
8aa9cec23ff36577b30b3b8028e458e3 szczecin apartmentBuilding 34.80 2
d72f7c645fde09ba795d1d041172ad98 szczecin apartmentBuilding 60.00 3
ac423e46dfb427ac5ad72b7df0b7cfb4 szczecin blockOfFlats 38.00 2
f424764e0729f31c8d05cf62d5e0b994 szczecin blockOfFlats 32.00 1
fbb5e387c5b8886256b4573d9b42a7a7 szczecin blockOfFlats 64.00 2
adeac66fb76024c75e44ddf3b95bd613 szczecin blockOfFlats 26.28 1
73a7d2ae4496d8fb87a1ad06e04b5c3f szczecin NA 68.00 3
1b810cca34d3e59eee77a7d4b502729c szczecin NA 54.00 2
9f400b6ab569883ce07dbdf0c27a32d3 szczecin blockOfFlats 57.20 3
b0067f50eda6802dfdb2fed1fbbc081f szczecin blockOfFlats 64.50 3
74844a6986fb9980ce016930c559f6e2 szczecin NA 55.00 2
dc76cfc6bf6e3552f6ab42c7876cf2ca szczecin apartmentBuilding 38.28 2
f074ce2792f8c9d3628c8a35a096b8f8 szczecin apartmentBuilding 49.32 3
bd7ea41f76550e31f9991031ef5377f4 szczecin blockOfFlats 43.00 2
33ee57f94bb5ccc3d929a3c02e129d4f szczecin blockOfFlats 96.06 4
021d5b92d5e033606f262bc8d0b42dc2 szczecin apartmentBuilding 44.07 2
0e88a3acfe36c93579154625f4f6ea84 szczecin blockOfFlats 31.50 2
4098f80842918d271f96b3028509f12c szczecin blockOfFlats 36.49 2
cc8b6938e83cbe5a2d075e61b00b4686 szczecin tenement 27.00 1
90277a4363c70dbcdf6a7754cbf5e91e szczecin tenement 84.00 3
3ec26d55c7c43c56a9d3bebbaa50c393 szczecin NA 50.00 2
2170580a03fdc96b0c18edb0d6f0c0aa szczecin apartmentBuilding 47.50 2
925fd5d9ca18c18e2ab706ad5cd30852 szczecin blockOfFlats 44.00 2
007bedbaffb0fb85b37add2a3826c25a szczecin NA 68.50 3
2d5ef7eea7911dfbf2fff6c932ccc096 szczecin blockOfFlats 38.00 2
6684ebaaa368e6a540668dbbd1f4fbc6 szczecin blockOfFlats 42.54 2
64bfe4834a5c568853bad6671d4e6712 szczecin NA 43.14 2
a23ea738788540c387cd62d67606d94c szczecin NA 36.00 2
7262f626da9c77448c6861c80e0e3708 szczecin blockOfFlats 46.90 2
239c22d62a873d207e2cb679c40e376f szczecin apartmentBuilding 30.21 1
02e8aa8aa681ee2ba2e96cce03b618ef szczecin NA 32.00 1
30a45cdf5fddd090349b933eb6b746c9 szczecin blockOfFlats 37.91 2
fef85fa544f653998dbf84acef980d43 szczecin tenement 73.73 3
5ff6d712c9deb7e892edc9f5571d2825 szczecin blockOfFlats 38.00 2
393161dc838b0d27da3773c8662093c8 szczecin blockOfFlats 48.80 2
f350d84fe86740c75adb87fdaaec7216 szczecin blockOfFlats 80.00 3
7f60ba350f0108947b17989903b9456b szczecin tenement 25.20 1
467b4a9ff9628cbfaab4edabd11aa267 szczecin blockOfFlats 75.00 4
f05d32a6dc6cb79d25c5f6d418ad5aa6 szczecin blockOfFlats 59.20 3
bb0b323469b971f746a8a7cab57b1d7f szczecin blockOfFlats 79.00 3
354a217d8a25631c6f471bade17e2e4c szczecin apartmentBuilding 34.74 2

Zbiór danych zawiera 8849 obserwacji dotyczących wynajmu mieszkań w polskich miastach, do czynienia mamy ze zmiennymi:

Również występują zmienne dotyczące odległości obiektów od mieszkania, takie jak:

Znajdują się jeszcze zmienne opisujące wyposażenie poprzez wartość yes lub no:

  1. Walidacja Danych

Z wykresu ukazanego powyżej, widzimy braki wartości zmiennych poszczególnych obserwacji

  1. NA w danych

Największą ilość brakujących wartości widzimy w zmiennych:

  1. Czyszczenie danych
## [1] 15.00735

15% naszych danych zawiera braki

Niestety nasze reguły nie przyniosły oczekiwanych efektów 🙁

Wygenerowaliśmy heatmapę zmiennych, aby lepiej ukazać nasze braki Następnie wykorzystująć inputację uzupełniliśmy braki

  1. Imputacja NA dla kolumn z brakami
## 
##  iter imp variable
##   1   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
## * Impute missing values based on Multivariate Imputation by Chained Equations
##  - method : mice
##  - random seed : 41404
## 
## * Information of Imputation (before vs after)
##                     Original     Imputation  
## described_variables "value"      "value"     
## n                   "7796"       "8849"      
## na                  "1053"       "   0"      
## mean                "3.355439"   "3.259125"  
## sd                  "2.507566"   "2.402885"  
## se_mean             "0.02839988" "0.02554382"
## IQR                 "2"          "2"         
## skewness            "1.858029"   "1.973673"  
## kurtosis            "4.859323"   "5.564258"  
## p00                 "1"          "1"         
## p01                 "1"          "1"         
## p05                 "1"          "1"         
## p10                 "1"          "1"         
## p20                 "1"          "1"         
## p25                 "2"          "2"         
## p30                 "2"          "2"         
## p40                 "2"          "2"         
## p50                 "3"          "3"         
## p60                 "3"          "3"         
## p70                 "4"          "4"         
## p75                 "4"          "4"         
## p80                 "5"          "5"         
## p90                 "7"          "6"         
## p95                 "8"          "8"         
## p99                 "13"         "12"        
## p100                "20"         "20"

## 
##  iter imp variable
##   1   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
## * Impute missing values based on Multivariate Imputation by Chained Equations
##  - method : mice
##  - random seed : 20946
## 
## * Information of Imputation (before vs after)
##                     Original     Imputation  
## described_variables "value"      "value"     
## n                   "8694"       "8849"      
## na                  "155"        "  0"       
## mean                "5.586957"   "5.576495"  
## sd                  "3.245501"   "3.225370"  
## se_mean             "0.03480743" "0.03428723"
## IQR                 "3"          "3"         
## skewness            "1.832178"   "1.842998"  
## kurtosis            "5.359178"   "5.447052"  
## p00                 "1"          "1"         
## p01                 "1"          "1"         
## p05                 "2"          "2"         
## p10                 "3"          "3"         
## p20                 "3"          "3"         
## p25                 "4"          "4"         
## p30                 "4"          "4"         
## p40                 "4"          "4"         
## p50                 "5"          "5"         
## p60                 "5"          "5"         
## p70                 "6"          "6"         
## p75                 "7"          "7"         
## p80                 "8"          "8"         
## p90                 "10"         "10"        
## p95                 "12"         "11"        
## p99                 "17"         "17"        
## p100                "29"         "29"

## 
##  iter imp variable
##   1   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
## * Impute missing values based on Multivariate Imputation by Chained Equations
##  - method : mice
##  - random seed : 20563
## 
## * Information of Imputation (before vs after)
##                     Original    Imputation 
## described_variables "value"     "value"    
## n                   "6600"      "8849"     
## na                  "2249"      "   0"     
## mean                "1998.144"  "1996.765" 
## sd                  "30.78800"  "28.85502" 
## se_mean             "0.3789740" "0.3067428"
## IQR                 "37.0"      "36.6"     
## skewness            "-1.580934" "-1.487259"
## kurtosis            "1.815999"  "1.815498" 
## p00                 "1856"      "1856"     
## p01                 "1900"      "1900"     
## p05                 "1930.00"   "1934.68"  
## p10                 "1950.0"    "1954.4"   
## p20                 "1973"      "1975"     
## p25                 "1983.0"    "1981.4"   
## p30                 "2000.0"    "1991.2"   
## p40                 "2007"      "2002"     
## p50                 "2010"      "2008"     
## p60                 "2015"      "2012"     
## p70                 "2019.0"    "2016.6"   
## p75                 "2020"      "2018"     
## p80                 "2021"      "2020"     
## p90                 "2023"      "2022"     
## p95                 "2023"      "2023"     
## p99                 "2024"      "2024"     
## p100                "2024"      "2024"

## 
##  iter imp variable
##   1   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   1   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   2   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   3   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   4   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   1  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   2  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   3  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   4  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
##   5   5  floor  floorCount  buildYear  clinicDistance  postOfficeDistance  kindergartenDistance  restaurantDistance  collegeDistance  pharmacyDistance
## * Impute missing values based on Multivariate Imputation by Chained Equations
##  - method : mice
##  - random seed : 64485
## 
## * Information of Imputation (before vs after)
##                     Original    Imputation 
## described_variables "value"     "value"    
## n                   "6600"      "8849"     
## na                  "2249"      "   0"     
## mean                "1998.144"  "1996.589" 
## sd                  "30.78800"  "29.00513" 
## se_mean             "0.3789740" "0.3083385"
## IQR                 "37.0"      "37.4"     
## skewness            "-1.580934" "-1.463313"
## kurtosis            "1.815999"  "1.707016" 
## p00                 "1856"      "1856"     
## p01                 "1900"      "1900"     
## p05                 "1930"      "1934"     
## p10                 "1950.00"   "1953.56"  
## p20                 "1973"      "1974"     
## p25                 "1983.0"    "1980.6"   
## p30                 "2000.0"    "1990.2"   
## p40                 "2007"      "2002"     
## p50                 "2010"      "2008"     
## p60                 "2015"      "2012"     
## p70                 "2019.0"    "2016.4"   
## p75                 "2020"      "2018"     
## p80                 "2021"      "2020"     
## p90                 "2023"      "2022"     
## p95                 "2023"      "2023"     
## p99                 "2024"      "2024"     
## p100                "2024"      "2024"

Dla zmiennych opisujących odległość od obiektów zastosowaliśmy medianę

##   name items passes fails nNA error warning
## 1   V1  8849   7086  1361 402 FALSE   FALSE
##                                         expression
## 1 floorCount - 4 < -1e-08 | (hasElevator == "yes")

Wprowadziliśmy warunek w którym, jeżeli w budynku jest powyżej 4 kondygnacji, to budynek musi mieć windę

Przy pomocy wartości zmiennych w poszczególnych kolumnach, uzupełniliśmy w sposób losowy braki danych w nich występujące

Zbiór został uzupełniony z wszelakich braków, co ukazuje powyższy wykres

Wizualizacja danych

  1. Powierzchnia

Powyższy wykres przedstawia rozkład powierzchni mieszkań, gdzie najwięcej mieszkań posiada powierzchnię między 50 - 60 m²

  1. Liczba Pokoi

Na wykresie możemy zauważyć, że najwięcej mieszkań jest dwupokojowych

  1. Cena za wynajem vs Powierzchnia

Im większa powierzchnia mieszkania, tym wyższa cena wynajmu. Większe powierzchnie mają szerszy zakres cen wynajmu, co oznacza większą różnorodność w cenach dla większych mieszkań.

  1. Gęstość rozkładu ceny

  1. Cena vs Odległość

  1. Liczba mieszkań na wynajem i średnia cena najmu w miastach Polski

  1. Heatmapa korelacji zmiennych

  1. Gęstość rozkładu cen mieszkań

  1. Średnia cena w podziale na miasto i typ mieszkania

Warszawa dominuje w trzech kategoriach typu budynku, pod względem średniej ceny wynajmu mieszkania.

  1. Rozkład cech dla mieszkań

Większość mieszkań nie posiada ochrony i komórki lokatorskiej

Statystyki opisowe

  1. Mieszkania w Polsce - ceny wg liczby pokoi.
Tabela 1. Mieszkania w Polsce - ceny wg liczby pokoi.
Statystyka 1 pokój 2 pokoje 3 pokoje 4 pokoje 5 pokoi 6 pokoi
Min 415 449 750 780 2500 4000
Max 4809 10000 17000 19000 19500 18500
Kwartyl dolny 1800 2300 3122 4500 6000 8500
Mediana 2200 2800 4000 6500 7300 12000
Kwartyl górny 2500 3450 5500 9000 10000 15000
Średnia 2185.95 2947.73 4663.29 7223.48 8012.57 11657
Odch. std. 606.33 999.86 2302.24 3628.55 3170.26 3979.47
IQR 700 1150 2378 4500 4000 6500
Odchylenie ćwiartkowe 350 575 1189 2250 2000 3250
Odch. std. w % 0.28 0.34 0.49 0.5 0.4 0.34
Odch. ćwiartkowe w % 0.32 0.41 0.59 0.69 0.55 0.54
Skośność 0.77 1.48 1.78 1 0.71 -0.17
Kurtoza 1.83 4.75 4 0.52 0.37 -1.07
  1. Mieszkania w Polsce - ceny wg dekad
Tabela 2. Mieszkania w Polsce - ceny wg dekad.
Statystyka 1900-1909 1910-1919 1920-1929 1930-1939 1940-1949 1950-1959 1960-1969 1970-1979 1980-1989 1990-1999 2000-2009 2010-2019
Min 1500 1090 1430 1000 479 800 449 463 415 785 1100 1200
Max 19000 19500 17500 16000 12000 14999 14500 16000 14000 15000 18000 19000
Kwartyl dolny 2400 2750 2537.5 2800 2200 2499.5 2000 1800 1725 2000 2500 2600
Mediana 3000 4000 3500 3900 3200 3120 2500 2500 2300 2600 3450 3200
Kwartyl górny 4900 6000 4900 5500 4000 4200 3412.5 3000 2900 3990 5499.25 4300
Średnia 3951.9 4883.1 4566.8 4581.2 3456.1 3555.8 2920.9 2692.7 2649.9 3425.2 4465.3 3892.8
Odch. std. 2512.3 3362.8 3249.1 2651.4 1894.2 1891.8 1586.7 1451.5 1709.7 2239.2 2931.2 2308.1
IQR 2500 3250 2362.5 2700 1800 1700.5 1412.5 1200 1175 1990 2999.25 1700
Odchylenie ćwiartkowe 1250 1625 1181.25 1350 900 850.25 706.25 600 587.5 995 1499.62 850
Odch. std. w % 0.64 0.69 0.71 0.58 0.55 0.53 0.54 0.54 0.65 0.65 0.66 0.59
Odch. ćwiartkowe w % 0.83 0.81 0.68 0.69 0.56 0.55 0.56 0.48 0.51 0.77 0.87 0.53
Skośność 2.74 2.02 2.02 1.64 1.82 2.46 3.2 3.71 3.59 2.08 1.83 2.92
Kurtoza 11.91 5.02 4.12 3.08 4.26 9.41 15.36 24.15 16.96 4.76 3.34 10.89
  1. Mieszkania w Polsce - cena w poszczególnym metrażu.
Tabela 3. Mieszkania w Polsce - cena w poszczególnym metrażu.
Statystyka 20-40 40-60 60-80 80-100 100-120 120-140
Min 415 544 750 2300 2500 3000
Max 6000 8600 12500 16000 18000 19000
Kwartyl dolny 1950 2499 3300 4500 6000 7150
Mediana 2350 2900 4000 5925 7800 9875
Kwartyl górny 2800 3500 5494.5 7900 10900 12500
Średnia 2402.2 3054.3 4495.2 6272.9 8454.4 10149
Odch. std. 694.9 934 1769.6 2408 3407.3 3832.6
IQR 850 1001 2194.5 3400 4900 5350
Odchylenie ćwiartkowe 425 500.5 1097.25 1700 2450 2675
Odch. std. w % 0.29 0.31 0.39 0.38 0.4 0.38
Odch. ćwiartkowe w % 0.36 0.35 0.55 0.57 0.63 0.54
Skośność 0.69 1.05 1.33 0.94 0.74 0.38
Kurtoza 1.53 2.51 2.63 1.03 -0.12 -0.62

Macierz Koleracji

Metry kwadratowe wykazują silną pozytywną korelację z ceną, co oznacza, że większa powierzchnia mieszkania zazwyczaj wiąże się z wyższą ceną.

Liczba pokoi również ma znaczący wpływ na cenę, z dodatnią korelacją.

Korelacje między ceną a piętrem, na którym znajduje się mieszkanie, są słabe, co sugeruje, że piętro ma mniejszy wpływ na cenę.

Odległość do punktów zainteresowania, takich jak szkoły czy sklepy, ma niewielki wpływ na cenę.

Testy statystyczne

  1. Test normalności rozkładu cen Andersona-Darlinga
## 
##  Anderson-Darling normality test
## 
## data:  data$price
## A = 647.2, p-value < 2.2e-16

Przy tak niskiej wartości p, możemy odrzucić hipotezę zerową o normalności rozkładu danych (cen).

  1. Test t-Studenta dla cen mieszkań z parkingiem i bez # Tworzymy zmienną parking_binarny # 1 - mieszkania z parkingiem, 0 - bez parkingu
## 
##  Welch Two Sample t-test
## 
## data:  price by parking_binarny
## t = -7.1377, df = 7406.6, p-value = 1.039e-12
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -461.1609 -262.4331
## sample estimates:
## mean in group 0 mean in group 1 
##        3555.366        3917.163
  1. Test chi-kwadrat dla zmiennych kategorialnych i Zależność między posiadaniem parkingu a liczbą pokoi
## 
##  Pearson's Chi-squared test
## 
## data:  tablica_kontyngencji
## X-squared = 116.74, df = 5, p-value < 2.2e-16

Istnieje istotna zależność między posiadaniem parkingu a liczbą pokoi w mieszkaniach. To oznacza, że posiadanie parkingu jest związane z liczbą pokoi w sposób statystycznie istotny.

Modelowanie

  1. Regresja liniowa: jak powierzchnia wpływa na cenę?
## 
## Call:
## lm(formula = price ~ squareMeters, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6715.3  -799.2   -76.1   623.9 10224.4 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -623.4444    40.4129  -15.43   <2e-16 ***
## squareMeters   79.9905     0.6896  115.99   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1461 on 8847 degrees of freedom
## Multiple R-squared:  0.6033, Adjusted R-squared:  0.6032 
## F-statistic: 1.345e+04 on 1 and 8847 DF,  p-value: < 2.2e-16

Powierzchnia mieszkania (squareMeters) jest istotnym predyktorem ceny (price), a model regresji liniowej dobrze wyjaśnia zmienność cen.

  1. Wizualizacja modelu liniowego

## integer(0)

Wnioski Końcowe

  1. Mieszkania premium: Są znacznie droższe i mają bardziej zróżnicowany rozkład cen, co odzwierciedla różnorodność w tej kategorii.

  2. Niski standard: Mieszkania o niższym standardzie mają niższe ceny, głównie skupione w niższym przedziale cenowym.

  3. Podział cenowy: Istnieje wyraźny podział między mieszkaniami premium a tymi o niższym standardzie, co sugeruje segmentację rynku.

  4. Cena a odległość od centrum: Ceny mieszkań spadają wraz z rosnącą odległością od centrum miasta. Bliżej centrum (0-5 km) ceny są bardzo zróżnicowane, podczas gdy dalej (powyżej 10 km) ceny są bardziej skupione w niższych przedziałach.

  5. Znaczenie lokalizacji: Mieszkania bliżej centrum mają wyższe ceny. Warszawa wyróżnia się największą liczbą mieszkań na wynajem oraz najwyższymi średnimi cenami. W większych miastach, takich jak Kraków, Wrocław i Gdańsk, ceny również są wysokie, podczas gdy w mniejszych miastach (np. Radom, Częstochowa) ceny są znacznie niższe.

  6. Korelacje cen: Cena ma negatywną korelację z odległością od centrum oraz punktów zainteresowania (np. przedszkola, szkoły). Istnieją także pozytywne korelacje między różnymi odległościami (np. odległość od restauracji i apteki).

  7. Rozkłady cen: Rozkłady cen mieszkań są przeważnie prawostronnie skośne, z większością mieszkań w przedziale 2000-4000 zł i rzadkimi, bardzo drogimi ofertami powyżej 10 000 zł. Możliwe są wartości odstające powyżej 15 000 zł.

  8. Dodatkowe informacje: Warszawa dominuje w trzech kategoriach typu budynku pod względem średniej ceny wynajmu. Większość mieszkań nie posiada ochrony ani komórki lokatorskiej.