0% found this document useful (0 votes)
2 views9 pages

Project Report

The project evaluates factors influencing housing prices in Barcelona, utilizing a dataset of 50 property listings to build a price-prediction model. Through regression analysis, Principal Component Analysis, and cluster analysis, the study identifies key structural and amenity-related characteristics that determine property value, ultimately finding that a log-price model provides the best fit. The findings highlight the importance of both physical attributes and quality features in determining housing prices, while also acknowledging the uncertainty in predicting individual property values.

Uploaded by

maryam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views9 pages

Project Report

The project evaluates factors influencing housing prices in Barcelona, utilizing a dataset of 50 property listings to build a price-prediction model. Through regression analysis, Principal Component Analysis, and cluster analysis, the study identifies key structural and amenity-related characteristics that determine property value, ultimately finding that a log-price model provides the best fit. The findings highlight the importance of both physical attributes and quality features in determining housing prices, while also acknowledging the uncertainty in predicting individual property values.

Uploaded by

maryam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Mohamed Maataoui

Marcelo Maltrana
Maryam Karimkhani

Project report
In this project, we aimed to evaluate whether the price of a house can be jus=fied
based on a variety of structural and amenity-related characteris=cs. Our main objec=ve was
to iden=fy the factors that most strongly influence housing value and to quan=fy their impact
in order to build a reliable price-predic=on model. To structure our analysis, we categorized
the explanatory variables into two groups: structural features represented by con=nuous
variables such as area, number of bedrooms, number of bathrooms, and floor level and
ameni=es, represented by categorical variables such as neighborhood, condi=on, balcony,
elevator, and air condi=oning. We constructed a dataset of 50 self-collected property lis=ngs
from Idealista, ensuring a realis=c and representa=ve sample for our study. Using this
dataset, we fiMed several regression models with house price as the response variable,
exploring both raw price and log transformed price in order to address poten=al viola=ons of
model assump=ons. The ini=al model incorporated all available interac=ons between
variables, while subsequent models retained only the most relevant predictors and
interac=ons, selected based on sta=s=cal significance, interpretability, and overall
contribu=on to predic=ve accuracy. As detailed in the following pages, our findings
demonstrate that the model using log-price as the response variable provides the best fit,
offering more consistent residual paMerns, improved linearity, and clearer insights into how
both structural characteris=cs and ameni=es contribute to determining property value.

1
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani
To gain an ini=al understanding of the dataset, we first examined the average price of
apartments across the different neighborhoods included in our study. This comparison
highlights substan=al varia=on within the Barcelona housing market. For instance, Sarria Sant
Gervasi appears to be the most expensive district in our sample, while Horta Guinardo has
the lowest average prices. These differences can be linked to many of the explanatory
variables we selected, such as apartment size, condi=on, available ameni=es, or overall
building quality which tend to vary systema=cally across neighborhoods. The figure below
illustrates the mean price in each neighborhood, providing a clear visual representa=on of
how characteris=cs of the loca=on significantly influence housing values.

Figure 1:Mean of Price by Neighborhood

The neighborhood variable was not included in the model because its inclusion led to
viola=ons of the normality assump=on and issues in the residual diagnos=cs. Moreover, the
differences in prices across neighborhoods are mainly explained by apartment characteris=cs
such as area and housing features, which are not uniformly present across neighborhoods.
These characteris=cs were already included as explanatory variables in the model, making
the neighborhood variable redundant.

Initial Linear Price Model


The model presented below is a linear regression designed to explain apartment prices using
a combina=on of quan=ta=ve variables such as area, bedrooms, bathrooms, and floor level,
along with qualita=ve factors like condi=on, balcony, elevator access, and air condi=oning.
However, the ini=al specifica=on suffers from a structural overload, as we have used all the
possible interac=on terms between categorical and con=nuous variables. These high-order
interac=ons produce a very large set of dummy variables that do not correspond to
meaningful economic rela=onships and make the model extremely difficult to interpret. This

2
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani
over parameteriza=on results in numerous nonsignificant coefficients whose T-values are
under 2, indica=ng that they do not meaningfully contribute to explaining price varia=on.
Although the overall R² appears rela=vely high, the adjusted R², which penalizes unnecessary
predictors, shows that most of these interac=ons fail to add real explanatory power. The
presence of extremely high VIF values confirms strong mul=collinearity, revealing
redundancy among predictors and instability in coefficient es=mates. Furthermore,
informa=on criteria such as AIC and BIC, are also affected by this excessive complexity,
confirming that the model is too heavy in rela=on to its predic=ve gain. In addi=on, residual
diagnos=cs reveal that errors are spa=ally concentrated in a specific loca=on rather than
being randomly distributed, indica=ng that the model fails to adequately capture all details.
Altogether, the combina=on of inflated interac=on terms, weak coefficient significance, high
VIF values, and non-randomly distributed residuals indicates that the ini=al model is
overfiMed and requires substan=al simplifica=on. This includes removing irrelevant
interac=on terms and modeling the logarithm of price instead of the price itself, in order to
produce a more reliable, interpretable, and generalizable regression.

