Skip to content

[RsR] robust scatterplot with fits

2 messages · Pep Serra, Matias Salibian-Barrera

#
Dear RsR list members,

  I somehow got stuck wth lmRob and I am sure I am missing something and 
I do not know what. It is my first time using robust statistics and I 
have read all your posts and pdfs recommended

I think it is likely to be a newbie question. I ploted two variables and 
the pictures shows a number of outliers that I want to identify given 
that the main trend between those two measurements is positive. 
(although they look like a lot, it is more or less 800 points out of 6000)





I used then

robust<-lmRob(WPROB~NPP,data=a)


lmRob(formula = WPROB ~ NPP, data = a)

Coefficients:
  (Intercept)          NPP
499.86274538  -0.00990502

Degrees of freedom: 6002 total; 6000 residual
Residual standard error: 250.3199

1) I do not really understand the slope of the regression, why is it 
negative???

then used plot.lmRob(robust) and choose for option 11 (scatter plot with 
fits)



What is meant to be the x axis (WPROB) turns into the y axis.
The regression line and the confidence intervals shown have nothing to 
do, of course, with the coefficients retrieved...what am I doing wrong?

Thank you in advance,

pep

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-robust/attachments/20101019/aaa084eb/attachment.html>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: moz-screenshot-1.png
Type: image/png
Size: 7291 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-robust/attachments/20101019/aaa084eb/attachment.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: moz-screenshot-2.png
Type: image/png
Size: 19908 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-robust/attachments/20101019/aaa084eb/attachment-0001.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: josep_serra.vcf
Type: text/x-vcard
Size: 448 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-robust/attachments/20101019/aaa084eb/attachment.vcf>
#
Hello Pep,

If NPP is the response variable (the "y" variable) and WPROB is the 
explanatory variable (the "x" variable), then you should have used

lmrob(NPP ~ WPROB, data=a)

Also, I recommend you use the latest version of the "robustbase" package

 > install.packages('robustbase')
 > library(robustbase)

There the function for a robust regression fit is called lmrob (not 
lmRob, which is now deprecated).

Finally, based on your plot, you might also want to consider a model 
incorporating log(WPROB), since the relationship does not appear to be 
quite linear to the naked eye.

Hope this helps.

Matias
On 10-10-19 07:32 AM, Pep Serra sat down at the computer and wrote: