1
$\begingroup$

I'm quite new at linear regression. I get the following Residuals vs Fitted plot with parallel straight lines:

enter image description here

I do not understand why there are two parallel lines. Is there a problem with my data?

Thx !

$\endgroup$
  • $\begingroup$ Your response variable is binary (0/1 or any two other distinct values), right? $\endgroup$ – Glen_b -Reinstate Monica Jul 8 '16 at 11:29
  • $\begingroup$ Yes it is a binary response (0/1) and there are some NA $\endgroup$ – qaomia Jul 8 '16 at 12:05
3
$\begingroup$
  1. Your original data consist of a pair of parallel lines!

    Something like this:

    enter image description here

    The red line indicates the least squares linear fit for this one-predictor case.

  2. You then subtract the linear fit in red from the data laying on that pair of parallel lines to get a downsloping pair of lines in the residuals (calculating residuals from fitted is a skew transformation of the plot vs x, and making it vs fitted simply rescales the x-axis:

    enter image description here

If you have multiple predictors the plot would not look "neat" like this (with two clean lines), though. Are you certain you fitted multiple regression in your display?


A linear fit is generally not suitable for such data since the fitted line goes outside 0-1 (see where with my data the line crosses to above the data at about x=4?). More commonly a model that predicts the probability that the response is 1 would be used, such as logistic regression.

You may find the discussion of the model you fitted with the one I just mentioned at this post of some additional value.

$\endgroup$
  • $\begingroup$ Thx for your answer. I will perform logistic regression then. What would be your suggestion for the NA values ? I don't like using na.omit because I lose 800 rows out of 2400. But I don't want NA to interfer with my model. $\endgroup$ – qaomia Jul 8 '16 at 12:41
  • $\begingroup$ Should probably be a new question, but -- what do your NA values actually indicate? Are they in the response or the predictor? What would cause them? $\endgroup$ – Glen_b -Reinstate Monica Jul 8 '16 at 12:54
  • $\begingroup$ They are in the predictors : some data are simply missing and some data are estimated but the fiability of the estimation was low so I prefered to put NAs instead. $\endgroup$ – qaomia Jul 8 '16 at 13:01
  • $\begingroup$ How are you estimating these? When you say 'fiability" what do you mean? If you mean 'viability' what makes an estimate viable? What would the proportion of data be if you hadn't filled any in? When you say "some are simply missing" is the tendency to missingness likely to be related to either the x or the y? $\endgroup$ – Glen_b -Reinstate Monica Jul 8 '16 at 13:21
  • $\begingroup$ My data are characteristics of houses. For example one estimated predictor is the year of construction of theses houses. To estimate it, I've used open data by knowing the location and the surface of my houses. In this case, my viability indicator is the difference of surface between my house and the one from the open data source. For some rows, the difference was over 1000 squared meters so I think it is irrelevant and I put NAs. This is totally arbitrary. My response y is totally filled by either 0 or 1. $\endgroup$ – qaomia Jul 8 '16 at 13:28

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.