Merge branch 'HEAD' of https://git.yaemiku.dev/yaemiku/sad.git
This commit is contained in:
+24
-10
@@ -12,6 +12,9 @@ knitr::opts_chunk$set(echo = TRUE)
|
||||
library(dplyr)
|
||||
library(ggplot2)
|
||||
library(nortest)
|
||||
library(tidyr)
|
||||
library(purrr)
|
||||
library(broom)
|
||||
fig.width = 8
|
||||
fig.height = 5
|
||||
```
|
||||
@@ -57,6 +60,9 @@ rent <- do.call(rbind, df_list)
|
||||
|
||||
# price/m^2
|
||||
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)
|
||||
|
||||
@@ -80,7 +86,7 @@ rent_norm <- rent %>%
|
||||
|
||||
rent_wo_outliers <- rent %>%
|
||||
group_by(city) %>%
|
||||
filter(log(price_m2) > 3) %>%
|
||||
filter(floor >= 7) %>%
|
||||
ungroup()
|
||||
|
||||
cities <- unique(rent$city)
|
||||
@@ -145,9 +151,9 @@ ggplot(rent, aes(x = poi_group, y = price_m2)) +
|
||||
|
||||
```{r lillieford}
|
||||
log_rent <- log(rent$price_m2)
|
||||
summary(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)
|
||||
ggplot(df_plot, aes(x = log_price)) +
|
||||
@@ -156,12 +162,6 @@ ggplot(df_plot, aes(x = log_price)) +
|
||||
fill = "lightblue",
|
||||
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)
|
||||
qqline(log_rent, col = "red")
|
||||
|
||||
@@ -169,4 +169,18 @@ qqnorm(log(rent_wo_outliers$price_m2))
|
||||
qqline(log(rent_wo_outliers$price_m2), col = "red")
|
||||
```
|
||||
|
||||
|
||||
# Model liniowy
|
||||
```{r linear model}
|
||||
model <- lm(log_price ~ centreDistance +
|
||||
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