Showing posts with label Random Forests. Show all posts
Showing posts with label Random Forests. Show all posts

Sunday, June 30, 2024

The Art and Science of Comparable Sales Analysis (Part 1 of 3)

Part 1 of 3

Comparable sales analysis plays a crucial role in determining a property's value in real estate valuation. However, the traditional approach of making subjective adjustments to comparable sales data tends to raise questions about the reliability of the final value conclusions. To address this challenge, I will use this three-part blog post to delve into a comprehensive methodology that combines statistical rigor with traditional valuation principles to enhance the accuracy and explainability of property valuations.

The post will outline a structured three-step process that redefines comparable sales analysis. The first step involves using a correlation matrix to examine the relationships between property sale prices and six key independent variables. This initial analysis scrutinizes potential collinearity and multicollinearity among these variables, setting the foundation for a more robust regression model.

The second step of the process employs multiple regression analysis to derive consistent coefficients that serve as the basis for an adjustment matrix. This matrix facilitates the systematic adjustment of comparable sales data to accurately align with the subject property's characteristics. By leveraging statistical methods, this approach aims to minimize the subjective nature of adjustments and provide a more objective and reliable valuation model.

Finally, moving beyond the statistical realm, the third step incorporates the art of traditional comparable sales analysis. This aspect involves selecting comparable sales based on criteria such as the least adjustments and sales recency. It emphasizes the importance of applying logic and expertise in identifying genuinely comparable properties, thereby enhancing the accuracy and credibility of the valuation process.

By combining the precision of regression modeling with the artistry of traditional valuation principles, this three-step approach promises to deliver value conclusions that are accurate, transparent, and logical. Through this blog post series, I aim to showcase a more informed and systematic method of conducting comparable sales analysis, ultimately elevating the standards of property valuation practices.

(Click on the image to enlarge)

Dataset and Variables

This dataset, which led to the above correlation matrix, comprises 18 months of home sales data from a particular town, specifically from January 2023 to June 2024, to value the subject properties as of July 1, 2024.

Sale Price will be the dependent variable in the regression model. One of the six independent variables, "Months Since," represents the number of months since the sale. For instance, a sale in January 2023 will receive a value of 18 (July 2024 minus January 2023), while a sale in June 2024 will be assigned a value of 1. The "Exterior Wall" variable has been effect-coded by centering each category's deviation from the town's median sale price. Bldg Age is a synthetic variable calculated by subtracting the property's year built from the prediction year 2024. The other variables are quantitative data obtained from public records. No location variable will be used since all subjects and comps will come from specific neighborhoods within this town.

Analysis

Looking at the correlation matrix, we observe moderate-to-high correlations between Sale Price and the independent variables.

  • A moderate positive correlation (0.4117) between Land SF and Sale Price is expected, as larger lots tend to be associated with higher-priced homes.
  • As expected, a moderate negative correlation (-0.2033) exists between building age and Sale Price, which aligns with the general understanding that older buildings tend to be less expensive than newer ones in the real estate market.
  • A strong positive correlation (0.7780) exists between Heated SF and Sale Price, as expected, since larger buildings tend to fetch higher prices.
  • There is a moderate positive correlation (0.5123) between Bathrooms and Sale Price, as expected.

Multicollinearity

Multicollinearity occurs when two or more independent variables in a regression model are highly correlated, leading to unstable and unreliable coefficient estimates.

Therefore, when assessing multicollinearity, we are concerned with correlations among the independent variables, not with their correlations with the dependent variable (Sale Price in this case).

Here's how to assess multicollinearity among independent variables:

1. Look for correlations exceeding 0.8, a general guideline for strong correlation.

2. Pay attention to the overall pattern in the correlation matrix. The presence of multiple highly correlated independent variables is a strong indicator of multicollinearity.

Examining the correlation matrix, we can see that there are some moderate correlations among the independent variables:

  • Land SF and Heated SF (0.4659)
  • Heated SF and Bathroom (0.6174)

The strongest correlation among independent variables is between Heated SF and Bathrooms (0.6174), which is moderate and not a cause for concern.

It's important to note that there is no one-size-fits-all answer to dealing with multicollinearity. The best approach will depend on your specific data and research question, allowing you to choose the method that best suits your needs.

Important to Know

