Solved – Multivariate Linear Regression with continuous and discrete explanatory variable

continuous datalinear modelmultivariate regressionregression

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,

Best Answer

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.