# Re: [R] (no subject)

From: Benilton Carvalho <bcarvalh_at_jhsph.edu>
Date: Tue, 11 Mar 2008 11:43:53 -0400

imprecise are our eyes :)

check where 4336.543 actually is and note how the range of the data confused you.

plot(a~b)
abline(model)
abline(h=4336.543, v=10)

b

On Mar 11, 2008, at 11:27 AM, Aad Termorshuizen wrote:

>
> # PROBLEM WITH ABLINE
>
> # I have a question about a seemingly imprecise abline figure which
> I have
> come accross now a few times.
> # After reading variables a and b...
> a<-
> c
> (3729,1796,1956,5177,3201,3138,4265,3042,3745,2060,5713,6811,4184,1221,4700,3171,8913,5565,5500,2428,4841,10428,11197,5946,2783,4842
> )
> b<-
> c
> (7,3.4,4.8,11.2,7,5,8.2,6.2,7.4,7.4,18.4,13.8,8.8,3.6,7.2,8.8,23.2,11.8,10.4,5.4,13.7,26.4,27.8,12.8,6.2,15.4
> )
> # ... I do a simple linear regression...
> model<-lm(a~b)
> summary(model)
> # and plot it.
> plot(a~b)
> abline(model)
> # abline drawn with the parameters intercept and slope taken from
> summary(model) yield exactly the same.
> abline(767.59,356.9)
> predict(model,list(b=10))
> # At b=10, the predicted value of a is 4336.543.
> # Now my puzzling question comes: if I deduce the value of variable
> a from
> b=10 from the already created figure,
> # I conclude that a is about 4000 and clearly not something that
> even comes
> close to 4300.
>
> # If I plot only a small part of the regression, the line looks much
> better
> although still there is a gap
> # between what I observe in the figure and what is the calculated
> prediction.
> plot(a~b,xlim=c(10,12),ylim=c(4000,4500))
> abline(model)
> # If I do the prediction by hand
> # from the regression results (summary(model)) then the same figure
> as the
> calculated prediction is the result.
> # My preliminar conclusion is that the figure is imprecise and that
> the
> calculations are correct.
>
> # So my QUESTION is: is abline imprecise or am I making errors?
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help