Here are some ways to address multicollinearity:

  • Drop one of the highly correlated variables: This is a simple solution, but it can also remove valuable information from the model. Before dropping a variable, carefully consider which variable is less critical to your analysis.
  • Combine the correlated variables into a single variable: If the correlated variables represent the same underlying concept, you can create a new variable that combines them. For example, you could create a new variable for the house's square footage (Heated SF + basement SF).
  • Use Ridge Regression: This regression technique can reduce the impact of multicollinearity on model coefficients.

It is important to note that multicollinearity may still be a concern even if correlation coefficients are not extremely high, especially in small sample sizes. In such a scenario, it would be advisable to proceed with fitting the regression model and checking additional diagnostics, such as variance inflation factors (VIFs), to further assess multicollinearity and ensure the stability of the regression estimates.

Conclusion

Examining the correlation matrix before running a regression model is a common and beneficial practice. This preliminary step offers several advantages:

  • Understanding variable relationships: The correlation matrix reveals the strength and direction of relationships between the dependent variable (e.g., Sale Price) and each independent variable, as well as among the independent variables. This information helps analysts identify which independent variables are the most significant predictors of the target variable.
  • Identifying potential multicollinearity: Multicollinearity arises when independent variables are highly correlated, which can complicate the interpretation of regression coefficients and lead to inaccurate results. The correlation matrix helps identify potential multicollinearity, which can be further investigated with tests such as the Variance Inflation Factor (VIF).
  • Variable selection: While correlation alone shouldn't be the sole criterion for choosing variables, it is a helpful starting point. Strong correlations between independent variables and the dependent variable suggest they might be significant predictors for inclusion in the model.
  • Guiding further analysis: The correlation matrix can highlight unexpected relationships or outliers that warrant further investigation, leading to a more nuanced understanding of the data and potentially improving the final regression model.

In conclusion, examining the correlation matrix is a simple yet powerful technique for gaining valuable insights into the data before running a regression model. This preliminary analysis helps build a stronger foundation for the analysis and potentially avoids issues with multicollinearity or misleading results.

Coming Soon: Part 2 of 3 – Regression modeling to help develop the adjustment matrix.

Sid's Bookshelf: Elevate Your Personal and Business Potential

Saturday, June 15, 2024

Understanding Random Residuals in Linear Regression: A Visual Analysis

Target Audience: New Analysts

In linear regression analysis, residuals are the difference between the observed values of the dependent variable and the values predicted by the regression model.

The concept of residual randomness can be understood as the absence of discernible patterns, trends, or correlations in the residuals. The residuals should be scattered around the regression line with no systematic deviations from zero. When the residuals exhibit randomness, it indicates that the model has captured all the available information, and any unexplained variability is due to random chance, making the model more reliable.

Having random residuals is essential for several reasons:

1. If the residuals show patterns or trends, the model is not capturing all the essential underlying relationships in the data. Non-random residuals suggest that the model is missing critical explanatory variables or that the relationship between the variables is nonlinear.

2. Random residuals are a vital assumption in linear regression that enables valid statistical inference. If the residuals are not random, then the estimates of the coefficients, standard errors, and hypothesis tests can be biased or invalid.

3. A regression model with random residuals is more likely to provide accurate predictions for new data, as it does not make systematic errors in predicting the dependent variable.

4. Checking for the randomness of residuals is an essential diagnostic tool in regression analysis. By examining the residuals for patterns or trends, analysts can identify potential problems with the model and make necessary adjustments.

In summary, ensuring that the residuals in a linear regression model are random is crucial for its accuracy, reliability, and validity. It allows analysts to draw sound inferences, make robust predictions, and ensure that the model appropriately captures the relationships in the data.

Homoscedasticity

The concept of random residuals in linear regression is related to homoscedasticity. Homoscedasticity refers to the assumption that the variance of the residuals is constant across all levels of the independent variables. In other words, there should be no systematic patterns in the variability of the residuals as the independent variables' values change.

The residuals are considered homoscedastic when they exhibit constant variance and show no patterns or trends. This means that the variability of the residuals is random and does not depend on the values of the independent variables, a desirable property in regression analysis.