Figure 2:Ini8al Linear Price Model

Figure 3:Versus fits and normal probability plot

3
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani
Principal Component Analysis
Principal Component Analysis (PCA) was performed to explore the structure of the
housing dataset and to iden=fy paMerns among the explanatory variables. The data set
includes several correlated housing characteris=cs such as area, number of bedrooms,
number of bathrooms, floor level, condi=on, and ameni=es (balcony, elevator, air
condi=oning). When predictors are highly correlated, the interpreta=on can become difficult,
and redundancy could also exist in the informa=on they provide.

The main objec=ve of PCA in this project is explanatory rather than predic=ve. Here,
PCA was used to iden=fy groups of variables that convey similar informa=on like size-related
variables or quality-related variables. Furthermore, it was used to reduce dimensionality
while also retaining most of the variability in the dataset as well as to provide further insight
into the structure of the Barcelona housing market.

Importantly, price is not included in the PCA, as PCA is an unsupervised technique


only to explanatory variables. The results of the PCA are interpreted through eigenvalues, the
propor=on of variance explained by each component, and graphical tools such as loading and
score plots.

Figure 4:PCA

In figure X, the eigenvalues indicate how much variance each principal component
explains. PC1 has an eigenvalue of 2.58 and explains around 32.3% of the total variance; PC2
explains 18.3%, and PC3 explains 15.1%. Together, it is seen that they explain about 65.7% of
the variability in the data, which is a reasonable reduc=on from the original variables.

4
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani

Figure 5:Score plot and loading plot

The PCA loading plot in figure 5, shows how each original variable contributes to the
first two principal components. The first component (horizontal axis) is mainly driven by
Area, Bedrooms, and Bathrooms, which all point strongly in the same direc=on. This
indicates that the variables are posi=vely correlated and together represent a “size”
dimension of the apartment: larger homes usually have more bedrooms and bathrooms. The
second component (ver=cal axis) is dominated by the condi=on and elevator (posi=ve
direc=on) and Balcony (nega=ve direc=on). This suggests that PC2 represents a
quality/ameni=es dimension, separa=ng apartments with beMer condi=on and elevator
access from those where a balcony exists in the apartment. Floor points in a different
direc=on from size variables, meaning it is not strongly correlated with apartment size and
instead contributes more independently to the varia=on captured by PC2. AC is close to the
origin, indica=ng that it contributes less to the first two components and does not strongly
differen=ate apartments along these main dimensions.

The score plot in Figure 5, shows how the apartments are distributed according to the
first two principal components. Most observa=ons are clustered near the center, showing
that many apartments have similar characteris=cs. Points spread along the first component
show differences mainly in size and layout, while spread along the second components
reflect differences related to building features. A few points lie farther from the center,
indica=ng apartments with more unique combina=ons of features.

Cluster Analysis
Cluster analysis is used to group apartments with similar characteris=cs into
homogeneous segments without using a response variable that is already defined. In this
case, clustering is applied to the structural and amenity variables such as area, number of
rooms, condi=on, floor, and ameni=es in order to iden=fy natural grouping within the
housing market. The objec=ve here is not to predict the price, but to explore whether
apartments can be classified into dis=nct types or profiles for example, large high-quality
apartments versus small lower-quality ones and see how price could be affected by this
analysis.

5
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani

Figure 6:Dendrogram

The dendrogram shows that the Barcelona apartments can be grouped into three main
clusters based on their structural and amenity characteris=cs. One cluster on the lei group's
apartments with generally smaller size and fewer ameni=es, indica=ng lower-end or more
basic op=ons. A second intermediate cluster contains few apartments. The third cluster on
the right groups apartments that are larger and beMer equipped with more ameni=es, which
likely corresponds to higher-end proper=es. The results show that Barcelona’s housing
market can be divided into different groups of apartments. Each group shares similar
characteris=cs, meaning that prices and features tend to cluster into specific apartment
types.

Figure 7:ScaJer plot of PC2 vs PC1

