I have some trouble to apply a multivariate linear regression on my data. I have two features gross_area which is continuous, nb_bathrooms which is discrete (1,2,3) and a dependent variable y which is the price. Firstly I have looked at the feature's distribution which is not normal (Skewed right). I removed some outliers. I standardized my features.I use OLS as cost function and "batch" gradient descent in order to find my parameters. I find my parameter I plot separately the gross_area against the price with parameter gross_area and the y-intercept, and a plot of the nb_bathrooms against the price with parameter nb_bathrooms and the y-intercept also.

This is what I got for the gross_area: gross_area
And for the nb_bedrooms: enter image description here

So my questions are the following, How can I fit data like nb_bedrooms since I tried polynomial terms but does not seem to fit them better.

Thank you,


Notice that you are predicting negative prices for small gross areas. Does that make sense (Please come and live in this appartment, I will give you money if you do). I would consider using a log link function.

As for the categorical variable, I would just add indicator variables for the number of bathrooms instead of entering it as a continuous variable.

  • $\begingroup$ Thank you, for you answer, effectively it does not make any sense. I should apply log link function on my predicted price matrix ? $\endgroup$ – Marc Lamberti Apr 8 '15 at 11:54
  • 1
    $\begingroup$ I prefer to use a link function instead of transforming the dependent variable. That way you continue to model the mean price instead of the mean log(price). $\endgroup$ – Maarten Buis Apr 8 '15 at 12:12
  • $\begingroup$ I understand, but I don't see how can I apply this actually :/ $\endgroup$ – Marc Lamberti Apr 8 '15 at 14:23
  • $\begingroup$ Here is one brief explanation, with many references, also in the comments, to check out if you want to know more. $\endgroup$ – Maarten Buis Apr 9 '15 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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