Having homoscedastic residuals is essential for the validity and reliability of the regression model. If the residuals exhibit heteroscedasticity (where the variance of the residuals is not constant), this can lead to biased parameter estimates, incorrect standard errors, and invalid hypothesis tests. Consequently, ensuring that the residuals are homoscedastic is crucial for making accurate inferences and predictions using the regression model.

Testing the Randomness of Residuals

Analysts can create a scatter plot with the residuals on the y-axis and the predicted values from the regression model on the x-axis to test the randomness of residuals in linear regression. Each point on the plot represents a data point in the dataset, with the x-coordinate being the predicted value and the y-coordinate being the corresponding residual.

Analysts can visually inspect whether the residuals exhibit any systematic pattern or trend by examining this scatter plot. A random scattering of points around the horizontal line at y=0 would indicate that the assumption is likely satisfied in the regression model. Conversely, if a clear pattern or structure is observed in the plot, it suggests a violation of the assumption.


Analysis of the Plot

The random scatter of the residuals from the regression model around the horizontal axis (predicted prices) suggests that the errors are independent and identically distributed (homoscedastic), meeting one of the assumptions of linear regression.

An R-squared of 0.000 further supports this, indicating no correlation between the residuals and the predicted values. This is ideal, as it suggests that the model has captured all the linear relationships in the data, and the residuals are just random noise. The fact that the residuals are scattered around zero indicates that there is no systematic bias in the model. In other words, the model is not consistently over- or underestimating the actual home values.

The residual plot suggests that the model is on the right track. However, it is important to remember that this is just one step in the model development process. To assess its generalizability, it is important to evaluate the model's performance on a hold-out set (data not used to build or train the model).

Attention Mass Appraisal Analysts: A few outliers exist, especially at the higher end of the predicted prices. Therefore, while the residual plot passes the test, it would be prudent for the in-house data team to investigate these outliers and document their findings. The findings should be included in the model’s final documentation as an appendix.

Central Limit Theorem (CLT)

The Central Limit Theorem (CLT) is a crucial statistical concept that explains large samples' average (mean) behavior. This regression analysis was conducted using a large sample of 11,224 sales. Due to the large sample size, CLT ensures that even with inherent variability in real estate prices, the residuals will tend toward a normal distribution, indicating randomness and implying that deviations from the predicted prices (residuals) occur by chance and are not due to any systematic pattern or bias in the model. The minor deviations often observed in residuals (e.g., skewness and kurtosis) are likely due to real-world data not being perfectly normal. However, with such a large modeling dataset, the CLT suggests that these deviations are likely insignificant and that the residuals can be considered random.

Sid's AI-Assisted Bookshelf: Elevate Your Personal and Business Potential

Friday, June 9, 2023

AI and Home Builders’ Demographic Analysis

In the previous post of this homebuilder series, we discussed the importance of making informed land purchases for national homebuilders. However, it's not just about buying land. Large construction companies must also rely on demographic analysis at different levels—national, regional, and local—to determine where to invest next. A thorough analysis can lead to better risk-reward outcomes, while a flawed one can be costly and result in reduced profit margins or even losses.

AI can significantly increase the chances of success by gaining a deeper understanding of target markets and their unique needs. AI-based demographic analysis can help builders identify areas with high growth potential, track trends in population and household size, and assess demand for different types of housing. This information can be used to make more informed decisions about where to build, what types of homes to build, and how to price them. In this post, we will explore how AI can assist builders with demographic analysis. We will discuss the benefits of using AI for demographic analysis, helping builders make more informed decisions about where to build and what to build.

Author: Construction companies at the forefront require improved demographic analyses to determine the appropriate timing, type, size, and quantity of homes to construct to avoid being burdened with unsold inventory, which can significantly impact their profit margin. By utilizing AI-powered demographic analyses, builders can avoid subjective decisions and concentrate on their core competency of constructing top-notch homes. What methods should machine-learning models be trained in to generate optimal demographic analyses for sizable builders?

ChatGPT: The machine-learning models should be trained in a combination of supervised and unsupervised learning methods. Supervised learning involves the use of labeled datasets to train the model, while unsupervised learning involves clustering techniques that allow the model to learn patterns from unlabeled data...

* To fully explore the rest of the chapter, I recommend obtaining a copy of my book on Amazon. Here are the links:

Kindle version: https://www.amazon.com/dp/B0C7N9CW8J