The scaMer plot shows the result of the cluster analysis projected onto the first two
components. Each point represents an apartment, and the colors indicate the three different
clusters iden=fied previously. The clusters are well separated, meaning apartments within
the same cluster have similar characteris=cs while apartments in different clusters are clearly
different. One cluster groups apartment with higher values on PC1 (larger, beMer equipped
homes), another cluster with lower PC1 values (smaller or less equipped), and a third,
smaller cluster contains more extreme or unique proper=es. Between the large and small
apartment clusters, some observa=ons lie near the boundary separa=ng the two groups and
could reasonably be assigned to either cluster.

6
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani
Log Price regression model
The log-price regression model demonstrates strong explanatory power and superior
diagnos=c behavior compared to models based on raw prices. The results highlight that
property value is jointly determined by structural size and ameni=es, with comfort and
quality features amplifying the impact of physical characteris=cs. The ANOVA results indicate
that the log-price regression model is highly significant overall; Several structural
characteris=cs and amenity variables, along with their interac=ons, make sta=s=cally
significant contribu=ons, highligh=ng that property value is influenced by both physical
aMributes and quality features. Another proof of this strong model-performance is the fact
that the regression component accounts for 87.19% of the total varia=on in log-price, while
only 12.81% remains unexplained.

Figure 8: Analysis of variance

The residual diagnos=cs collec=vely indicate that the log-price model sa=sfies the key
regression assump=ons. The residuals are approximately normally distributed, as shown by
the normal probability plot, and exhibit a random, paMern less scaMer with constant variance
in the residuals versus fiMed values plot. Together, these results suggest that the log
transforma=on successfully improves linearity, stabilizes variance, and yields a well-specified
model with no evident systema=c errors. In short, our data corresponds quite well to this
transforma=on.

Figure 9:Versus fits and normal probability plot

7
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani
Prediction
To test the performance of our regression model, we applied it to four hypothe=cal
apartments with different sizes, features, and condi=ons. The model predicts the logarithm
of the apartment price, which helps stabilize variance and capture mul=plica=ve effects. The
predicted values are then exponen=ated to obtain prices in euros. However, in order to keep
the analysis concise, only two of these apartments are discussed in detail below. This focused
analysis allows us to highlight the model’s behavior and uncertainty without overloading the
report.

Apartment 2: 55 m², 1 bedroom, 1 bathroom, floor 2, condi=on 1, no balcony, no elevator,


AC 1.

Predicted price: €271,631

Despite being smaller than Apartment 1, this apartment’s predicted price is much higher.
This is mainly due to the presence of AC, which has a strong mul=plica=ve effect in the
model, as well as other interac=ons between features. The wide predic=on interval indicates
that the actual price could vary significantly depending on how these features interact in
prac=ce.

Apartment 4: 120 m², 2 bedrooms, 2 bathrooms, floor 4, condi=on 1, balcony 1, elevator 1,


AC 1.

Predicted price: €822,168

The very large size and presence of several ameni=es push the predicted price to a high
value. The extremely wide predic=on interval reflects that extrapola=ng to large apartments
is less precise due to complex interac=ons in the model, meaning the actual market price
could be much lower or higher than the predicted value.

The model demonstrates that binary features (like AC, balcony, elevator) and apartment
condi=on can heavily influence predicted prices. The wide 95% predic=on intervals highlight
the uncertainty inherent in predic=ng individual apartment prices, par=cularly when the
apartments have uncommon combina=ons of features or larger sizes. These intervals are
crucial to understanding the range of possible market prices.

8
Mohamed Maataoui
Marcelo Maltrana
Maryam Karimkhani

Figure 10:Predic8on for logprice

Conclusion
In this project, we analyzed housing prices by following a clear sequence of steps, moving
from data explora=on to modeling and predic=on. We first examined price differences across
neighborhoods, confirming that loca=on plays an important role in determining value. We
then used dimension-reduc=on and grouping techniques to beMer understand how
apartment characteris=cs relate to one another, finding that size-related features and quality
or amenity-related features form dis=nct and meaningful paMerns in the data. These steps
helped clarify the structure of the housing market before building a predic=ve model.

Aier tes=ng several regression specifica=ons, we found that modeling the logarithm of price
provided the most reliable and interpretable results. This approach beMer reflects how
housing prices behave in prac=ce, with size and ameni=es increasing value propor=onally
rather than by a fixed amount. The final model showed that both structural characteris=cs
and ameni=es jointly determine price, while the predic=on exercise highlighted the
uncertainty involved in es=ma=ng individual property values. Overall, the results
demonstrate that house prices can be reasonably explained by observable features, while
s=ll acknowledging the inherent variability of the housing market.

You might also like