qq + linear models
This commit is contained in:
+28
-16
@@ -168,28 +168,27 @@ ggplot(apartments_warsaw, aes(x=longitude, y=latitude, col=log_price)) +
|
|||||||
# Czy ceny normalne?
|
# Czy ceny normalne?
|
||||||
|
|
||||||
```{r lillieford}
|
```{r lillieford}
|
||||||
log_df <- log(df$price_m2)
|
lillie.test(rent_warsaw$log_price_m2_n)
|
||||||
prices_overall <- log_df
|
lillie.test(apartments_warsaw$log_price_m2_n)
|
||||||
|
|
||||||
lillie.test(log(df_wo_outliers[df_wo_outliers$city == "warszawa",]$price_m2))
|
df_plot <- data.frame(log_price_m2 = df$log_price_m2_n)
|
||||||
|
ggplot(df, aes(x = log_price_m2_n)) +
|
||||||
df_plot <- data.frame(log_price = log_df)
|
|
||||||
ggplot(df_plot, aes(x = log_price)) +
|
|
||||||
geom_histogram(aes(y = after_stat(density)),
|
geom_histogram(aes(y = after_stat(density)),
|
||||||
bins = 50,
|
bins = 50,
|
||||||
fill = "lightblue",
|
fill = "lightblue",
|
||||||
color = "white")
|
color = "white") +
|
||||||
|
facet_wrap(~ type)
|
||||||
|
|
||||||
qqnorm(log_df)
|
qqnorm(rent$log_price_m2_n)
|
||||||
qqline(log_df, col = "red")
|
qqline(rent$log_price_m2_n, col = "red")
|
||||||
|
|
||||||
qqnorm(log(df_wo_outliers$price_m2))
|
qqnorm(apartments$log_price_m2_n)
|
||||||
qqline(log(df_wo_outliers$price_m2), col = "red")
|
qqline(apartments$log_price_m2_n, col = "red")
|
||||||
```
|
```
|
||||||
|
|
||||||
# Model liniowy
|
# Model liniowy
|
||||||
```{r linear model}
|
```{r linear model}
|
||||||
model <- lm(log_price ~ centreDistance +
|
model_rent <- lm(log_price_m2_n ~ centreDistance +
|
||||||
squareMeters +
|
squareMeters +
|
||||||
age +
|
age +
|
||||||
floor_ratio +
|
floor_ratio +
|
||||||
@@ -197,8 +196,21 @@ model <- lm(log_price ~ centreDistance +
|
|||||||
hasElevator +
|
hasElevator +
|
||||||
hasBalcony + hasSecurity +
|
hasBalcony + hasSecurity +
|
||||||
condition,
|
condition,
|
||||||
data = df)
|
data = rent)
|
||||||
summary(model)
|
summary(model_rent)
|
||||||
par(mfrow = c(2,2))
|
par(mfrow = c(2,2))
|
||||||
plot(model)
|
plot(model_rent)
|
||||||
```
|
|
||||||
|
model_apartments <- lm(log_price_m2_n ~ centreDistance +
|
||||||
|
squareMeters +
|
||||||
|
age +
|
||||||
|
floor_ratio +
|
||||||
|
city +
|
||||||
|
hasElevator +
|
||||||
|
hasBalcony + hasSecurity +
|
||||||
|
condition,
|
||||||
|
data = apartments)
|
||||||
|
summary(model_apartments)
|
||||||
|
par(mfrow = c(2,2))
|
||||||
|
plot(model_apartments)
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user