Paperback version: https://www.amazon.com/dp/B0C7J4X64P

Hardcover version: https://www.amazon.com/dp/B0C7J7D6VH

PDF version (non-Amazon): https://payhip.com/b/7nTyK


Thursday, June 8, 2023

AI and Home Builders’ Cost of Buildable Land

When it comes to large construction projects, national home builders often acquire sizable tracts of land. However, the costs of these buildable lands have been soaring in recent years, resulting in new homes being sold at higher prices than comparable pre-owned homes. This puts large home builders at a competitive disadvantage, particularly in markets where they are not only up against existing housing options but also other big builders. Using AI technologies, home builders can strategically identify emerging markets where land costs have not yet skyrocketed. This enables them to offer homes at competitive prices compared to pre-owned ones and gives them a better chance of success in these markets. This post will explore how large builders can leverage AI to identify and seize opportunities in these emerging markets. 

Author: Though the supply chain crisis has subsided, the rising cost of land has significantly contributed to the increased expense of constructing new homes. To overcome this problem, national builders with technological expertise should implement a combination of these four complementary techniques – Game theory, Random forest, Logistic regression, and Dynamic programming – to develop efficient machine-learning models that can predict housing shortages in various regions of the nation. By doing so, they can purchase large tracts of land at lower prices than their competitors. With such predictive AI modeling, prominent builders can acquire land economically in the appropriate areas before the buying frenzy commences, potentially stabilizing the cost of new homes, and remaining more competitive with existing homes. Do you agree with my suggestion?

ChatGPT: Yes, I agree with your suggestion. Machine learning models can be extremely useful for predicting housing shortages in various regions of the nation and helping builders acquire land at lower prices than their competitors. Such predictive AI modeling would allow developers to remain competitive while keeping new home construction costs low, which could help stabilize the cost of new homes...

* To fully explore the rest of the chapter, I recommend obtaining a copy of my book on Amazon. Here are the links:

Kindle version: https://www.amazon.com/dp/B0C7N9CW8J

Paperback version: https://www.amazon.com/dp/B0C7J4X64P

Hardcover version: https://www.amazon.com/dp/B0C7J7D6VH

PDF version (non-Amazon): https://payhip.com/b/7nTyK


Monday, June 5, 2023

AI Algorithm and Machine Learning vs. Traditional Statistics and Data Science – Part 2

In the first installment of this series, we discussed the distinct variations between AI, traditional statistics, and data science. We learned how AI's capacity to incorporate extensive amounts of data, along with sophisticated techniques like game theory, decision trees, random forests, and dynamic programming, can significantly enhance the usefulness of traditional methods. Lastly, we talked about how individuals, particularly recent graduates, who possess expertise in AI will hold a substantial advantage in the employment market. In this part, we delve into how AI can reshape the universe of parametric predictive modeling.

Parametric vs. Non-parametric Predictive Modeling

Sid: When creating a predictive model that relies on several independent variables, it's important to avoid multi-collinearity amongst them. To check for this issue, the modeler should analyze a correlation matrix and then move on to the regression analysis. Thus, the process for developing a regression model is often a manual, two-step procedure in most statistical software packages. Is it possible to teach machine-learning algorithms to combine these analyses without relying on a specific procedure?

ChatGPT: Yes, it is possible to teach machine learning algorithms to combine these analyses. Many machine learning algorithms make use of feature selection algorithms, which can automatically select the most relevant variables for model building, and can recognize and ignore highly correlated variables. Other algorithms, such as support vector machines and random forest, can also be used for model building, as they can determine the most important variable interactions without relying on a pre-defined procedure.

Bard: Yes, it is possible to teach machine learning algorithms to combine correlation matrices and regression analyses without relying on a specific procedure. One way to do this is to use a technique called regularization. Regularization is a way of preventing machine learning algorithms from overfitting the data. Overfitting occurs when an algorithm learns the training data too well, and as a result, it is not able to generalize to new data.

One type of regularization is called Lasso. Lasso stands for Least Absolute Shrinkage and Selection Operator. Lasso works by shrinking the coefficients of the independent variables towards zero. This helps to prevent multicollinearity, as it reduces the correlation between the independent variables.

