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?
|
||||
|
||||
```{r lillieford}
|
||||
log_df <- log(df$price_m2)
|
||||
prices_overall <- log_df
|
||||
lillie.test(rent_warsaw$log_price_m2_n)
|
||||
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 = log_df)
|
||||
ggplot(df_plot, aes(x = log_price)) +
|
||||
df_plot <- data.frame(log_price_m2 = df$log_price_m2_n)
|
||||
ggplot(df, aes(x = log_price_m2_n)) +
|
||||
geom_histogram(aes(y = after_stat(density)),
|
||||
bins = 50,
|
||||
fill = "lightblue",
|
||||
color = "white")
|
||||
color = "white") +
|
||||
facet_wrap(~ type)
|
||||
|
||||
qqnorm(log_df)
|
||||
qqline(log_df, col = "red")
|
||||
qqnorm(rent$log_price_m2_n)
|
||||
qqline(rent$log_price_m2_n, col = "red")
|
||||
|
||||
qqnorm(log(df_wo_outliers$price_m2))
|
||||
qqline(log(df_wo_outliers$price_m2), col = "red")
|
||||
qqnorm(apartments$log_price_m2_n)
|
||||
qqline(apartments$log_price_m2_n, col = "red")
|
||||
```
|
||||
|
||||
# Model liniowy
|
||||
```{r linear model}
|
||||
model <- lm(log_price ~ centreDistance +
|
||||
model_rent <- lm(log_price_m2_n ~ centreDistance +
|
||||
squareMeters +
|
||||
age +
|
||||
floor_ratio +
|
||||
@@ -197,8 +196,21 @@ model <- lm(log_price ~ centreDistance +
|
||||
hasElevator +
|
||||
hasBalcony + hasSecurity +
|
||||
condition,
|
||||
data = df)
|
||||
summary(model)
|
||||
data = rent)
|
||||
summary(model_rent)
|
||||
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