The data set used was found on Kaggle. The data set focuses on the price of houses in Poland
The data set has 23764 observations, 10 dependent variable, and one dependent variable, price.
Address : The Full house Address
City: The city the house is located, Krakow, Warszawa, or Pozna
id: The house id is the number order the house was built
price: The price the house was sold for
sq: The square meters of the house
year: year the house was built
floor: The number of floors in the house
room: The number of rooms in the house
longitude: Longitude of house location
latitude: latitude of house location
The purpose of the analysis is to see the association between the price of houses in Poland with the predictor variables.
We find the location of the houses by using the latitude and longitude given to us in the data set. We do this by creating a plot that shows the latitude and longitude points.
The initial linear model has 6 predictor variables.
The linear model is: Price=β0+β1∗Longitude+β2∗Latitude+β3∗sq+β4∗floors+β5∗rooms+β6∗years +β7∗id+ϵ
We begin by finding the initial linear model to find the coefficients.
| Estimate | Std. Error | t value | Pr(>|t|) | |
|---|---|---|---|---|
| (Intercept) | 489000.70 | 126841.90 | 3.86 | 0.00 |
| sq | -0.08 | 0.47 | -0.16 | 0.87 |
| rooms | 244215.27 | 3093.18 | 78.95 | 0.00 |
| floor | 26626.10 | 1249.95 | 21.30 | 0.00 |
| id | 1.28 | 0.36 | 3.57 | 0.00 |
| year | -286.94 | 63.39 | -4.53 | 0.00 |
Using the given coefficients we find the linear model to be:
Price = 489000.70 -.08sq + 244215.27rooms + 26626.10floors + 1.28id - 286.94*year + ϵ
4 plots are used to check for possible violations of residuals these
include: The model not having a normal distributed, Q-Q plot The
linearity of the residuals, Residuals vs Fitted Constant variance,
Scale-location Influential points, Residuals vs Leverage
The residual analysis plots show many important findings:
Q-Q plot: Shows there is a normal distribution
Residuals vs Fitted: Shows there is linearity in the variables
Scale-Location: shows there is a non-constant variance
Residual vs Leverage: shows there is an influential point ar 6199
VIF detects any issues of multicollinearity.
FALSE sq rooms floor id year
FALSE 1.000 1.002 1.001 1.002 1.003
The model shows there are no issues with multicollinearity as all the
VIF values are at 1.
# Box Cox
Transformations
The Box-cox transformation shows that an effective lambda = .11 can be used to transform the model.
| Estimate | Std. Error | t value | Pr(>|t|) | |
|---|---|---|---|---|
| (Intercept) | 4.20 | 0.05 | 82.98 | 0.00 |
| sq | 0.00 | 0.00 | -0.03 | 0.98 |
| year | 0.00 | 0.00 | -6.52 | 0.00 |
| floor | 0.01 | 0.00 | 23.13 | 0.00 |
| rooms | 0.14 | 0.00 | 114.30 | 0.00 |
| id | 0.00 | 0.00 | 11.62 | 0.00 |
Once preforming the Box-cox transformation we see that the residual
assumptions are all met, except for the influential point at 6199.
It is important to remove the influential points because they have a large impact on the regression of the model.
| Estimate | Std. Error | t value | Pr(>|t|) | |
|---|---|---|---|---|
| (Intercept) | 4.19 | 0.05 | 83.75 | 0 |
| sq | 0.00 | 0.00 | 21.72 | 0 |
| year | 0.00 | 0.00 | -6.54 | 0 |
| floor | 0.01 | 0.00 | 23.40 | 0 |
| rooms | 0.13 | 0.00 | 105.51 | 0 |
| id | 0.00 | 0.00 | 12.05 | 0 |
By removing the influential point the residuals look much worse using Box-Cox transformation.
Q-Q plot: Shows a normal distribution
Residuals vs Fitted: Shows there is linearity in the variables
Scale-Location: shows there is a non-constant variance
Residual vs Leverage: shows there are two new influential points at 18638 and 10799
\(\beta_0\): 95% CI[494694.8281, 494694.8281]
\(\beta_1\): 95% CI[-0.0675, -0.0675]
\(\beta_2\): 95% CI[-279.4766, -279.4766]
\(\beta_3\): 95% CI[26511.3123, 26511.3123]
\(\beta_4\): 95% CI[244094.4502, 244094.4502]
The confidence intervals show that each of the variables are statistically significant as none of them have zero within their CI.
| Estimate | Std. Error | t value | Pr(>|t|) | |
|---|---|---|---|---|
| (Intercept) | 4.193454 | 0.050070 | 83.752 | 0 |
| sq | 0.000327 | 0.000015 | 21.724 | 0 |
| year | -0.000164 | 0.000025 | -6.537 | 0 |
| floor | 0.011545 | 0.000493 | 23.398 | 0 |
| rooms | 0.133649 | 0.001267 | 105.510 | 0 |
| id | 0.000002 | 0.000000 | 12.049 | 0 |
The completion of the project allows for many conclusions to be made. The residual Analysis assumptions were shown to have many violations in the initial model.
Using the box-cox transformation to check residual assumptions allowed for many of the assumptions to be verified. The assumptions of normal distribution, linearity, and constant variance were all verified to be true. However there is an influential point at 6199.
The report shows the predictors are all statistically significant on the Price of the houses in Poland. However the model should be used carefully as there are many assumptions that are violates.
Cegielski, D. (2021, March 4). House prices in Poland. Kaggle. https://www.kaggle.com/datasets/dawidcegielski/house-prices-in-poland/data