sth
This commit is contained in:
+23
-13
@@ -12,6 +12,9 @@ knitr::opts_chunk$set(echo = TRUE)
|
|||||||
library(dplyr)
|
library(dplyr)
|
||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
library(nortest)
|
library(nortest)
|
||||||
|
library(tidyr)
|
||||||
|
library(purrr)
|
||||||
|
library(broom)
|
||||||
fig.width = 8
|
fig.width = 8
|
||||||
fig.height = 5
|
fig.height = 5
|
||||||
```
|
```
|
||||||
@@ -57,6 +60,9 @@ rent <- do.call(rbind, df_list)
|
|||||||
|
|
||||||
# price/m^2
|
# price/m^2
|
||||||
rent$price_m2 <- rent$price / rent$squareMeters
|
rent$price_m2 <- rent$price / rent$squareMeters
|
||||||
|
rent$log_price <- log(rent$price_m2)
|
||||||
|
rent$floor_ratio <- rent$floor / rent$floorCount
|
||||||
|
rent$age <- 2024 - rent$buildYear
|
||||||
|
|
||||||
has_cols <- grep("^has", names(rent), value = TRUE)
|
has_cols <- grep("^has", names(rent), value = TRUE)
|
||||||
|
|
||||||
@@ -80,7 +86,7 @@ rent_norm <- rent %>%
|
|||||||
|
|
||||||
rent_wo_outliers <- rent %>%
|
rent_wo_outliers <- rent %>%
|
||||||
group_by(city) %>%
|
group_by(city) %>%
|
||||||
filter(log(price_m2) > 3) %>%
|
filter(floor >= 7) %>%
|
||||||
ungroup()
|
ungroup()
|
||||||
|
|
||||||
cities <- unique(rent$city)
|
cities <- unique(rent$city)
|
||||||
@@ -145,9 +151,9 @@ ggplot(rent, aes(x = poi_group, y = price_m2)) +
|
|||||||
|
|
||||||
```{r lillieford}
|
```{r lillieford}
|
||||||
log_rent <- log(rent$price_m2)
|
log_rent <- log(rent$price_m2)
|
||||||
summary(log_rent)
|
|
||||||
prices_overall <- log_rent
|
prices_overall <- log_rent
|
||||||
lillie.test(prices_overall)
|
|
||||||
|
lillie.test(log(rent_wo_outliers[rent_wo_outliers$city == "warszawa",]$price_m2))
|
||||||
|
|
||||||
df_plot <- data.frame(log_price = log_rent)
|
df_plot <- data.frame(log_price = log_rent)
|
||||||
ggplot(df_plot, aes(x = log_price)) +
|
ggplot(df_plot, aes(x = log_price)) +
|
||||||
@@ -156,12 +162,6 @@ ggplot(df_plot, aes(x = log_price)) +
|
|||||||
fill = "lightblue",
|
fill = "lightblue",
|
||||||
color = "white")
|
color = "white")
|
||||||
|
|
||||||
results <- rent %>%
|
|
||||||
group_by(city) %>%
|
|
||||||
summarise(p_value = lillie.test(log(price_m2))$p.value, mean = mean(price_m2), var = var(price_m2))
|
|
||||||
|
|
||||||
show(results)
|
|
||||||
|
|
||||||
qqnorm(log_rent)
|
qqnorm(log_rent)
|
||||||
qqline(log_rent, col = "red")
|
qqline(log_rent, col = "red")
|
||||||
|
|
||||||
@@ -169,8 +169,18 @@ qqnorm(log(rent_wo_outliers$price_m2))
|
|||||||
qqline(log(rent_wo_outliers$price_m2), col = "red")
|
qqline(log(rent_wo_outliers$price_m2), col = "red")
|
||||||
```
|
```
|
||||||
|
|
||||||
# Wiek vs Cena
|
# Model liniowy
|
||||||
|
```{r linear model}
|
||||||
```{r buildYear}
|
model <- lm(log_price ~ centreDistance +
|
||||||
ggplot(rent) + geom_jitter(aes(x=buildYear, y=price, col=centreDistance), alpha=0.2, size=0.01) + scale_color_viridis_c()
|
squareMeters +
|
||||||
|
age +
|
||||||
|
floor_ratio +
|
||||||
|
city +
|
||||||
|
hasElevator +
|
||||||
|
hasBalcony + hasSecurity +
|
||||||
|
condition,
|
||||||
|
data = rent)
|
||||||
|
summary(model)
|
||||||
|
par(mfrow = c(2,2))
|
||||||
|
plot(model)
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user