0
$\begingroup$

I don't have a good knowledge of statistic but i have looked for 3 hours without resolving the problem so i think to ask

I have two variables and i have made a linear regression scatterplot my question is: if i would like to remove same values to have a more fitting line how should i proceed?

i tried removing high values of mean, difference and sd but as i later discovered i was doing it wrong

$\endgroup$
  • 2
    $\begingroup$ Why do you want to remove values to improve the fit of the line? If that's your data, and that's the line that your regression has fitted to the data, then what is your motivation for trying to change it? $\endgroup$ – Ian_Fin Jul 13 '16 at 10:24
  • $\begingroup$ we are doing a study about a comparison between self-reported (questionnaire, subjective) and objective measurement of physical activity and to show a preview of the study before going to check all the answer in the questionnaire they asked me to hide values too far from the regression $\endgroup$ – aster94 Jul 13 '16 at 10:28
  • 2
    $\begingroup$ While it may be nicer looking, it's also misleading to present a regression line fitted to a full data set, alongside a set of data points subsequently handpicked to be closer to that regression line. If there are data points there that reflect outliers then it may be worth removing them, following a defensible approach, but then you'd refit the regression it. $\endgroup$ – Ian_Fin Jul 13 '16 at 10:44
  • 1
    $\begingroup$ Yeah, that's possible. You should read the material IcannotFixThis has suggested. If that is the case though then you really should reconsider removing those items. That nice looking graph will be statistically dishonest. $\endgroup$ – Ian_Fin Jul 13 '16 at 11:14
  • 2
    $\begingroup$ Whatever you do, take a principled approach. If you try multiple ways of messing with the data until it looks nice, your conclusions would be misleading and invalid. Any further statistics you run would be over-optimistic because they wouldn't take into account the earlier procedures that were done explicitly to get a good fit. en.wikipedia.org/wiki/Data_dredging $\endgroup$ – user20160 Jul 13 '16 at 12:21
1
$\begingroup$

I guess, sometimes you even Need to learn how to lie with statistics. I am not going to comment or judge. The easiest way would be to look at the residuals and kill the point with the largest residual before repeatind fitting and checking residuals. The plot looks as if it was made with R, so here is a hint to R: The linear regression is done using lm() and that Returns an object with a slot "residuals". The number of the point with the largest residual can be found with which.max:

x<-rnorm(100)
y <- 2*x+5+rnorm(100)

which.max(lm(y~x)$residuals)
$\endgroup$
  • $\begingroup$ I agree with the spirit of the answer, but this approach would only remove one data point. The question did talk about removing values, plural. Perhaps there should be an iterative process? $\endgroup$ – Ian_Fin Jul 13 '16 at 13:09
  • $\begingroup$ @Ian_Fin I had an iterative process in mind, when I wrote "before repeatind fitting and checking residuals". Once one point is removed, all the residuals are not correct anymore and I propose to compute them anew before proceeding. Thanks for the clarification! $\endgroup$ – Bernhard Jul 13 '16 at 13:12
  • $\begingroup$ Well, @Bernhard, your comment above is not 100% correct - I fear you are confusing residuals and "influence". High residual points might or might not have big influence $\endgroup$ – IcannotFixThis Jul 13 '16 at 19:55
  • $\begingroup$ @IcannotFixThis Fear not! First: High residual points might have big influence and therefore my recommendation stands, to remove one at a time and calculate residuals every time anew. If it was not influencial, than little is lost. Second: the OP wants to improve the visual impression of his regression line. An influential point may very well be situated very close to the regression line and therefore it seems logical, not to remove it just because it is influential. I must admit though, that I am neither trained nor experienced in massaging data into linear form to make for a nice plot. $\endgroup$ – Bernhard Jul 13 '16 at 20:35
0
$\begingroup$

Without getting in the dispute concerning whether removing points from your data set might or might not make sense, I think it might be useful clarify the difference between outliers, leverage and influence

I believe such framework would help you understand the role played by each point to your regression.

You can have read here.

$\endgroup$
  • $\begingroup$ thanks for the paper, i didn't read everything yet, but i think mine are both leverage and outliers, anyway i don't think i will find there how to solve my problem $\endgroup$ – aster94 Jul 13 '16 at 11:17
  • $\begingroup$ Well, I honestly don't think that there's a "right" (in the string meaning of the term) answer to your question. The deck at least covers the theory though. $\endgroup$ – IcannotFixThis Jul 13 '16 at 13:17
  • $\begingroup$ @IcannotFixThis The OP asked for a procedure and you answered with the clarification of related terms. You should really clarify, what your answer to the question is. $\endgroup$ – Bernhard Jul 13 '16 at 20:39
0
$\begingroup$

In some cases and if your problem is to better "present" rather than interpret it could make sense to log transform data. It must be done with care and need to ensure that the data are still interpretable. As example

enter image description here

enter image description here

However, if the correlation is poor I don't see how you can get it "nice" looking

$\endgroup$

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.