Another type of regularization is called Ridge. Ridge stands for Tikhonov Regularization. Ridge works by shrinking the coefficients of the independent variables towards zero, but it does not shrink them as much as Lasso. This helps to prevent multicollinearity, but it also helps to improve the performance of the model on the training data.

Machine learning algorithms can be trained to use regularization techniques automatically. This means that the modeler does not need to manually check for multicollinearity or perform a two-step procedure. The algorithm will automatically learn to avoid multicollinearity and improve the performance of the model on the training data.

Here are some of the benefits of using machine learning algorithms to combine correlation matrices and regression analyses:

·         It is a more automated process, which can save time and effort.

·         It can help to prevent multicollinearity, which can improve the performance of the model.

·         It can improve the performance of the model on the training data.

Here are some of the challenges of using machine learning algorithms to combine correlation matrices and regression analyses:

·         It can be more computationally expensive than manual methods.

·         It can be more difficult to interpret the results of the analysis.

·         It can be more difficult to troubleshoot problems with the model.

Overall, using machine learning algorithms to combine correlation matrices and regression analyses can be a more efficient and effective way to develop predictive models. However, it is important to be aware of the challenges involved in this approach.

Sid: What modeling technique isn't affected by multi-collinearity?

ChatGPT: The modeling technique that is not affected by multi-collinearity is a decision tree. Decision trees are independent of multi-collinearity because they build decision rules to make predictions on the data without relying on linear relationships between variables.

Sid: In that case, will a decision tree be better than regression to develop a pricing model for a high-rise condo building with views on one side but not on the other?

ChatGPT: Yes, a decision tree will likely be better than a regression model to develop a pricing model for a high-rise condo building with views on one side but not on the other. This is because decision trees are not affected by multi-collinearity, and the decision trees can identify complex relationships between the independent variables. Additionally, decision trees are relatively easy to interpret, which is helpful when explaining complex pricing models.

Bard: There are a few modeling techniques that are not affected by multicollinearity, including:

·         Decision trees: Decision trees are a type of non-parametric model that does not make any assumptions about the underlying distribution of the data. This makes them less susceptible to multicollinearity than parametric models, such as linear regression.

·         Random forests: Random forests are an ensemble learning method that combines multiple decision trees. This helps to reduce the variance of the model and make it more robust to multicollinearity.

·         Support vector machines: Support vector machines are a type of machine learning algorithm that can be used for both classification and regression tasks. They are not affected by multicollinearity because they do not make any assumptions about the underlying distribution of the data.

In the case of a high-rise condo building with views on one side but not on the other, a decision tree or random forest model would be a good choice for developing a pricing model. These models can take into account the complex factors that affect condo prices, such as the size and layout of the unit, the floor plan, the amenities, and the view. They can also handle the presence of multicollinearity in the data.

Regression analysis is a parametric model that makes assumptions about the underlying distribution of the data. This makes it more susceptible to multicollinearity. In addition, regression analysis is not as good at handling complex factors, such as the view in a condo building.

Here are some additional details about each of the modeling techniques mentioned above:

·         Decision trees: Decision trees are a type of supervised learning algorithm that can be used for both classification and regression tasks. They work by splitting the data into smaller and smaller groups until each group is homogeneous. The decision tree is then used to predict the value of the target variable for new data points.

·         Random forests: Random forests are an ensemble learning method that combines multiple decision trees. This helps to reduce the variance of the model and make it more robust to noise and overfitting. Random forests are often used for classification and regression tasks, but they can also be used for other tasks, such as feature selection and dimensionality reduction.

·         Support vector machines: Support vector machines (SVMs) are a type of machine learning algorithm that can be used for both classification and regression tasks. They work by finding the hyperplane that best separates the data into two classes. SVMs are often used for high-dimensional data because they can handle nonlinear relationships.

Sid: When working with datasets, there are various types of variables including continuous, categorical, descriptive, and binary. To create a predictive model using multiple regression analysis, non-quantitative variables must first be transformed into quantitative variables. This allows them to be used as independent variables in the equation. One of the common methods for this transformation is linearization, where numerical values are assigned to categories or descriptions. However, this process can be subjective and dependent on the modeler's preferences. For instance, a modeler might assign 100 to "average," 75 to "below average," 125 to "above average," 150 to "good," and 175 to "excellent." But this approach may not always reflect real-world market behavior. How can AI overcome this challenge and handle a diverse set of variables in a model without relying on subjective judgments?

ChatGPT: AI can help to overcome this challenge by performing feature engineering. Feature engineering involves collecting or creating new features that can better explain the data if used as independent variables instead of non-quantitative variables. For example, the non-quantitative variables of the example could be converted to useable features such as the number of words in the description, the length of the description, or the position of the words in the sentence. AI algorithms such as natural language processing and other text analytics algorithms can analyze these new features in order to create more accurate predictive models without relying on subjective judgement. By doing so, AI can create a better understanding of how variables influence the outcome and use this to create a more accurate predictive model.

Bard: There are a number of ways that AI can overcome the challenge of handling a diverse set of variables in a model without relying on subjective judgments. One way is to use machine learning algorithms that can learn the relationships between variables without being explicitly programmed with them. This can be done by using algorithms such as decision trees, random forests, and neural networks. These algorithms can learn the relationships between variables by analyzing large datasets of data.

Another way that AI can overcome this challenge is to use natural language processing (NLP) techniques to extract meaning from text data. This can be done by using algorithms such as sentiment analysis, topic modeling, and named entity recognition. These algorithms can be used to extract information from text data that would be difficult or impossible to extract using traditional statistical methods.

By using these techniques, AI can create models that are more accurate and reliable than models that are created using traditional statistical methods. This is because AI models are not limited to the relationships that are explicitly programmed into them. Instead, they can learn the relationships between variables from the data itself. This allows AI models to be more flexible and adaptable to changes in the data.

Here are some specific examples of how AI can be used to handle a diverse set of variables in a model:

·         Decision trees can be used to create models that can handle both categorical and continuous variables. Decision trees work by splitting the data into smaller and smaller groups until each group contains only one type of variable. This allows the model to learn the relationships between variables without relying on subjective judgments.

·         Random forests are a type of ensemble learning algorithm that can be used to create models that are more accurate than decision trees. Random forests work by creating multiple decision trees and then averaging their predictions. This helps to reduce the variance in the model and makes it more accurate.

·         Neural networks are a type of machine learning algorithm that can be used to create models that can handle complex relationships between variables. Neural networks work by learning the weights of connections between neurons in a network. This allows the model to learn the relationships between variables without being explicitly programmed with them.

These are just a few examples of how AI can be used to handle a diverse set of variables in a model. As AI technology continues to develop, we can expect to see even more powerful and sophisticated techniques for handling complex data sets.

Sid: Do you think AI-powered systems can use a combination of decision trees, random forests, and neural networks, replacing old-fashioned regression-based predictive modeling altogether?

Bard: It is possible that AI-powered systems could use a combination of decision trees, random forests, and neural networks to replace old-fashioned regression-based predictive modeling altogether. However, it is important to note that regression-based predictive modeling is still a powerful tool that can be used in many cases.

Here are some of the advantages of using AI-powered systems to create predictive models:

·         Accuracy: AI-powered systems can often create models that are more accurate than traditional regression-based models. This is because AI models can learn the relationships between variables from the data itself, without relying on subjective judgments.

·         Flexibility: AI models are more flexible than traditional regression-based models. This is because AI models can handle complex relationships between variables, and they can be adapted to changes in the data.

·         Scalability: AI models can be scaled to handle large datasets. This is important for many applications, such as fraud detection and risk assessment.

However, there are also some disadvantages to using AI-powered systems to create predictive models:

·         Complexity: AI models can be more complex than traditional regression-based models. This can make them more difficult to understand and interpret.

·         Data requirements: AI models require large datasets to train. This can be a challenge for some applications, such as fraud detection.

·         Cost: AI models can be more expensive to develop than traditional regression-based models.

Overall, it is likely that AI-powered systems will continue to play an important role in predictive modeling. However, it is also likely that traditional regression-based models will continue to be used in many cases. The choice of which type of model to use will depend on the specific application and the available data.

Note: All conversations here are unedited. E&OE.

Note: ChatGPT is a registered trademark of OpenAI, and Bard is a registered trademark of Google.


50% Off This Weekend Only – Five Practical Valuation Modeling Books

This weekend only, I’m running a straightforward 50% off campaign on the PDF editions of my five most recent valuation modeling books. The...