Full text
MASTER FINAL THESIS Predictive Business Analytics for Real Estate: A Tool for Estimating and Analyzing Housing Prices Author: Pineda Montserrat, Baltasar Director: Sallan Leyes, José María Degree: Master in Technology and Engineering Management Examination session: Autumn, 2023 Document: Report
i Abstract This thesis focuses on the development of a Predictive Business Analytics tool tailored for the real estate sector, driven by the crucial need to accurately estimate property prices. Leveraging sophisticated data analysis techniques using R programming language, the tool serves as a conduit for transforming the complex dynamics of the real estate market into clear and actionable insights. By aggregating comprehensive data from one of the leading real estate websites, Idealista, and integrating essential property features, the tool establishes a predictive model with high precision in estimating property prices. The primary objective is to empower stakeholders in the real estate sector with an easy-to- use and robust solution. Expanding its scope beyond merely assessing the fairness of the listed price, the tool functions as a mechanism to identify potential buying opportunities, thereby fostering a more informed decision-making process. The study begins with an in-depth analysis of the real estate market in Catalonia, recognizing its dynamic nature influenced by various factors. Subsequently, focusing on the city of Terrassa, the thesis strategically refines the predictive model through meticulous data analysis, achieving high precision, with an error margin of approximately €4,000 in almost all cases. In conclusion, the developed tool significantly enhances transparency and aids in the decision-making process, contributing to the creation of a fairer real estate market. The inclusion of real property listings in the dataset facilitates user actions with the Idealista website, and the tool's adaptability to new listings ensures continuous relevance and updates. This project successfully achieves its stated objectives and serves as a testament to the transformative potential of predictive analytics in the real estate industry.
Predictive Business Analytics for Real Estate ii Resumen Esta tesis se centra en el desarrollo de una herramienta de Análisis Predictivo de Negocios adaptada al sector inmobiliario, impulsada por la crucial necesidad de estimar justamente los precios de viviendas. Aprovechando técnicas sofisticadas de análisis de datos y el lenguaje de programación R, la herramienta actúa como un vehículo para transformar las complejas dinámicas del mercado inmobiliario en ideas claras y ejecutables. Al reunir datos exhaustivos de uno de los principales sitios web inmobiliarios, Idealista, e integrar características esenciales de las propiedades, la herramienta establece un modelo predictivo con alta precisión en la estimación de precios de propiedades. El objetivo principal es capacitar a los involucrados en el sector inmobiliario con una solución fácil de usar y robusta. Extendiendo su alcance más allá de la mera determinación de la equidad del precio indicado, la herramienta sirve como un mecanismo para identificar oportunidades de compra potenciales, promoviendo así un proceso de toma de decisiones más informado. El estudio comienza con un análisis profundo del mercado inmobiliario de Cataluña, reconociendo su naturaleza dinámica influenciada por varios factores. Posteriormente, centrándose en la ciudad de Terrassa, la tesis perfecciona estratégicamente el modelo predictivo a través de un análisis de datos meticuloso, logrando una gran precisión, con un margen de error de aproximadamente 4.000€ en prácticamente todos los casos. En conclusión, la herramienta desarrollada mejora significativamente la transparencia y ayuda en el proceso de toma de decisiones, contribuyendo así a la creación de un mercado inmobiliario justo. La inclusión de listados de propiedades reales en el conjunto de datos facilita las acciones del usuario con la web de Idealista, y la adaptabilidad de la herramienta a nuevos anuncios asegura una relevancia y actualización continuas. Este proyecto logra con éxito sus objetivos establecidos y sirve como un testimonio del potencial transformador de los análisis predictivos en la industria, en este caso la inmobiliaria.
iii Table of contents ABSTRACT .................................................................................................................................................... I RESUMEN ................................................................................................................................................... II TABLE OF CONTENTS .................................................................................................................................. III LIST OF TABLES ............................................................................................................................................ V LIST OF FIGURES ......................................................................................................................................... VI LIST OF ABBREVIATIONS............................................................................................................................ VII 1. INTRODUCTION ....................................................................................................................................... 1 1.1 OBJECT ............................................................................................................................................... 1 1.2 SCOPE................................................................................................................................................. 2 1.3 REQUIREMENTS .................................................................................................................................... 3 1.4 RATIONALE .......................................................................................................................................... 4 2 BACKGROUND AND REVIEW OF THE STATE OF THE ART ...................................................................... 6 2.1 WHAT IS REAL ESTATE?.................................................................................................................................. 6 2.2 HISTORICAL EVOLUTION ................................................................................................................................. 6 2.3 INVESTMENT IN REAL ESTATE .......................................................................................................................... 8 2.4 PESTEL ANALYSIS ........................................................................................................................................ 9 2.4.1 Political ...................................................................................................................................... 10 2.4.2 Economic .................................................................................................................................... 11 2.4.3 Social .......................................................................................................................................... 15 2.4.4 Technological ............................................................................................................................. 17 2.4.5 Environmental ............................................................................................................................ 19 2.4.6 Legal .......................................................................................................................................... 20 2.4.7 Overall Conclusion ..................................................................................................................... 22 3 METHODOLOGY ................................................................................................................................ 23 3.1 DEFINITION ........................................................................................................................................ 23 3.2 CONTEXT ........................................................................................................................................... 23 3.3 PREDICTIVE MODEL ............................................................................................................................. 24 3.3.1 Data Obtention .......................................................................................................................... 24 3.3.2 Data Handling ............................................................................................................................ 25 3.3.3 Global Analysis ........................................................................................................................... 25
Predictive Business Analytics for Real Estate iv 3.3.4 Predictive Model Development .................................................................................................. 25 4 INTEGRATED APPROACHES FOR DATA ANALYSIS ............................................................................... 27 4.1 BUSINESS ANALYTICS ........................................................................................................................... 27 4.2 CHALLENGES AND OPPORTUNITIES ......................................................................................................... 28 4.3 R PROGRAMMING LANGUAGE ............................................................................................................... 28 5 DISCUSSION OF THE SOLUTION ........................................................................................................ 30 5.1 DATA OBTENTION ................................................................................................................................ 30 5.1.1 Set up of the software................................................................................................................ 31 5.1.2 Building API ................................................................................................................................ 32 5.1.3 Exploring the variables .............................................................................................................. 37 5.2 DATA HANDLING ................................................................................................................................. 40 5.3 GLOBAL ANALYSIS ............................................................................................................................... 43 5.3.1 Price distribution ........................................................................................................................ 43 5.3.2 Property types distribution and value ........................................................................................ 45 5.3.3 Geographic distribution of properties ........................................................................................ 48 5.3.4 Comparison between size and price .......................................................................................... 50 5.3.5 Property characteristics analysis ............................................................................................... 52 5.4 PREDICTIVE MODEL DEVELOPMENT ........................................................................................................ 56 5.4.1 Creating train and test sets ........................................................................................................ 56 5.4.2 Data pre-processing ................................................................................................................... 57 5.4.3 Models setup ............................................................................................................................. 58 5.4.4 Cross-validation ......................................................................................................................... 60 5.4.5 Random forest model setup ....................................................................................................... 63 5.4.6 Hyperparameter Tuning ............................................................................................................. 65 5.4.7 Model Evaluation ....................................................................................................................... 66 5.4.8 Predicting with log ..................................................................................................................... 68 5.4.9 Variables with more impact ....................................................................................................... 70 5.4.10 Final Conclusion ..................................................................................................................... 71 6 BUDGET SUMMARY .......................................................................................................................... 72 7 ANALYSIS OF SOCIOECONOMIC IMPLICATIONS ................................................................................. 73 8 CONCLUSIONS .................................................................................................................................. 74 9 REFERENCES ..................................................................................................................................... 76 10 APPENDICES ..................................................................................................................................... 78
v List of tables TABLE 1. OVERVIEW OF THE PROPERTY MARKET IN CATALONIA (SOURCE: INE) ................................................................. 14 TABLE 2. HOUSEHOLD INCOME ALLOCATED TO MAIN HOUSING EXPENSES (SOURCE: IDESCAT) .............................................. 17 TABLE 3. ALLOWED PARAMETERS FOR IDEALISTA API (SOURCE: IDEALISTA) ...................................................................... 32 TABLE 4. VARIABLE REVIEW (SOURCE: AUTHOR) ........................................................................................................ 37 TABLE 5. METRICS RESULTS FROM PREDICTIVE MODELS (SOURCE: AUTHOR) .................................................................... 62 TABLE 6. METRICS FROM RANDOM FOREST MODEL (SOURCE: AUTHOR) .......................................................................... 64 TABLE 7. BEST HYPERPARAMETERS RESULTS (SOURCE: AUTHOR) .................................................................................... 66 TABLE 8. METRICS IN TRAIN AND TEST SETS FOR THE BEST SETTINGS IN RANDOM FOREST MODEL (SOURCE: AUTHOR) ............... 67 TABLE 9. METRICS COMPARISON BETWEEN PRICE PREDICTION AND ITS LOG PREDICTION (SOURCE: AUTHOR) .......................... 70 TABLE 10. EXECUTION COST OF THE PROJECT (SOURCE: AUTHOR) .................................................................................. 72
Predictive Business Analytics for Real Estate vi List of figures FIGURE 1. HOUSING SALES AND PURCHASES FROM 2017 TO 2019 IN CATALONIA (SOURCE: INE) ........................................ 12 FIGURE 2. YOY RATE OF NEW AND USED HOUSING SALES AND PURCHASES IN CATALONIA 2008-2020 (SOURCE: INE) ............. 13 FIGURE 3. COMPARISON OF AVERAGE HOUSE PRICES IN CATALONIA WITH THOSE IN SPAIN (SOURCE: CONSEJO GENERAL DEL NOTARIADO) ............................................................................................................................................... 15 FIGURE 4. USE OF GARDEN AND BALCONY FILTERS (JANUARY TO APRIL 2020) (SOURCE: FOTOCASA) ..................................... 16 FIGURE 5. % OF ICT USAGE IN REAL ESTATE ENTERPRISES VS INDUSTRY (SOURCE: INE) ....................................................... 18 FIGURE 6. SURVEY ON HOW MUCH PEOPLE WOULD PAY MORE FOR A SUSTAINABLE PROPERTY (SOURCE: FOTOCASA) ................ 20 FIGURE 7. TERRASSA GEOGRAPHIC COORDINATES (SOURCE: GEODATOS) ......................................................................... 33 FIGURE 8. CENTER POINT OF COORDINATE LOCATION (SOURCE: GOOGLE MAPS) ............................................................... 34 FIGURE 9. RADIUS AREA TO ENCOMPASS TERRASSA CITY (SOURCE: CALCMAPS) ................................................................ 34 FIGURE 10. DISTRIBUTION OF PRICE (SOURCE: AUTHOR) ............................................................................................. 44 FIGURE 11. DISTRIBUTION OF LOGARITHM OF PRICE (SOURCE: AUTHOR) ........................................................................ 45 FIGURE 12. NUMBER OF PROPERTIES FOR EACH PROPERTY TYPE (SOURCE: AUTHOR) ......................................................... 45 FIGURE 13. DISTRIBUTION OF PRICES BY PROPERTY TYPE (SOURCE: AUTHOR) ................................................................... 46 FIGURE 14. MEDIAN PRICES BY DISTRICT (SOURCE: AUTHOR) ........................................................................................ 47 FIGURE 15. MEDIAN PRICES FOR FLATS BY DISTRICT (SOURCE: AUTHOR).......................................................................... 48 FIGURE 16. AVERAGE LOCATION OF NEIGHBOURHOODS BY PRICE (SOURCE: AUTHOR) ........................................................ 49 FIGURE 17. COMPARISON BETWEEN SIZE AND PRICE (SOURCE: AUTHOR) ........................................................................ 50 FIGURE 18. COMPARISON BETWEEN SIZE AND PRICE BY PROPERTY TYPE (SOURCE: AUTHOR) ............................................... 51 FIGURE 19. COMPARISON BETWEEN SIZE AND ROOMS (SOURCE: AUTHOR) ...................................................................... 52 FIGURE 20. COMPARISON BETWEEN ROOMS AND BATHROOMS (SOURCE: AUTHOR) .......................................................... 53 FIGURE 21. COMPARISON BETWEEN HAVING LIFT, THE FLOOR OF THE PROPERTY AND PRICE (SOURCE: AUTHOR) ..................... 54 FIGURE 22. COMPARISON OF PARKING SPACE BY PROPERTY TYPE (SOURCE: AUTHOR) ........................................................ 54 FIGURE 23. LINEAR REGRESSION MODEL (SOURCE: SPICEWORKS) .................................................................................. 58 FIGURE 24. REGRESSION TREE CLASSIFICATION (SOURCE: SAP HELP) .............................................................................. 59 FIGURE 25. RESAMPLING STRATEGY (SOURCE: BOOKDOWN) ......................................................................................... 61 FIGURE 26. RANDOM FOREST CLASSIFICATION (SOURCE: AUTHOR) ................................................................................ 63 FIGURE 27. VISUALIZATION OF PERFORMANCE INDICATORS FOR EACH MODEL (SOURCE: AUTHOR) ....................................... 64 FIGURE 28. REAL VALUES COMPARED WITH PREDICTED VALUES SETS (SOURCE: AUTHOR) .................................................... 68 FIGURE 29. COMPARISON BETWEEN PRICE AND ITS LOG (SOURCE: AUTHOR) .................................................................... 69 FIGURE 30. IMPORTANCE SCORE FOR PREDICTORS (SOURCE: AUTHOR) ........................................................................... 71
vii List of abbreviations - A - API (Application Programming Interface): A set of protocols, routines, and tools for building software applications, allowing different software applications to communicate with each other. - R - Real Estate: The industry and practice of buying, selling, and managing properties, including land, buildings, and natural resources. - U - URL (Uniform Resource Locator): A web address that specifies the location of a resource on the internet, such as a webpage or document.
Predictive Business Analytics for Real Estate 6 2 Background and review of the state of the art In this section, we are going to review the industry through the historical evolution and current state of the real estate. By exploring the transformations that have shaped this business over time, we gain a deeper appreciation for the emergence of contemporary datadriven platforms. This foundational concept allows us to contextualize the development of the Predictive Business Analytics tool within the constant changing environment of real estate analysis. 2.1 What is Real Estate? Real Estate is a multifaceted concept encompassing tangible property in the form of land or any permanent structures, like a home, or improvements attached to the land, whether natural or man-made. (Real Estate: Definition, Types, How to Invest in It, n.d.) At its core, represents a vital component of the economic and societal framework. It encapsulates not only the physical aspects of land and structures but also the rights and interests associated with them. The intricate interplay between legal, economic, and societal factors within the realm of real estate establishes it as a cornerstone. Understanding the various facets is pivotal in navigating the topic of this thesis. As we delve into the historical evolution and contemporary state of the real estate industry, this comprehensive definition serves as the anchor, providing clarity and context to the multifaceted nature of the subject matter. 2.2 Historical Evolution The Real Estate business, with its deep-rooted history, has evolved through the ages, reflecting the changes of economies, societies, and technologies. Comprehending its historical journey provides valuable context for comprehending the role of modern datadriven platforms in today's real estate industry. In its early days, real estate transactions were characterized by simplicity. These exchanges primarily occurred through word of mouth, direct negotiations, and informal agreements within local communities. While property ownership was a fundamental concept, the valuation of real estate often relied on subjective estimations, resulting in disparate pricing and a notable lack of transparency. The turning point in the evolution of the real estate business came with the emergence of property valuation methods in the late 19th century. This marked a significant transformation
7 in the industry's approach to assessing property values. Methods such as the Sales Comparison Approach, the Cost Approach, and the Income Approach 1 standardized the valuation process and introduced greater objectivity. (The Three Approaches to Value: The Cost, Income, and Comparable Sales, n.d.) Real estate agents emerged in the early 20th century and became important middlemen between buyers and sellers of real estate. These agencies not only standardized property listings but also introduced professional standards within the industry. However, property information remained largely confined to printed listings and localized networks. The digital age, marked by the proliferation of the internet in the late 20th century, brought about a monumental transformation. Online platforms and property listings radically expanded the accessibility of real estate information. Websites and databases allowed property details, images, and listings to be viewed by a global audience. This digitization of property marketing revolutionized the way real estate transactions were conducted. As we entered the 21st century, data-driven decision-making became central to the real estate industry. Access to vast repositories of data, including transaction histories, market trends, and property attributes, became commonplace. The fusion of this data with the power of predictive analytics gave birth to innovative tools for estimating property values and evaluating market developments. This marked a significant departure from the traditional approaches to real estate valuation. (No Longer Nomads: The History of Real Estate, n.d.) Contemporary online real estate platforms, exemplified by giants like Idealista, Fotocasa, Zillow or Trulia, have ascended to vital roles within the industry. These platforms offer a wealth of property listings, interactive maps, and valuation estimates. They empower consumers, real estate professionals, and investors with the ability to make more informed and data-driven decisions. The historical evolution of the real estate business, transitioning from localized, informal transactions to a global, data-driven marketplace, sets the stage for envisioning the potential future of the industry. In this context, the emergence of predictive modelling tools becomes a core consideration. These tools, yet to be precisely defined in this exploration, hold the promise of shaping the next era of real estate analysis. As we peer into the horizon of the real estate market, the prospect of predictive models influencing decision-making 1 Three property valuation approaches commonly used by real estate appraisers to estimate fair market value.
Predictive Business Analytics for Real Estate 8 emerges as a focal point. The evolving nature of technology and the persistent adaptability of the real estate sector suggest a future where advanced analytical tools play a transformative role. This marks an exciting juncture, opening avenues for exploration and innovation in the ongoing narrative of real estate analysis. 2.3 Investment in Real Estate Where properties serve as more than dwellings, investors navigate a path marked by income generation and strategic financial growth. This journey, encompassing both residential and commercial avenues, seeks to leverage tangible assets for wealth creation. It becomes essential to comprehend the diverse avenues available for investment, each with its unique characteristics and implications.(Investment Real Estate: Meaning, Benefits, Risks, n.d.) Investment in real estate can take various forms, each presenting distinct advantages and challenges. One notable avenue, highlighted by Forbes, is investing in personal residences which emerges as a common yet foundational strategy for wealth building. Owning a primary residence provides not only shelter but also the potential for equity accumulation, with the possibility of capital appreciation over time. This avenue, supported by government programs, serves as a starting point for many individuals in their real estate investment journey. For those willing to delve deeper, the path often leads to rental properties. These properties, whether for long-term or short-term rentals, offer avenues for steady cash flow and potential appreciation. Managing rental properties, however, demands a more hands-on approach, involving tenant management, ongoing maintenance, and financial considerations. This avenue, while potentially more profitable, requires a strategic knowledge of mechanics and property management. Another strategy is Flipping properties, which consist in buying and renovating properties for resale, represents a more active and risk-intensive approach to real estate investment. As outlined by Forbes, this strategy involves identifying up-and-coming neighbourhoods, understanding renovation costs, and predicting trends. While potentially lucrative, it demands a keen expertise of the local real estate market and a willingness to take on the challenges of property renovation and speculation. (How To Invest In Real Estate – Forbes Advisor, n.d.) Investing in real estate, whether through personal residences, rental properties, or property flipping, requires a further comprehension of market as carries inherent risks, including
9 significant upfront capital and challenges. Mitigating these risks requires effective management, aligning with the principles of business analytics in optimizing decision processes. This exploration of investment lays the groundwork for a deeper analysis in subsequent sections of the thesis. The convergence of real estate investment and analytical capabilities becomes particularly relevant as we consider the potential integration of predictive models to determine property values, assess fairness, and identify optimal investment opportunities—an aspect to be further elucidated. 2.4 PESTEL Analysis Real estate, a colossal and multifaceted domain, is deeply entrenched in the active interplay of external factors. Knowing these influences is essential for making informed decisions and navigating the complexities of real estate transactions. The PESTEL 2 analysis offers a structured framework to dissect the macro-environmental factors shaping the real estate business. Given its enormity, it becomes imperative to narrow the focus of analysis. This section centers its attention on the Spanish real estate market, acknowledging the uniqueness of its political, economic, social, technological, environmental, and legal dimensions. Spain, with its rich variety of regions, presents a diverse real estate environment. The PESTEL factors, when applied to the Spanish context, unfold a narrative of political decisions influencing zoning regulations, economic conditions dictating trends, societal preferences shaping housing demands, technological innovations transforming transactions, environmental considerations influencing property valuations, and legal frameworks defining the boundaries. Within the broader canvas of Spain, Catalonia emerges as a distinctive focal point. Acknowledging the regional variations in legal frameworks, socio-economic structures, and political affairs, this analysis will delve deeper into the Catalonian subset of the Spanish real estate market, as we familiar with the factors influencing it, giving that is our home territory. By doing so, we aim to discern localized nuances that may exert unique influences on investment opportunities and market behaviour. 2 PESTEL analysis is a strategic tool that assesses the Political, Economic, Social, Technological, Environmental, and Legal factors influencing an organization or industry.
Predictive Business Analytics for Real Estate 10 This scope not only recognizes the vastness of the real estate but also directs our attention to the specific details that define the Spanish and Catalonian contexts. The subsequent sections will explore each PESTEL factor in detail, providing information for spotting trends, mitigating risks, and optimizing real estate decisions. 2.4.1 Political Within the broader context of Spain, Catalonia has emerged as a distinctive focal point, marked by its unique political circumstances. The region has been at the center of discussions surrounding its push for independence from Spain, leading to a complex political discussion that intertwines with various aspects of society, including the real estate market. According to a study conducted by Fotocasa, the ongoing political situation in Catalonia is not the primary concern for individuals searching for housing in the region. The study reveals that the exorbitant cost of housing remains the foremost deterrent, identified by 47% of respondents, followed by the unavailability of suitable properties (20%), limited options in desired areas (11%), and challenges in securing mortgages (9%). Interestingly, only a small percentage, 6%, attributes the current political situation as a hindrance to property acquisition. This aligns with the idea that soaring property prices, increasing at an annual rate of 10% (12% in the province of Barcelona), exert a more significant impact on accessibility than political uncertainties. Moreover, a substantial portion of Catalans, 47%, remains optimistic about the resilience amid political uncertainty. They believe that the political climate won't diminish Catalonia's appeal for foreign investors, and, in fact, foreign interest is seen as a driving force behind rising property prices. Around 38% of respondents suggest that Catalonia's attractiveness to foreign businesses contributes to the continuous escalation of housing costs. (La Situación Política Catalana No Preocupa a Los Que Buscan Casa, n.d.) The government of Catalonia, led by President Pere Aragonès, has taken proactive measures to address housing challenges. With plans to add 10,000 new rental properties to the public housing sector in the next three years, the government has acquired 385 vacant homes, primarily from major property owners, for social rentals. This initiative aims to redirect properties away from speculative practices and towards fulfilling the fundamental right to housing for the citizens of Catalonia. The government's commitment to regulating the rental market to curb price increases is evident. The recent purchase of 385 homes is part of a broader strategy to acquire 1,500
11 properties, with an investment of 150 million euros, contributing to an 18% growth in Catalonia's social rental housing sector. This approach reflects a significant shift in Catalonia's housing policy, emphasizing the transformation of housing from a commodity to a right. In summary, the political factor in Catalonia's, while a consideration for some, is not the predominant driver of market dynamics. The government's proactive measures to increase social housing and regulate the rental market reflect a commitment to addressing housing challenges, irrespective of political uncertainties. The real estate market in Catalonia, marked by its resilience, continues to witness positive trends, with ongoing efforts to strike a balance between market forces and the right to affordable housing. 2.4.2 Economic For conducting our economic analysis, we embark on a comprehensive exploration of influential indices that hold sway over the sector's economy. This meticulous study aims to furnish us with a nuanced appreciation of the sector's health, offering valuable perspectives into its current state and discerning potential trends and possibilities. Pre-COVID Situation The economic crisis that affected Spain between 2009 and 2013 left a significant impact on various sectors, with the construction industry being one of the hardest-hit. During this critical period, the construction sector experienced a substantial loss of 1,430,400 jobs, accounting for 43% of the total jobs destroyed across the economy. The subsequent economic recovery, starting in 2014, showed signs of improvement, although the construction sector only managed to regain 192,300 jobs by 2018. This figure represented 8.7% of the total job generation during the 2014-2018 economic expansion period. Now, looking at the situation of the housing sector in Catalonia before the pandemic, it becomes evident that the real estate market was in an expansion phase since 2015, recording five consecutive years of modest growth. This sustained growth significantly contributed to Catalonia's economic boost in 2018, representing 4.7% of the YoY 3 in 3 YoY: Stands for "Year over Year," and it is a financial term used to compare a metric or performance data for one year against the same period in the previous year
Predictive Business Analytics for Real Estate 12 Catalonia's GDP. Although this percentage positioned the construction sector as a leading driver in the Catalan economy, it still remained below pre-crisis levels. Figure 1. Housing sales and purchases from 2017 to 2019 in Catalonia (Source: INE) In terms of employment, construction had a notable impact on the Catalan labour force. With over 215,000 direct workers, it accounted for 6.4% of the occupied population in Catalonia, surpassing 3.3 million people. Furthermore, the sector experienced a significant reduction in unemployment in Catalonia in 2018, with a decrease of 13.7%. (Departamento de Economía Informe Sector Vivienda 2 CONTENIDO, n.d.) These data underscore the importance of the construction and housing sector in the Catalan economy before the pandemic, both in terms of GDP contribution and job creation. During and after COVID situation In the context of Catalonia's real estate market during the pandemic, some interesting trends emerge. While the purchases of new homes showed resilience with sustained growth in prices, there was a noticeable decline in transactions for existing homes. This shift in preference is speculated to be a consequence of the pandemic, with individuals showing an increased interest in more spacious homes, often located in non-urban settings, and better suited for remote work. The Bank of Spain's Annual Report for 2020 suggests a correlation between changing housing preferences and the observed market trends. In terms of pricing, new homes experienced a increase in 2020 of 8.6%, reflecting the heightened demand for this category. Conversely, prices for existing homes saw a more moderate growth of 1.3%, representing the smallest increase since 2014.
13 Figure 2. YoY rate of new and used housing sales and purchases in Catalonia 2008-2020 (Source: INE) Turning to the rental field, data from the Government of Catalonia in 2020 indicates stable rental rates. However, there was a significant drop in the number of signed rental contracts, likely a consequence of reduced activity during the confinement period. These observations offer interesting perspectives on the changing composition of the Catalan real estate market and an informed grasp of customer behaviour both during and after the pandemic. (Resumen del Informe anual de la economía catalana 2020, n.d.) The recent report from “API 4 Catalunya” sheds light on the current state of the real estate market in Catalonia, providing valuable feedback into trends and projections for 2023. Despite an impending shift in market dynamics, Catalonia stands out as one of the regions with a strong and resilient real estate sector. In 2022, Catalonia experienced a substantial 14.7% YoY growth in real estate transactions, marking a significant upswing with 102,231 recorded sales. However, the last quarter of the year saw a 10.9% quarterly decline, reflecting 24,038 transactions. This dip, while 4 API Catalunya; Colleges and association of real estate agents.
Predictive Business Analytics for Real Estate 14 noteworthy, is not a cause for alarm among real estate professionals, as it aligns with an anticipated trend of normalization for upcoming years. Barcelona continues to dominate the provincial territory, representing 64% of total home sales in Catalonia during the last quarter. Other provinces, with varying degrees of growth or decline, contribute to the overall narrative of a strong and resilient market. The analysis suggests that nearly all provinces, with the exception of Lleida, have reached pre-2007 highs, solidifying Catalonia's position as a solid and enduring real estate market. Predictions for next year’s anticipate a slight decrease in transactions compared to the exceptional figures of 2022. This shift is seen as a part of a broader trend signalling market normalization, reassuring real estate professionals about the market's stability. Foreign demand continues to be a pillar of strength for the real estate market in Catalonia. In the fourth quarter of 2022, foreign buyers accounted for 15.6% of transactions, totalling 3,745 purchases. This international demand is projected to remain a differentiating factor in 2023. (API Catalunya: “Vamos Hacia Una Normalización Del Mercado En Compraventas” - Yaencontre, n.d.) On the pricing front, there's evidence of a slowdown in the growth rate during the second half of 2023. This moderation, while ongoing, is perceived positively as it helps maintain potential buyers. The average price per square meter reached €2,062, reflecting a 0.23% YoY increase, reaching a peak not seen since 2011. Table 1. Overview of the property market in Catalonia (Source: INE) Indicator Data Housing Prices (IPV) Q3 2023 3.78% YoY Home Sales in September 2023 -28.84% YoY Home Sales in September 2023 -21.86% YoY Average Price per Square Meter, Sep 2023 €2,062/m2 (0.23% YoY) Number of Mortgaged Homes, Sep 2023 5,291 (-31.82% YoY) Mortgage Foreclosures, Q3 2023 -23.34% YoY
15 Figure 3. Comparison of average house prices in Catalonia with those in Spain (Source: Consejo general del Notariado) In conclusion, the economic factor plays a major role in shaping the region's business environment. The economic stability, growth trends, and resilience demonstrated by Catalonia post-COVID-19 showcase the strength of the real estate market. Factors such as foreign demand, moderate price increases, and a diverse housing panorama contribute to the region's economic strength. However, challenges persist, including the need for sustained policy focus on affordable housing and addressing disparities between income growth and rising rental prices. The post-pandemic period has seen a shift in preferences, influencing housing types and market nature. Navigating these changes requires a balanced strategy that considers both internal and external economic factors, fostering adaptability and sustained growth in Catalonia's real estate sector. 2.4.3 Social The housing sector has undergone a profound transformation, spurred by the social repercussions of the COVID-19 pandemic. This investigation sheds light on important trends and transitions in the housing market by exploring how changing social factors shape the preferences and actions of homebuyers. The emergence of Centennials, born between the mid-1990s and the early 2000s, is redefining the process of homebuying. Darya Homes notes that these digital-savvy individuals view their first home as an investment, often acquiring property at an earlier age
Predictive Business Analytics for Real Estate 22 balanced, transparent, and inclusive housing market. The structure of the Spanish housing sector will be shaped in the coming years by the effects of these law reforms. 2.4.7 Overall Conclusion The PESTEL analysis has shed light on the intricate external factors shaping Catalonia's real estate context. While the industry grapples with challenges in political interventions, economic uncertainties, societal demands for sustainability, and legal transformations, it becomes evident that there is room for significant improvement. The sector's resilience is apparent, yet opportunities for innovation and positive disruption persist. Prevailing issue of high property prices, often perceived as inequitable, underscores a pressing need for transformative solutions. In response, the integration of digital tools emerges as a promising avenue. Catalonia's real estate industry stands on the cusp of a digital revolution, offering ample space for innovative technologies to address existing deficiencies. The current opacity in pricing patterns leaves potential buyers and tenants navigating uncertainties. Introducing a predictive tool harnessing machine learning algorithm could usher in a data-driven approach to pricing, thereby enhancing fairness and accuracy. Successfully navigating these influences demands strategic foresight, with sustainability, technological integration, and legal compliance emerging as focal points. As the industry evolves, aligning with these external factors will be critical for success, ensuring resilience and responsiveness to the ever-changing real estate picture.
23 3 Methodology We are going to outline the systematic approach undertaken to fulfil the objectives of this thesis, delineating the precise steps, techniques, and tools essential for solving the research problem at hand. This strategic roadmap serves as the backbone of our work, guiding the development of a Predictive Business Analytics tool for estimating and analysing housing prices in the ever-changing real estate market. Each step in this methodology is designed to ensure a comprehensive and insightful exploration of the subject matter, offering a structured path towards achieving the goals of the research endeavour. The ensuing sections unfold the procedural complexity, providing clarity on the methodology's application in navigating the complexities of real estate analytics and predictive modelling. 3.1 Definition This phase involved an examination of the thesis's object, focusing on establishing a clear vison of the goals within the real estate context. We carefully shaped the boundaries and parameters of our study, identifying specific aspects that our predictive analytics tool would address. Additionally, we identified the essential requirements for a successful development. We laid the groundwork for the subsequent phases and clarified the rationale for our research, addressing the motivations for conducting this work. This preliminary analysis served as the basis for subsequent steps, ensuring that our approach is strategically aligned with the complexities. It provided a comprehensive and effective starting point for the exploration of the following sections. 3.2 Context In the background and review of the state of the art, the methodology involved a systematic exploration of major elements within the real estate domain. The sequence began by defining the fundamental concept of real estate, followed by a historical examination of its evolution, providing a foundation for understanding the current state of the real estate sector. The focus then shifted to the peculiarities of real estate investment, examining motivations and various investment modalities. Subsequently, a PESTEL analysis was applied, systematically evaluating the industry's macro-environmental factors, including political, economic, social, technological, environmental, and legal influences.
Predictive Business Analytics for Real Estate 24 This methodological approach encompassed a literature review to assimilate existing knowledge, coupled with meticulous data collection to support historical trends. Significant factors impacting the real estate market's direction were identified through a careful examination, and the results were combined into a coherent narrative. Throughout this process, the methodology ensured a clear linkage of the knowledge gained from the background and state-of-the-art review to the overarching objectives of the thesis. This establishes a good foundation for subsequent phases of research and development, aligning the predictive analytics work with a profound comprehension of the nuances and contextual influences within the real estate industry. 3.3 Predictive Model This phase is defined in several work modules that are important to detail in order to have a clear idea of what is going to be done: 3.3.1 Data Obtention Idealista is our main source throughout the data obtention phase. It was deliberately selected because it has a far larger monthly visiting rate than Fotocasa. With Idealista boasting around 50 million monthly visits as opposed to Fotocasa's 14 million, the decision is informed by a commitment to tapping into a more extensive and flexible dataset. (¿Qué Portal Inmobiliario Es Mejor Idealista o Fotocasa?, n.d.) However, the process of data extraction from Idealista necessitates a careful approach. While the website is open to the public, utilizing it directly is not feasible due to security and privacy concerns. Although the information is publicly accessible, the ability to manipulate and work with this data is restricted to the platform itself, a common scenario across industries. To overcome these constraints, we are going to leverage Application Programming Interfaces (APIs). APIs serve as a conduit for users to access and work with platform data swiftly and efficiently using the company's proprietary code. It is important to note that most APIs are not freely accessible; obtaining permission from the entity is essential. We have secured this permission, specifically for educational purposes to support the fieldwork associated with this thesis. Even with access, limitations are imposed for security reasons. Upon gaining access to the Idealista API, we adhere to the provided code instructions to extract the specific data of interest. This process enables us to navigate the platform securely and retrieve the requisite information for our predictive model development.
25 3.3.2 Data Handling With a targeted approach, we turn our attention to data cleaning, placing special emphasis on fields directly influencing the analysis. To do so, we are going to use the R coding language, a proficiency acquired during our master's program. R, in simple terms, is a versatile programming language that provides a wide range of statistical techniques and visualization tools, enabling effective and straightforward work with large volumes of data. This choice is informed by R studio (software to run R) capacity to draw meaningful conclusions, facilitating the extraction of results applicable to various contexts and fields. Cleaning the data involves a focused examination of variables that can significantly impact dwelling prices, ensuring the dataset's quality and relevance. Our process addresses inconsistencies, manages missing values, and refines the dataset, enhancing its usability for subsequent analysis. 3.3.3 Global Analysis Our analytical endeavour extends to a detailed exploration of various dimensions within the dataset. We visually conduct comprehensive correlations between variables, such as the number of rooms or bathrooms, and property prices, unravelling influential factors Simultaneously, we examine the distribution of properties across different price ranges, categorizing them to provide a comprehensive view of market segmentation. This analysis aims to identify potential trends, outliers, and factors contributing to pricing variability. Geographical variations across districts are a focal point, with spatial analysis revealing patterns related to location and its impact on pricing. Region-specific findings are informed by this perspective. In essence, our global analysis phase delves into hidden relationships, preparing a solid foundation for subsequent stages of predictive model development. Through a meticulous examination of variables and spatial dynamics using R coding functions, we aim to extract meaningful tendencies that will inform the creation of an accurate and reliable predictive analytics tool for the real estate sector. 3.3.4 Predictive Model Development Harnessing the power of machine learning, we embark on the creation of our predictive model. This multifaceted process involves utilizing specialized packages in the R programming language, where we can seamlessly integrate regression techniques and
Predictive Business Analytics for Real Estate 26 sophisticated machine learning algorithms. Leveraging these tools, we meticulously train our model using an enriched dataset, ensuring it captures the intricacies of the real estate market. In the realm of regressions, we delve into statistical models that elucidate relationships between various factors, offering insights into how specific features influence housing prices. Additionally, the application of machine learning introduces an ongoing layer to our predictive model. By employing algorithms designed to learn and adapt from data similarities, we enhance the model's ability to make accurate predictions in the everevolving real estate business. As we refine our model, we prioritize fields that wield substantial influence on predictions, ensuring that the model is not only accurate but also relevant to the specific characteristics of the real estate market under scrutiny. This iterative approach fortifies the robustness of our predictive model, equipping it to navigate complexities and deliver precise estimations. Simultaneously, our predictive model undergoes rigorous testing and comparison against the existing dataset. This crucial step involves validating the model's predictions against actual data, gauging its efficacy, and iteratively refining it for enhanced accuracy. Systematic testing, grounded in statistical rigor and machine learning principles, guarantees the reliability and applicability of our predictive model in estimating housing prices with a high degree of confidence.
27 4 Integrated Approaches for Data Analysis In developing a predictive business analytics tool for estimating and analysing housing prices, various alternative solutions were considered to ensure an effective approach. 4.1 Business Analytics In business, extracting quality data is significant but how that data is used is really what matters most. Business analytics, the process of comparing, classifying, processing, and studying business data, uses statistical models and iterative methodologies to transform data into business outcomes. In essence, business analytics processes the enormous volumes of generated data to obtain synthesized and summarized information, facilitating business decision-making. Within business analytics, three main areas can be identified: • Descriptive Analytics: Analysing historical data to identify patterns and trends. • Predictive Analytics: Using both past and present data to determine the probability of future events. • Prescriptive Analytics: Determining new ways of operating to help the company achieve its objectives. (Three Types of Business Analytics | University of Bath Online, n.d.) The real estate sector generates a massive volume of structured and unstructured data every day, what is known as “Big Data”. The advent of advanced technologies, notably the application of tools like Excel, has led to the rapid accumulation of data characterized by its Volume, Velocity, and Variety, as coined by Doug Laney. The ever-growing data landscape has expanded to include Variability and Veracity, reflecting the dynamic and sometimes uncertain nature of the information. In the context of housing prices, the challenges presented by big data are significant. The sheer diversity and size of the data generated make it difficult to manage and process efficiently. The velocity at which data changes adds an additional layer of complexity, requiring businesses to adapt swiftly.
Predictive Business Analytics for Real Estate 28 4.2 Challenges and Opportunities Navigating the expansive realm of big data and business analytics in the housing sector unveils a dichotomy of challenges and opportunities. Diverse data origins and types, spanning property listings to market reports, present a significant integration hurdle. Simultaneously, the immense volume of data demands sophisticated infrastructure for timely and quality processing. The constant and rapid changes in real estate data add complexity to accuracy validation, necessitating agile systems for swift adaptation. A significant concern arises in the choice of methods for data analysis. Traditional methods, exemplified by tools like Excel, coexist with more advanced approaches, such as the utilization of the R programming language. Each method brings its own set of challenges and opportunities to the forefront. Traditional methods like Excel, while familiar and accessible, may face limitations in handling the complexities of big data. The challenges associated with diverse data sources and the sheer volume of information can strain the capabilities of conventional tools. Embracing new methods, such as employing the R programming language, opens new horizons in addressing these challenges. R's flexibility, rich statistical packages, and adaptability to large datasets provide opportunities for more efficient and effective analysis. Innovation in data integration techniques, whether applied to traditional or new methods, opens new horizons, addressing the challenge of diverse data sources. Simultaneously, the adoption of agile systems capable of handling real-time data changes provides an opportunity to maintain accuracy and relevance. In essence, while challenges are inherent, the adept navigation of these hurdles unveils opportunities for innovation, efficiency, and strategic advantage. The integration of big data and business analytics in real estate analysis, whether through traditional or new methods, serves not only as a response to challenges but as a proactive approach to leveraging the vast potential embedded in the dynamic landscape of real estate data. 4.3 R Programming Language R, belonging to the family of tools developed for big data, becomes the bridge that connects the enormity of real estate data with the analytical power of business analytics. Its flexibility, rich statistical packages, and adaptability to handle large datasets make it an ideal choice. As we embark on developing a predictive model for estimating housing prices, R emerges as the linchpin that not only analyses historical patrons but propels analysis into the realm of accurate predictions and optimal strategy prescription. Integrating business analytics with big data within the R environment unlocks the potential for an in-depth knowledge of market
29 trends and empowers organizations to make data-driven decisions with confidence. The transparent and reproducible nature of R's coding approach aligns seamlessly with the imperative for businesses to validate and communicate effectively. By harnessing the capabilities of R, the predictive model not only becomes a tool for estimating housing prices but also a conduit for businesses to navigate the dynamic landscape of real estate with precision and agility. The selection of the R programming language stands out as a strategic and potent decision. R's proficiency in handling extensive datasets, coupled with its integration capabilities, including interaction with APIs and webpages, elevates our model's dynamism. Finally, R's mastery in executing precise regression analyses through renowned function building a firm foundation for constructing accurate predictive models. This adaptability extends to handling the convoluted nature of large and diverse real estate datasets, reinforcing the strategic choice of R for our comprehensive analysis.
Predictive Business Analytics for Real Estate 30 5 Discussion of the solution We are going to define the steps and methodologies employed in developing the predictive business analytics tool for housing price estimation. Accuracy and relevance are given priority throughout the process, which starts with careful data collection utilising sophisticated web scraping techniques and ends with using the flexibility of the R programming language for analytical research. This section explores the thoughtful decisions that were made when building the predictive model, with a focus on feature selection, sophisticated modelling strategies, and rigorous metrics for assessment. This analytical approach is a testament to the dedication to accuracy that produced a reliable instrument suitable for efficient estimation. 5.1 Data obtention The initial phase of our solution holds paramount importance, as without data, conducting analysis or developing a model would be an insurmountable task. However, the significance extends beyond mere data; we require high-quality, realistic, and well-organized data. In the realm of programming, several techniques fall under the umbrella of "web scraping," enabling the extraction of data from various real estate listing websites. These techniques involve structured calls to a website based on its source code, prompting the website to return the requested information. However, the challenge lies in the fact that massive, automated calls to the website's source code may be flagged by the hosting company as a "data scraping algorithm," even if the information is publicly available often lack official support from the companies hosting these property advertisements. Companies invest significant capital and infrastructure to display property listings on their websites, and they do not appreciate automated calls that resemble data scraping algorithms. Consequently, engaging in such mass data retrieval can lead to IP bans, restricting further access to the desired information. To address this challenge, companies like Idealista, which advertise properties, provide official support and a more efficient avenue to retrieve their data, known as Application Programming Interfaces (APIs). This methodology allows authorized access to their source code, offering a structured and organized database of their actual property listings. The API requires a secret personal key for authentication during calls, and a set of instructions guide the integration of the API into the programming language being utilized. It's noteworthy that obtaining and integrating this API is not a straightforward process.
31 Obtaining access typically involves meeting certain requirements, and in many commercial use cases, there may be associated costs payable to the property advertising company. However, in specific instances, such as academic endeavours like this project, contacting the company may grant access to the API key at no cost. It's important to note that there are some limitations on monthly calls to their webpage for the educational access, such as a cap of 100 requests, which each request can return a maximum of 50 advertisements. Proficient knowledge of the programming language in which the API will be implemented, in this case, R, is imperative. This entails using specific packages/libraries to navigate the API's steps and developing the necessary code to extract only the desired data. Advanced programming skills are essential for a successful implementation, underscoring the complexity of this process. Given that this project adhered to the requirements outlined by Idealista for obtaining API access for educational purposes, I reached out to them. They promptly provided me with a personal key, enabling the development of the API as an authorized user. Additionally, they shared best practices for a proper implementation and explained how they structure data on their website, ensuring accurate extraction of information. 5.1.1 Set up of the software From now on, the solution will be built with R and R Studio. Determining the packages or libraries that will be utilised during the development process is imperative: • tidyverse: Collection of packages designed to make data manipulation, visualization, and analysis easier and more efficient. • tidymodels: A framework for modelling and machine learning tasks, providing a consistent and tidy interface for model building and evaluation. • jsonlite: Tools for working with JSON data (structure of API data), allowing for easy conversion between JSON and R data structures. • httr: A package for handling HTTP requests, essential for interacting with web APIs. • data.table: Offers efficient data manipulation with data tables, particularly useful for large datasets. • ggplot2: Package for creating visually appealing and customizable graphics. • patchwork: Allows for the combination of multiple ggplot2 plots into a single composite plot.
Predictive Business Analytics for Real Estate 38 7 Chr propertyType The type of property (e.g., chalet). 8 Chr operation The type of real estate operation (e.g., sale). 9 Num size The size of the property in square meters. 10 Int rooms The number of rooms in the property. 11 Int bathrooms The number of bathrooms in the property. 12 Chr address The address of the property. 13 Chr province The province where the property is located. 14 Chr municipality The municipality where the property is located. 15 Chr district The district where the property is located. 16 Chr country The country where the property is located. 17 Chr neighborhood The neighborhood where the property is located. 18 Num latitude The latitude coordinate of the property. 19 Num longitude The longitude coordinate of the property. 20 Logi showAddress Indicator variable for displaying the property address. 21 Chr url The URL link to the property listing. 22 Int distance The distance metric associated from the origin point defined in the API. 23 Chr description A detailed description of the property. 24 Logi hasVideo Indicator variable for the presence of a video. 25 Chr status The status of the property listing (e.g., good). 26 Logi newDevelopment Indicator variable for a new development. 27 Logi parkingSpace Indicator variable for the availability of parking space. 28 Int priceByArea The price per square meter area. 29 Logi hasPlan Indicator variable for the availability of a floor plan. 30 Logi has3DTour Indicator variable for the availability of a 3D tour.
39 31 Logi has360 Indicator variable for the availability of a 360-degree view. 32 Logi hasStaging Indicator variable for staging information. 33 Logi topNewDevelopme nt Indicator variable for a top new development. 34 Logi superTopHighlight Indicator variable for a super top highlight. 35 Chr floor The floor information of the property. 36 Logi exterior Information about the property's exterior. 37 Logi hasLift Indicator variable for the presence of a lift. 38 Logi newDevelopmentFi nished Indicator variable for the completion of a new development. Where: • Chr (Character) represents categorical or text data. It is used for variables that contain strings or characters. • Int (Integer) store whole numbers without any decimal places. These are typically used for counting or representing discrete values. • Num (Numeric) store numerical values, including both integers and decimals. They are suitable for continuous data and allow for mathematical operations. • Logi (Logical) are binary, representing either TRUE or FALSE values. They are used for categorical data with two possible outcomes or to indicate the presence or absence of a condition. As observed in the set of variables, there are some that are of interest for study, others that are not relevant, and some for which it is beneficial to apply a change in variable typology for the study. Thus, before initiating the dataset analysis, it is imperative to clean the dataset to ensure a high-quality analysis. As part of this procedure, variables that aren't important are eliminated, variable types are changed or transformed, and the data is made ready for insightful analysis.
Predictive Business Analytics for Real Estate 40 5.2 Data handling This subsection is dedicated to the systematic refinement and enhancement of the dataset, aiming to improve its quality, organization, and consistency. The implemented procedures focus on creating a more structured and reliable dataset, laying the groundwork for subsequent stages of analysis and modelling within the data science workflow. The overarching objective is to produce a refined dataset that ensures the reliability of predictions in later stages. We have considered it important to provide the code snippet corresponding to each step we performed in this phase, so you can see the explanation of the action and how was implemented. The process commenced with a strategic selection of variables, eliminating those deemed superfluous to streamline the dataset and focus on those features relevant to the analysis. For instance, variables like "thumbnail" or “description” were omitted as they lack information directly influencing the property itself. Similarly, variables such as "has3dTour" or "has360" were deemed irrelevant for price analysis, serving primarily to enhance advertisement appeal. Additionally, certain variables like "municipality", "country", and "province" were considered non-influential, as they remained constant throughout the entire dataset. #Delete superfluous variables Ter_dataset <- Ter_redata %>% select(-X, -thumbnail, -externalReference, -operation, -address, -prov ince, -municipality, -country, -showAddress, -description, -hasVideo, -hasPlan, -has3DTour, -h as360, -hasStaging, -superTopHighlight, -topNewDevelopment, -newDevelopm entFinished) Next, a crucial standardization step was performed to ensure uniformity in logical values. “TRUE” and “FALSE” were converted to numeric equivalents ‘1’ or ‘0’, establishing a consistent representation across the dataset. This transformation facilitated easier interpretation and analysis of logical conditions. # Convert 'TRUE' and 'FALSE' to 1 and 0 Ter_dataset <- Ter_dataset %>% mutate_all(~ifelse(. == TRUE, 1, ifelse(. == FALSE, 0, .))) Addressing missing values was imperative for maintaining the dataset's integrity. Rows with NA’s in “neighborhood”, a pivotal variable, were removed to prevent potential distortions in subsequent analyses. In the variables “exterior”, “hasLift” and “parkingSpace” where in many observations contain NA’s, assumptions were made. A value of '0' was imputed to
41 signify the absence of these conditions. This imputation was based on the rationale that if these conditions truly existed, the property's advertiser would likely highlight them, given their relevance to the property's value. # Keep only rows where "neighborhood" is not NA Ter_dataset <- Ter_dataset %>% filter(!is.na(neighborhood)) # Assuming NA's as a 0 in specific variables Ter_dataset <- Ter_dataset %>% mutate(exterior = ifelse(is.na(exterior), 0, exterior), hasLift = ifelse(is.na(hasLift), 0, hasLift), parkingSpace = ifelse(is.na(parkingSpace), 0, parkingSpace)) In the case of the variable "floor", a particular treatment was applied. Firstly, the variable "floor" was considered for observations where "propertyType=flat" If these observations contained an NA, the observation/property was removed as it lacked value, and there was no way to determine the specific floor, making it impossible to substitute with other values. This approach was chosen because there weren't many observations with this characteristic, and removing them still left a significant dataset. On the other hand, the variable contained a mix of numerical values and characters. For properties corresponding to bajos (ground floors) or entresuelos (mezzanines), "bj" or "en" was specified in the variable. Therefore, a value of ‘0’ was assigned to the ground floors, and a value of ‘0.5’ was assigned to the mezzanines, considering their position in a building, specifically, the ground floor is the level at ground level, and the mezzanine is the floor between the ground and the first floor in buildings where the housing doesn't start at ground level. Finally, for observations that still contained NA in the variable, meaning those that didn't correspond to "flat" in propertyType, a value of '00' was assigned, indicating that they are not part of a building. These likely represent chalets or country houses, and, consequently, the variable "floor" holds no value for them, so in order to preserve the variable and acknowledge its importance in other cases, this value was assigned instead of removing the variable. # Delete NA values in 'floor' for rows where 'propertyType' is 'flat' # Change values to 0 in 'floor' for 'bj', 0.5 for 'en', and '00' for the remaining NA's Ter_dataset <- Ter_dataset %>% mutate(floor = ifelse(propertyType == "flat", as.character(na.omit(flo or)), as.character(floor))) %>% mutate(floor = case_when( floor == "bj" ~ "0", floor == "en" ~ "0.5", is.na(floor) ~ '00', # Replace NA with '00' for other cases
Predictive Business Analytics for Real Estate 42 TRUE ~ floor # Retain other values )) Finally, specific cases with anomalies in the dataset were addressed, which were easily replaceable with realistic values. Variables were transformed into their appropriate data types; specifically, all variables that can only take a limited range of values were assigned the factor data type and most of the numerical variables were assigned as integers since they did not contain decimal values, making it impractical to treat them as such. # Convert selected variables to factors and integers Ter_dataset <- Ter_dataset %>% mutate(across(c(propertyType, rooms, bathrooms, district, neighborhoo d, status, newDevelopment, parkingSpace, floor, exterior, hasLift), ~as. factor(.))) %>% mutate(across(c(propertyCode, numPhotos, price, size, distance, priceB yArea), ~as.integer(.))) The complete part of this code can be found in section "4.3. Data handling" of the appendices. Final variables: 1. propertyCode (int) 2. numPhotos (int) 3. price (int) 4. propertyType (factor) 5. size (int) 6. rooms (factor) 7. bathrooms (factor) 8. district (factor) 9. neighbourhood (factor) 10. latitude (num) 11. longitude (num) 12. url (chr) 13. distance (int) 14. status (factor) 15. newDevelopment (factor) 16. parkingSpace (factor) 17. priceByArea (int) 18. floor (factor) 19. exterior (factor) 20. hasLift (factor) To sum up, the dataset has been successfully improved and refined by the data handling procedure, yielding a comprehensive dataset with 2,519 observations/properties, each with 20 variables. These changes—which included removing superfluous variables, filling in missing values, and changing data types—have made the dataset more dependable and well-organized. The dataset is now ready for the next global analysis, in which we will examine and evaluate the salient characteristics of the properties within a broader context.
43 5.3 Global Analysis Now that we have a solid and well-structured base in place, we can focus on doing a comprehensive analysis of the full dataset. Employing an array of visual representations, our objective is to illustrate the dynamics and patterns inherent within the dataset. This analytical endeavour is designed to furnish us with an initial comprehension of the intricate housing market situation in the city of Terrassa. This visual investigation serves as a first step in creating a prediction model. All graphical representations shown below have been meticulously crafted using R Studio code, leveraging the functionalities of the ggplot2 and patchwork libraries. The visualizations presented herein are a result of a complex process involving the dataset, aiming to provide a comprehensive and insightful portrayal of various aspects such as distribution, tends or interrelationship among key variables. While the focus is on delivering clear and illustrative graphics, in specific instances, snippets of the underlying code may be revealed. This decision is driven by the intention to enhance transparency and facilitate a deeper understanding of the methodologies employed, particularly in cases where showcasing the code adds value to the interpretation of the graphical outcomes. The integration of R Studio code underscores the rigor and reproducibility of the analyses conducted, fostering a basis for the subsequent discussions and insights derived from the visual representations. 5.3.1 Price distribution As we begin our exploratory study, our primary goal is to comprehend the price distribution in our dataset. The purpose of this basic review is to shed light on the spread, concentration, and fluctuation of housing prices.
Predictive Business Analytics for Real Estate 44 Figure 10. Distribution of price (Source: Author) The presented histogram illustrates a right-skewed distribution in housing prices, characterized by a longer tail extending towards higher values on the right side of the distribution. The right-skewed nature of housing prices is indicative of the presence of a subset of properties with exceptionally high values, leading to an elongated tail on the higher end of the price spectrum. This phenomenon aligns with the typical distribution of economic variables, where the majority of observations cluster around a central range, creating a positively skewed distribution due to the influence of extreme values. Within the context of housing prices in Terrassa, the histogram underscores that the bulk of properties falls within the range of €100k to €400k. However, the existence of properties exceeding €1,200k contributes to the right-skewed nature of the distribution, reflecting the influence of high-value outliers. Such outliers can significantly impact statistical measures and analyses, potentially leading to misinterpretations. To mitigate the impact of extreme values and facilitate a more normalized distribution 8 , a common practice is to apply a logarithmic transformation to the price variable. The logarithmic transformation compresses the scale of the variable, reducing the influence of extreme values and making relationships more discernible in the data. This transformation often proves valuable in enhancing the interpretability and comparability of housing price 8 Normal distribution or Gaussian distribution in statistics, is a symmetric bell-shaped probability distribution where most data points cluster around the mean, demonstrating a characteristic pattern of variability.
45 data, allowing for more accurate forecasts when developing a predictive model as we delve into the subsequent sections. Figure 11. Distribution of logarithm of price (Source: Author) As observed, this histogram now bears a closer resemblance to a normal distribution, given its more compressed form resulting from the application of the logarithm. 5.3.2 Property types distribution and value Now we are going to assess the distribution of various property types in the dataset, figuring out the prevalence of each type of property and their relative frequencies. Figure 12. Number of properties for each property type (Source: Author)
Predictive Business Analytics for Real Estate 46 The majority of properties in our dataset are flats, followed by chalets, while studios and country houses are less frequent. This distribution aligns with the nature of Terrassa, being a large city predominantly composed of buildings, resulting in a higher prevalence of flat listings for sale. You can also see the distribution of property types for each neighbourhood in the city of Terrassa in section "5. Global Analysis" of the appendices. It is interesting to check it because in some neighbourhoods the number of flats is not so predominant, so that types of housing such as country house or chalets that are usually more expensive take more importance and therefore makes the median value of that neighbourhood higher. The distribution of prices by type of property can be seen in the following boxplot: Figure 13. Distribution of prices by property type (Source: Author) The graph confirms the previous statement where chalets and country houses have the highest price range of 200k to 400k and 400k to 800k respectively. Nevertheless, in the following chart we will show the median prices for each district (set of neighbourhoods), this provide a measure of central tendency, providing the typical pricing trends within each district.
47 Figure 14. Median prices by district (Source: Author) The median, representing the middle value when housing prices within a district are arranged in ascending order. Unlike the mean, the median is less sensitive to extreme values, offering a more reliable indicator. The bar chart illustrates that districts with the highest median prices include "Can Palet de Vistalegre", "Can Gonteres" and "Centre" with respective values of €580k, €480k, and €330k. Conversely, districts such as "Can Jofresa - Can Perellada - Les Fonts", "La Maurina" and "Can Palet - Xúquer" exhibit the lowest medians, each falling below €200k. While it's expected that "Can Palet de Vistalegre" and "Cangonteres" boast higher median prices due to a prevalence of chalets or country houses, known for their higher costs, what's intriguing is the "Centre" district. Despite primarily featuring flats, property type with lower price ranges, it ranks as the third district with the city's highest median. This suggests that properties within the "Centre" district may command a higher value, a trend similarly observed in districts with the lowest median, albeit in the opposite direction. Upon reviewing the median prices of flat properties across districts, allowing for a comparison of different districts within the same price range per property, we observe that:
Predictive Business Analytics for Real Estate 54 Figure 21. Comparison between having lift, the floor of the property and price (Source: Author) It is evident across nearly all cases that the property's median price increases when it is equipped with a lift. In properties ranging from the ground floor '0' to the 3rd floor, there is a price difference of €50k, while in the floor ranges from the 4th to the 10th floor, the price difference exceeds €50k. This discrepancy coincides with the common expectation that the higher the floors, the greater the value of the lift. Clearly, the elevator variable significantly influences the property's price. Let's now explore the parking variable: Figure 22. Comparison of parking space by property type (Source: Author)
55 The availability of parking in a property is not prevalent in our dataset, as we have just observed. In fact, in the predominant property type, "flat," there are only approximately 480 properties with parking, while the rest do not have it. This clearly suggests that if a property has parking, it is likely to increase in price, given that it is not a common feature but rather a distinctive convenience. Other analyses, including the state of homes by neighbourhood and the comparison of exterior and interior properties, are included in the appendices ' "5. Global Analysis" section. Furthermore, the complete development of the entire subsection we just studied, including all the codes used to create the visualizations, is available for reference. In order to sum, we uncovered significant observations: 1. Price Distribution: The dataset exhibited a right-skewed price distribution, common in economic fields. Logarithmic transformation normalized the distribution, enhancing interpretability. 2. Property Types: Distinctive patterns emerged when analysing property types. For instance, "chalet" and "country house" tended to command higher prices, while "flat" dominated the market with the most frequent listings, shaping overall pricing dynamics. 3. Geographical Impact: Property location, particularly in central districts, significantly influenced pricing trends. 4. Property Characteristics: Different clues were obtained by identifying correlations between size, price, number of rooms, and bathrooms. 5. Other Factors: Lift availability showcased a clear price discrepancy, while parking space, less prevalent, indicated potential impacts on property value. These findings contribute to a exhaustive learn of the Terrassa housing market, essential for informed decision-making. This knowledge sets the groundwork for predictive modelling, enabling more accurate forecasts and strategic planning in the real estate domain.
Predictive Business Analytics for Real Estate 56 5.4 Predictive Model Development This subsection turns our attention to the creation of prediction models that seek to determine a property's market value in euros in the city of Terrassa by considering a variety of its qualities. The target variable – price – is continuous; hence this creates a regression or numerical prediction challenge. We will build several prediction models using R language techniques that are covered in the following parts, and we will compare them with statistical metrics to find the best performing model. After a model has been chosen, an attempt will be made to optimise its performance by modifying parameters that have a substantial influence on the prediction outcomes, with the goal of minimising error. In order to figure out this study as precisely as possible, this section considers the thorough examination that was carried out during the project. This section includes a substantial portion of the developed code to create the predictive model, as it is vital to comprehend the underlying processes. However, you can see all the code of the process in section "6. Numerical prediction" of the appendices. 5.4.1 Creating train and test sets Before constructing our predictive models, we start by removing unnecessary variables from the dataset, such as longitude and latitude, which serve a similar purpose as the distance variable, indicating the distance from the city center. Subsequently, we divide the dataset into training and testing sets. The training set is utilized to train the model, exposing it to a portion of the data, while the testing set remains unseen during the training phase. This approach allows us to assess the model's performance on new, independent data, ensuring its ability to generalize beyond the training set. This evaluation helps reducing overfitting, enhancing the model's resilience and applicability to real-world scenarios. #Excluding superfluous variables for predicting Ter_dataset2 <- Ter_dataset %>% select(-url, -latitude, -longitude, -numPhotos) set.seed(1312) Ter_split <- initial_split(Ter_dataset2, prop = 0.7, strata = "price") The dataset was divided, allocating 70% of the data for training the predictive model and reserving the remaining 30% for testing its performance. In this process, the variable "price" was established as the target variable, representing the market price of the properties, which the model aims to predict. This segmentation ensures a substantial amount of data for training the model, allowing it to learn relationships, while the testing set serves as an independent benchmark to assess the model's accuracy in predicting unseen instances.
57 Moreover, we set a seed, when it is specified, it initializes the random number generator in a way that produces the same sequence of random numbers each time the code is run. This is a common practice in statistical programming to ensure reproducibility. 5.4.2 Data pre-processing In the methodology of creating predictive models in programming, it is common to establish a set of steps, often referred to as a recipe, prior to building the model. This recipe allows for customization according to specific needs and performs a pre-processing of the data, retaining only the information that is truly important. Subsequently, when defining the predictive model, you invoke or apply this recipe to the model. Ter_recipe <- training(Ter_split) %>% recipe(price ~ .) %>% step_rm(propertyCode) %>% step_dummy(all_nominal()) %>% step_zv(all_numeric(), -all_outcomes()) %>% step_corr(all_predictors(), threshold = 0.9) %>% step_center(all_numeric(), -price) %>% step_scale(all_numeric(), -price) %>% step_nzv(all_predictors(), -price) The recipe that has been created consists of the following steps: • step_rm remove specified variables from the dataset during the data pre-processing stage. • step_dummy creates dummy variables 9 for each level of each nominal predictor. • step_zv identifies and removes numeric predictors that exhibit zero variance, meaning they have no variability in the data. • step_corr filters out highly correlated variables, those with correlations exceeding a specified threshold. • step_center subtracts the mean, obtained from the training set, from numeric predictors. • step_scale divides each numeric predictor by its standard deviation, obtained from the training set. 9 Dummy variables are binary variables created to represent the various categories or levels of a nominal predictor. Each dummy variable corresponds to one category and takes the value of 0 or 1, indicating the absence or presence of that category for a particular observation.
Predictive Business Analytics for Real Estate 58 • step_nzv filters out numeric predictors that still exhibit zero variance after the previous pre-processing steps. These steps have been defined in an iterative way, adding or removing as the models behaved, at the end with this set we obtained the best performance, enhancing the dataset's suitability for training machine learning models by addressing issues like multicollinearity and ensuring standardized numeric features. 5.4.3 Models setup In the process of predicting housing prices, we adopt a dual-model approach utilizing both linear regression and regression tree models. These models serve distinct purposes, offering a balance between simplicity and flexibility in capturing relationships within the data. – Linear regression – Linear regression is a statistical method used to model the relationship between a dependent variable (price) and one or more independent variables (predictors) by fitting a linear equation to the observed data. How it Works: • Equation: The linear regression model assumes a linear relationship between the predictor variables and the response variable. The equation takes the form: 𝑦 = 𝜌0+ 𝜌1· 𝑥1+ 𝜌2· 𝑥2+ ⋯ + 𝜌𝑛· 𝑥𝑛 Figure 23. Linear regression model (Source: Spiceworks)
59 • Training: The model is trained by adjusting the coefficients (x1, x2, …, xn) to minimize the difference between the predicted values and the actual values in the training dataset. Linear regression is interpretable, as each coefficient represents the change in the dependent variable for a one-unit change in the corresponding predictor, holding other predictors constant. – Regression Tree – Regression trees are decision support models that express decisions and their outcomes using a structure resembling a tree. This hierarchical model, which is similar to asking a series of questions and recursively splitting the dataset based on particular attributes to forecast the target variable, is used to assess the effects of decisions and make them accessible. How it works: Let’s draw an example to understand the model; Predicting house prices using a regression tree involves a series of questions. For instance, the first question might be, "Is the property in a center district or suburbs?" If the answer is "center district," the next question might be, "Does it have more than two bedrooms?" Each question refines the prediction until a final value is reached (leaf node), typically the mean price of properties in that group. Figure 24. Regression tree classification (Source: SAP help) The difference between the linear regression model is that regression trees can handle nonlinear and complex interactions.
Predictive Business Analytics for Real Estate 60 The explanation has been useful to see the theoretical basis behind it, but let's see how it has been applied. Ter_lm <- linear_reg(mode = "regression") %>% set_engine("lm") Ter_lm_wf <- workflow() %>% add_recipe(Ter_recipe) %>% add_model(Ter_lm) Ter_rt <- decision_tree(mode = "regression") %>% set_engine("rpart") Ter_rt_wf <- workflow() %>% add_recipe(Ter_recipe) %>% add_model(Ter_rt) In the given code snippet, the predictive models are defined establishing the processing engines "lm" in the case of the linear model and "rpart" for the regression tree. These models are integrated into workflows, encapsulating the entire process from data pre-processing (captured in the shared recipe) to model application. The independence of each workflow facilitates a systematic evaluation of the models using metrics, ensuring a comprehensive and repeatable assessment for each model type. 5.4.4 Cross-validation For the defined models in our workflows, we will employ cross-validation, a resampling strategy used to evaluate the performance of machine learning models. Cross-validation involves dividing the dataset into 12 stratified folds (v = 12), ensuring representative subsets for evaluation. Each fold serves as a validation set while the model is trained on the remaining 11 folds, thereby minimizing the risk of overfitting and providing an unbiased assessment of model performance. To enhance reliability, this resampling process is repeated 12 times (repeats = 12), resulting in a total of 144 evaluations (12 folds * 12 repeats). This resampling approach strengthens our model assessments by leveraging multiple iterations of training and validation sets, offering a comprehensive and stable evaluation of the regression tree and linear regression models. set.seed(1312) Ter_folds <- vfold_cv(training(Ter_split), strata = "price", v = 12, rep eats = 12)
61 Figure 25. Resampling strategy (Source: Bookdown) We will use two metrics to assess model performance: 1. Mean Absolute Error (MAE): Calculates the average absolute differences between the predicted values and the actual values. Basically, tells us how far off our predictions are from the actual values. For each prediction, find the difference between the predicted value and the actual value. Take the absolute value of these differences, add them up, and then divide by the total number of predictions: 𝑀𝐴𝐸 = ∑|y𝑖− 𝑦𝑖| 𝑛 The lower the MAE, the better. A MAE of 0 means our predictions are spot on. (Mean Absolute Error - Wikipedia, n.d.) 2. Coefficient of determination R2 (RSQ): Is a statistical measure that represents the proportion of the variance in the dependent variable. To calculate it, start by figuring out the squared differences between the predicted and actual values, and add them up. This gives you the unexplained variance. Then, you measure the total variability in your actual values by finding the squared differences between each actual value and the average actual value. By dividing the unexplained variance by the total variance, subtracting the result from one, you get the coefficient of determination: 𝑅2= 1 − 𝑈𝑛𝑒𝑥𝑝𝑙𝑎𝑖𝑛𝑒𝑑 𝑉𝑎𝑟𝑖𝑎𝑡𝑖𝑜𝑛 𝑇𝑜𝑡𝑎𝑙 𝑉𝑎𝑟𝑖𝑎𝑡𝑖𝑜𝑛 = 1 − ∑(y𝑖− 𝑦𝑖)2 ∑(y𝑖− 𝑦)2
Predictive Business Analytics for Real Estate 62 The R2 value ranges from 0 to 1, where 0 indicates that the model does not explain any variability in the dependent variable, and 1 indicates a perfect fit where the model explains all the variability. Those values are commonly stated as percentages from 0% to 100%. A higher R2 value implies a better fit of the model to the data. (R- Squared: Definition, Calculation Formula, Uses, and Limitations, n.d.) The power of programming languages, such as R in this case, lies in their ability to automatically calculate these metrics swiftly and concisely by executing the appropriate code functions. Let's explore how these desired metrics and resampling techniques have been applied: metrics_regression <- metric_set(mae, rsq) set.seed(1312) lm_fit <- fit_resamples(Ter_lm_wf, Ter_folds, metrics = metrics_regressi on) %>% collect_metrics() %>% mutate(model = "lm") set.seed(1312) rt_fit <- fit_resamples(Ter_rt_wf, Ter_folds, metrics = metrics_regressi on) %>% collect_metrics() %>% mutate(model = "rt") The results obtained predicting the train set are: Table 5. Metrics results from predictive models (Source: Author) MAE RSQ LM 27,358 0.87 RT 41,595 0.74 A reduced MAE in the linear regression model, approximately 27,000, suggests that it performed better than the regression tree model. Furthermore, the regression tree model explains only about 74% of the cases, while the linear regression model covers approximately 87%. To enhance the performance of the regression tree model, we are opting for an alternative strategy. Instead of relying on a single tree, we are leveraging the power of an ensemble method known as a random forest. This approach involves using a collection of trees that work collectively to improve the predictive capabilities.
63 5.4.5 Random forest model setup A random forest constitutes an ensemble of numerous regression trees, each independently trained on a unique subset of the data to make predictions. Through the amalgamation of these diverse predictions, the random forest attains a more accurate outcome, offering a more dependable and generalized solution for predictive modelling tasks. This ensemble approach can be likened to a group discussion, where diverse perspectives contribute to a collective decision-making process. The inherent strength of a random forest lies in its ability to mitigate the limitations of a single decision tree. Figure 26. Random forest classification (Source: Author) To implement it, we need to specify the processing engine, which in this case is "ranger," and define a starting number of decision trees, let's say 200. Subsequently, the model will be trained on the training set by defining a workflow that uses the same recipe established for the other models. Ter_ranger <- rand_forest(trees = 200, mode = "regression") %>% set_engine("ranger") Ter_ranger_wf <- workflow() %>% add_recipe(Ter_recipe) %>% add_model(Ter_ranger) %>% fit(training(Ter_split)) Now, we integrate the metrics we want to evaluate for the model and employ the same resampling technique as in the other cases. set.seed(1312) ranger_fit <- fit_resamples(Ter_ranger_wf, Ter_folds, metrics = metrics_
Predictive Business Analytics for Real Estate 70 compare them with the regular predictive model's metrics. Since the process is the same as previously, except applied to the logarithmic variable, we won't be displaying the code used to acquire the metrics. The results obtained are: Table 9. Metrics comparison between price prediction and its log prediction (Source: Author) Set of data Model MAE RSQ Train Price 2,776 0.99 Price with log 2,701 0.98 Test Price 7,016 0.92 Price with log 4,410 0.98 As indicated by the data and graphically anticipated, the logarithmic predictive model has yielded superior results compared to the regular predictive model, both in the train and test sets. Focusing on the test set, which evaluates how the model performs on an entirely new data, we observe that the logarithmic model improves the error by approximately €3,000, reaching an error of €4,410 with an accuracy of 98%. (A Workflow for Numerical Prediction with Tidymodels - Jose M Sallan Blog, n.d.; Introducing Random Forests in R - Jose M Sallan Blog, n.d.; Log Transformations in Numerical Prediction - Jose M Sallan Blog, n.d.) 5.4.9 Variables with more impact To conclude, we will calculate the importance of each predictor or independent variable, which in the context of a random forest model, is typically a measure of how much that variable contributes to the predictive performance of the model. If a variable has an importance score closer to 0, it suggests that this variable has less impact on the model's predictive performance compared to other variables. However, the interpretation of importance scores is relative, it could still be contributing valuable information in combination with other variables.
71 Figure 30. Importance score for predictors (Source: Author) The obtained results are quite intriguing as three predictors stand out significantly from the rest: the variable "size," followed by "priceByArea," and "bathrooms_X1." The property size, along with the price per square meter in the area, largely defines the value of the property as it was evident, while having only one bathroom also has a direct impact. In contrast, the remaining variables exhibit much lower importance individually; however, their combined influence contributes to a relatively higher overall importance. 5.4.10 Final Conclusion In our quest for a highly effective predictive model, we undertook a meticulous path that involved comparing and refining various models, culminating in the development of a solid solution. We conducted a thorough analysis that included regression trees, random forests, and linear regression. Later, we applied resampling and tuning strategies to refine the model and guarantee optimal performance. Recognizing the challenges posed by a non-normal distribution, we strategically applied our predictive model within the context of logarithmic forecasting, that has significantly improved accuracy while minimizing noise. With these enhancements, we can assert that our predictive model is highly precise, reaching its optimal performance. It is now capable of determining the price of any property in the city of Terrassa with a very small margin of error.
Predictive Business Analytics for Real Estate 72 6 Budget summary The section provides a condensed overview of the financial details discussed in the Budget Report. See the total cost of the project broken down in the following table: Table 10. Execution cost of the project (Source: Author) Cost of the project Hourly rate (€/hours) Time (hours) Total cost (€) Project development 35 750 26,250 Cost of tools used Monthly rate (€/month) Time (months) Total cost (€) HP Zbook 15 G4 2018 23.53 4 94.12 Other Monthly rate (€/month) Time (months) Total cost (€) Wifi Electricity 33.90 60.26 4 4 135.60 241.04 Total costs 26,720.76 Three primary categories account for the project cost of €26,720.76. By analysing the hours worked, which came to over 650 hours and then multiplied by the hourly rate of €35/hour, the cost for hours invested comes to €26,250. The laptop (HP Zbook 15 G4) is the tool used, and it costs €94.12. An additional €376.64 is spent on Wifi and electricity over a four-month period. This brief synopsis provides a clear overview of the financial breakdown by outlining the main cost elements and how much each contributed to the overall investment.
73 7 Analysis of socioeconomic implications This project not only anticipates market trends but also actively contributes to shaping a socially responsible and equitable real estate ecosystem. This section underscores the project's profound social implications, particularly in housing accessibility and informed decision-making. At the project's core lies an unwavering commitment to addressing pressing societal concerns surrounding housing accessibility and affordability. Leveraging the power of predictive analytics to estimate housing prices based on specific characteristics, the tool emerges as a dynamic catalyst for inclusivity within the real estate market. By empowering users to make well-informed decisions regarding fair pricing and potential buying opportunities, the project takes a bold step toward bridging existing gaps in housing accessibility, contributing significantly to a more equitable and just real estate landscape. Beyond its impact on housing accessibility, the project introduces a transformative layer of transparency into real estate transactions—a crucial element for fostering social responsibility. In an industry often marked by information asymmetry, the tool's unique ability to evaluate listed prices against predicted values empowers users with a newfound transparency. This transparency, in turn, cultivates a culture of informed decision-making, a cornerstone for establishing trust and accountability in real estate dealings. In essence, the social implications of the predictive business analytics tool transcend the realm of mere data-driven predictions. They manifest in the empowerment of individuals, the promotion of equitable practices, and the cultivation of transparency within the real estate sector.
Predictive Business Analytics for Real Estate 74 8 Conclusions The main objective of this project, as detailed at the beginning, was to develop a digital tool based on data analysis that provides transparency in the real estate sector and aids in decision-making for property purchases, whether for individuals or investors. The tool had to be easy-to-use and capable of being fed with real data from an official property listing website. After analysing the real estate market context in all its aspects within a specific territory, Catalonia, we observed that it is a highly dynamic environment. Political and economic factors make housing prices fluctuate significantly over the years, making it challenging to determine a fair price. Despite the adversities, we noticed that the market remains active, suggesting that people may still buy properties out of necessity, even if not at the ideal price or with the desired characteristics. Additionally, digital tools have a positive reception in both the territory and the sector, making the development of such a tool a favourable endeavour. In developing the tool, we focused the analysis on the city of Terrassa to simplify and conduct a more targeted study. By extracting and processing data from Idealista, studying correlations between variables, and gaining insights into market dynamics, we were wellequipped to develop an accurate predictive model. In conclusion, the predictive model was successfully developed through rigorous efforts and various methods, resulting in a model capable of determining property prices in the city of Terrassa with only an error of €4,410 in 98% of cases. This level of precision translates to practical usability, allowing users to compare the listed property price with the predicted price. This comparison leads to three potential outcomes: the listed price is fair, the listed price is lower than the real value (a good buying opportunity), or the listed price is higher than the real value (not a good investment). These outputs provide transparency to the market, facilitating decision-making for those unfamiliar with the real estate sector or investors seeking opportunities. Notably, the dataset includes the URL of the listed property, allowing users to visit the property's page to perform various actions. Additionally, users have the capability to input new and current property listings into the tool, making it easy to keep the data up to date. Thanks to the master's program, this project has enhanced my analytical skills, allowing me to analyse environments comprehensively and determine the potential success of a business or product/service. The program and the project have also equipped me with essential data processing skills in an increasingly parameterized and digitized environment.
75 Future work proposals We must now discuss possible directions for future research and development. The next suggestions cover a range of improvements, additions, and considerations that could order to further improve our predictive business analytics tool's usefulness and influence: • Geographical Expansion: Explore the feasibility of expanding the predictive model to cover a broader geographical area, ensuring its adaptability and accuracy across diverse real estate markets. • Data Integration: Explore the integration of data from external sources, such as economic indicators and demographic trends, to provide a more thorough picture of the variables affecting property prices. • Advanced Algorithm Exploration: Investigate advanced machine learning algorithms and optimization techniques to refine the predictive model's accuracy and robustness. • Shiny App Development: Explore the creation of a Shiny app that allows users to input the features of a flat, and in return, provides an estimate of the fair price. This interactive tool could enhance user engagement and simplify the process of obtaining accurate property valuations. • Business Plan Development: Consider developing a comprehensive business plan that outlines strategies for integrating the tool into existing businesses or potentially selling the tool as a standalone product. This can involve market analysis, pricing models, and potential partnerships to ensure the tool's commercial success.
Predictive Business Analytics for Real Estate 76 9 References BIBLIOGRAPHY API Catalunya: “Vamos hacia una normalización del mercado en compraventas” - yaencontre. (n.d.). Retrieved September, 2023, from https://www.yaencontre.com/noticias/economia/api-catalunya-vamos-hacia-una- normalizacion-del-mercado-en-compraventas A workflow for Numerical Prediction with tidymodels - Jose M Sallan blog. (n.d.). Retrieved November, 2023, from https://jmsallan.netlify.app/blog/a-workflow-for-numerical- prediction-with-tidymodels/ ¿Cómo está afectando la digitalización y aparición de nuevas necesidades al sector Real Estate? (n.d.). Retrieved October, 2023, from https://axiscorporate.com/article/realestate-digitalizacion/ ¿Cuándo se considera una vivienda sostenible? - Fotocasa. (n.d.). Retrieved September, 2023, from https://www.fotocasa.es/fotocasa-life/hogar/energia/vivienda-sostenible-que- aspectos-cabe-tener-en-cuenta-antes-de-adquirir-un-piso/ de Catalunya, G. (n.d.). Resumen del Informe anual de la economía catalana 2020 IA Informe Anual. http://economia.gencat.cat Departamento de Economía Informe Sector Vivienda 2 CONTENIDO. (n.d.). www.foment.com El verde importa (y mucho) al “real estate.” (n.d.). Retrieved September, 2023, from https://www.eleconomista.es/vivienda-inmobiliario/noticias/11836257/06/22/El-verde- importa-y-mucho-al-real-estate.html Estas son las 10 tendencias en vivienda en 2022 – Fotocasa Life. (n.d.). Retrieved September, 2023, from https://www.fotocasa.es/fotocasa-life/compraventa/10- tendencias-de-vivienda-en-2022-para-quienes-buscan-cambiar-de-piso/ How To Invest In Real Estate – Forbes Advisor. (n.d.). Retrieved September, 2023, from https://www.forbes.com/advisor/investing/how-to-invest-in-real-estate/ Introducing random forests in R - Jose M Sallan blog. (n.d.). Retrieved November, 2023, from https://jmsallan.netlify.app/blog/introducing-random-forests-in-r/ Investment Real Estate: Meaning, Benefits, Risks. (n.d.). Retrieved September, 2023, from https://www.investopedia.com/terms/i/investmentrealestate.asp LA CASA DE 2023: cómo la habitaremos y qué tendencias triunfarán. (n.d.). Retrieved October, 2023, from https://www.arquitecturaydiseno.es/decoracion/casa-2023- tendencias-cambios_8308
77 La situación política catalana no preocupa a los que buscan casa. (n.d.). Retrieved October, 2023, from https://blogprofesional.fotocasa.es/situacion-politica-catalana- preocupaciones/ Log transformations in numerical prediction - Jose M Sallan blog. (n.d.). Retrieved December, 2023, from https://jmsallan.netlify.app/blog/log-transformations-in-numerical-prediction/ Mean absolute error - Wikipedia. (n.d.). Retrieved December, 2023, from https://en.wikipedia.org/wiki/Mean_absolute_error No Longer Nomads: The History of Real Estate. (n.d.). Retrieved September, 2023, from https://www.investopedia.com/articles/07/history-real-estate.asp Nueva Ley de Vivienda 2023: todo lo que debes conocer – Fotocasa Life. (n.d.). Retrieved October, 2023, from https://www.fotocasa.es/fotocasa-life/general/nueva-ley-de-vivienda/ ¿Qué ha cambiado al buscar casa durante el COVID-19? | Fotocasa. (n.d.). Retrieved September, 2023, from https://www.fotocasa.es/fotocasa-life/compraventa/cambiosbusqueda-vivienda-durante-coronavirus/ ¿Qué portal inmobiliario es mejor Idealista o Fotocasa? (n.d.). Retrieved October, 2023, from https://temploconsulting.com/para-vender-casa-en-madrid-es-mejor-idealista-o-fotocasa/ Real Estate: Definition, Types, How to Invest in It. (n.d.). Retrieved September, 2023, from https://www.investopedia.com/terms/r/realestate.asp R-Squared: Definition, Calculation Formula, Uses, and Limitations. (n.d.). Retrieved December, 2023, from https://www.investopedia.com/terms/r/r-squared.asp The Commitment - World Green Building Council. (n.d.). Retrieved September, 2023, from https://worldgbc.org/thecommitment/ The Three Approaches to Value: The Cost, Income, and Comparable Sales. (n.d.). Retrieved September, 2023, from https://www.allobarstrategies.com/post/2017/05/25/the-three- approaches-to-value-the-cost-income-and-comparable-sales-methods Three Types of Business Analytics | University of Bath Online. (n.d.). Retrieved October, 2023, from https://online.bath.ac.uk/content/descriptive-predictive-and-prescriptive-three-types- business-analytics
Predictive Business Analytics for Real Estate 78 10 Appendices The appendices for this work are included in a separate document. This document holds significant importance as it encompasses all the code, written in the R programming language, used in the core of the project. This code is instrumental in data acquisition, dataset analysis, and predictive model development. I highly recommend consulting this document to learn more about the tasks performed throughout this project.