This commit is contained in:
2026-04-30 14:46:10 +02:00
parent c6095a7990
commit cc16535e63
2 changed files with 57 additions and 97 deletions

No files matched your search

+35 -84
View File
File diff suppressed because one or more lines are too long
+22 -13
View File
@@ -11,6 +11,9 @@ output:
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
library(ggplot2)
library(nortest)
fig.width = 8
fig.height = 5
```
### Data Fields
@@ -32,7 +35,7 @@ library(ggplot2)
apartments_rent_pl_YYYY_MM.csv: monthly rent
```{r import data, fig.width = 8, fig.height = 5}
```{r import data}
files <- list.files("rent", pattern = "\\.csv$", full.names = TRUE)
files <- sort(files)
@@ -49,9 +52,6 @@ has_cols <- grep("^has", names(rent), value = TRUE)
rent[has_cols] <- lapply(rent[has_cols], function(x) {
tolower(x) == "yes"
})
summary(rent)
ggplot(rent) + geom_point(aes(x=city, y=price, col=centreDistance), alpha=0.1, size=0.5) + scale_color_viridis_c()
rent_norm <- rent %>%
group_by(city) %>%
@@ -62,17 +62,26 @@ rent_norm <- rent %>%
) %>%
mutate() %>%
ungroup()
```
# Ceny, heatmapy
```{r heatmaps}
ggplot(rent) + geom_point(aes(x=city, y=price, col=centreDistance), alpha=0.1, size=0.5) + scale_color_viridis_c()
ggplot(rent_norm) + geom_point(aes(x=longitude_n, y=latitude_n, col=log(price)), alpha=0.01, size=0.2) + facet_wrap(~ city) + scale_color_viridis_c()
ggplot(rent[rent$city=="warszawa", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.1) + scale_color_viridis_c()
ggplot(rent[rent$city=="gdansk", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.5) + scale_color_viridis_c()
ggplot(rent[rent$city=="wroclaw", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.5) + scale_color_viridis_c()
ggplot(rent[rent$city=="poznan", ]) + geom_point(aes(x=longitude, y=latitude, col=log(price)), alpha=0.1, size=0.5) + scale_color_viridis_c()
ggplot(rent, aes(x = rooms)) +
geom_histogram(aes(y = after_stat(density)), binwidth = 1, fill = "steelblue", color = "white") +
facet_wrap(~ city) +
theme_minimal()
```
# Czy ceny normalne?
```{r isnormal}
prices_overall <- rent$price
lillie.test(prices_overall)
prices_warsaw <- rent[rent$city=="bialystok", ]$price
lillie.test(prices_warsaw)
prices_without_warsaw <- rent[rent$city!="warszawa", ]$price
lillie.test(prices_without_warsaw)
```