8
$\begingroup$

I am trying to predict real estate sales prices.

  • In my dataset there are independent variables that are both nominal and numeric (square meters, prices etc.)
  • Before feeding the data to any regression algorithm I'd like to preprocess it correctly (binning, normalizing mean / std deviation, discretization etc.)
  • I am overwhelmed by the many methods listed in various textbooks and try to find out what works well in practice

Although the most reasonable answer to this question is probably 'it depends', could you maybe give me some rules of thumb / war stories / general advice?

  • How do you usually preprocess data for regression?
  • What methods do you usually apply?
  • Which regression algorithms need a special treatment?

As my tools I am using weka and R.

Many Thanks!

$\endgroup$

4 Answers 4

7
$\begingroup$

(You may start from the after line section, for a shorter answer) To begin with, you are absolutely right saying that it firstly depends on the purposes of your analysis: forecasting of average price (at macro level) or a particular price (at micro level), causal analysis of consumer preferences (district, size, age, number of bedrooms, gas, travelling to the job, level of noise, etc.). This verbal specialization secondly will guide you to an appropriate choice of a model and, finally, requirements for your data.

From what you have written, I assume, that you deal with the real estate pricing models. After quick googling showed there are many ways to specify a model. Quite good starting reference could be Simon P. Leblond's article Comparing predictive accuracy of real estate pricing models: an applied study for the city of Montreal. From practical point of view you have to choose between additive or multiplicative regression models. The latter has several advantages as opposed to additive models:

  • parameter estimates (but intercept term, junk regression parameter anyway) are not affected by the changes in scale
  • parameters for log-transformed variables have a nice elasticity interpretation, that ...
  • naturally allows for diminishing returns to scale restrictions (in real estate this one could be crucial restrictions)
  • if one studies average prices, more robust averaging is weighted geometric mean than average (this will not be relevant too much at micro level though)
  • you may set price to zero, if, for instance, your apartment has no bedrooms at all (it is hard to do so with additive models)

One more important thing before you proceed is to think about each of your observation as a unique data point that was jointly set on the market by a decision maker on the basis of utility maximizing behaviour. Jointly meaning here that you can't separate the variables from each other (for instance, the value of apartments without a bedroom is zero for most of the consumers), but a consumer may or may not like all bundle of the attributes together, after that his or her budget (money in the pocket) is all that matters. Therefore standardization is useful for analysis of relative importance of explanatory variables, but be careful judging what variables are not significant (all factors may be important). Heterogeneity of preferences and budgets (buyers are different households) in each case of your observation also shows why regression at micro level (not averaging or so) could also be misleading. Finally, you have cross-sectional (static) data. Trying to predict prices for different years (than the year of your observations), static pictures work poorly for different periods of time (say you build model based on 2009 year's data, it will be not very useful retrospectively predicting prices for say 2007, or for 2011). At least try to correct the outcomes on the basis of change in average price for a particular year in this case.


Regarding your particular questions (what I personally do for my projects, or at least pretend to do):

  1. List all the variables you have and their measurement units
  2. Check and re-check the data for imputation errors
  3. Make additional imputation for the points with missing values (you may also simply exclude the observations if you have large dataset with not so many missing values)
  4. Make all measurement units the same across similar variables (sq. meters, currency units, etc.)
  5. Think of a simple data frame structure at once (you need to communicate with $R$ conveniently)
  6. Bring only raw data to $R$, make all log, differences, fractions transformations in $R$ directly (logarithms are important for multiplicative models, some pros for one are in the prelude above; fractions are also nice for you may want to eliminate the scale (size) effect at once, and emphasize the differences caused by other factors)
  7. Leave dummies as they are but always leave one level of qualitative attribute for intercept term (if not this would be a source for pure multicollinearity problem in your model)
  8. For your purposes you may apply ordinary least squares (OLS), though in pricing models I would also consider tobit or Heckman models, that do need a special treatment (one of my early may-be-not-so-successful post's on pricing was about this)
  9. OLS is straightforward and usual residual analysis (found in textbooks on econometrics) is done. Violating some of the assumptions you may go for generalized methods, instrumental variables, ridged regression, cures for autoregressive residuals, but... What you really need to know: are the parameter estimates theoretically reasonable (values, signs, etc.)?
  10. Just a nice number... any additions from the community are welcome.
$\endgroup$
2
  • 1
    $\begingroup$ I was going to write a separate answer, but I like yours. I'd expand #6 to say to bring ALL data into R and don't be in a hurry to aggregate, bin, etc. I think one error us non-experts make is to force data into a form that we think we'll need, or that we've seen others do. Let the actual data and the real-world factors behind that data guide you instead of naive assumptions related to processing the data. $\endgroup$
    – Wayne
    Commented Mar 29, 2011 at 15:47
  • $\begingroup$ Thanks for a detailed answer. How would you fit in the steps of 1) feature selection and 2) checking for multicollinearity and dropping variables based on that? Also, if you want to use KNN for imputation, is there a downside to scaling before imputing? $\endgroup$
    – skeller88
    Commented Apr 17, 2020 at 20:51
1
$\begingroup$

The real estate prices that you are tying to predict , are they consecutive/chronological values i.e. time series data or are they prices for different classes e.g. this years prices for different classes for the same time frame. You might want to read something I wrote on these two kinds of problems as it warns that if you are dealing with longitudinal data ( time series) then the tools of ordinary cross-sectional regression will not ordinarily apply. It is entitled "Regression vs Box-Jenkins" http://www.autobox.com/pdfs/regvsbox.pdf .

$\endgroup$
6
  • 1
    $\begingroup$ Hi! Thanks for the hint! I am trying to predict the prices for different objects based on the properties they have (e.g. size, location etc.) independent of the time the sale took place, so it's no time series. $\endgroup$ Commented Mar 29, 2011 at 6:13
  • $\begingroup$ Thanks for the nice writeup, I'm reading it now. I'm currently working on electricity usage based on outdoor temperature and think I have a nice linear model (two parts: outdoor temp below 55F and outdoor temp above 55F)... That said, you may want to summarize a point or two in your answer: CrossValidated policy discourages answers that mainly consist of links to sites other than your basic reference sites like Wikipedia. $\endgroup$
    – Wayne
    Commented Mar 29, 2011 at 13:24
  • $\begingroup$ @Wayne: Point taken. Since you read the article I wonder if you can help me pick out the "point or two" that would have communicated my ideas on the misuse of Regression for the analysis of time series data. In my opinion this was one of those times that more than one sentence or a snippet was needed to communicate the ideas. Would you have me excerpt the entire article and paste it into my response so as to not reflect on non-Wiki sources. $\endgroup$
    – IrishStat
    Commented Mar 29, 2011 at 17:38
  • $\begingroup$ @Wayne: To the point you made about having two nice linear models, one for below 55F and one for over 55F. Anheuser-Busch used Transfer Function models to deal with the fact that beer consumption was not effected by temperatures under 65F but was effected by temperatures over 65F. If you want to discuss this one model which incorporated this structure, you can feel free to contact me. $\endgroup$
    – IrishStat
    Commented Mar 29, 2011 at 21:47
  • $\begingroup$ I see your point. It's a complicated subject, and without an answer to your first question it's not clear how to answer the OP. Perhaps just a bit more info (I'm not the local expert, just someone who reads CV a lot). Something like: If you try doing time series analysis using common regression tools, they may give you a false sense of confidence due to issues with auto-correlated residuals, or biased answers that can't be corrected even with large amounts of data. I explore the issues in depth in a paper I wrote: http:___. $\endgroup$
    – Wayne
    Commented Mar 31, 2011 at 18:18
1
$\begingroup$

Binning your data is usually a bad idea because it will cause you to lose information, which will likely result in loss of power. Also, I would rarely standardise variables before doing regression, although some people may like to.

A really good book to read, if you can get it, is "Regression Modeling Strategies" by Frank Harrell.

$\endgroup$
1
  • 1
    $\begingroup$ I have to disagree. For someone who has already said s/he's feeling overwhelmed by the information out there, Harrell with his level of detail will surely make things worse. $\endgroup$
    – rolando2
    Commented Mar 29, 2011 at 14:17
1
$\begingroup$

For preprocessing I always like to include outlier detection, and removing bad data. If your data is of different scales, normalizing the data is a good idea (standardization). As far as technique goes, it always pays to graph and plot all of your variables with each other, as well as with the predicted variable. That will tell you a lot about which assumptions you can make about the data such as linearity, equality of variances, normality and can better help you choose a technique.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.