Dear R users,
I am a new R user. My problem is very simple: I want to add a linear
regression line to the plot(type=p), codes are as below:
x-c(10,20,40,80)
y-c(30,40,100,200)
plot(x,y,type=p)
lines(lm(x~y),col=red,lwd=1.5)
I got only plot without linear line.
Many thanks ahead for your
Dear R users,
I am a new R user. My problem is very simple: I want to add a linear
regression line to the plot(type=p), codes are as below:
x-c(10,20,40,80)
y-c(30,40,100,200)
plot(x,y,type=p)
lines(lm(x~y),col=red,lwd=1.5)
I got only plot without linear line.
Many thanks ahead for your
-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] Namens wangxipei
Verzonden: donderdag 13 januari 2011 9:35
Aan: r-help
Onderwerp: [R] add a linear regression line to the plot
Dear R users,
I am a new R user. My problem is very simple: I want to
add a linear regression
On Thu, 13-Jan-2011 at 04:35PM +0800, wangxipei wrote:
|
| Dear R users,
|I am a new R user. My problem is very simple: I want to add a linear
regression line to the plot(type=p), codes are as below:
|
| x-c(10,20,40,80)
| y-c(30,40,100,200)
| plot(x,y,type=p)
|
?abline
On Thu, Jan 13, 2011 at 12:29 AM, wo bellew...@163.com wrote:
Dear R users,
I am a new R user. My problem is very simple: I want to add a linear
regression line to the plot(type=p), codes are as below:
x-c(10,20,40,80)
y-c(30,40,100,200)
plot(x,y,type=p)
Hi,
lines(lm(x~y),col=red,lwd=1.5)
should be
abline(lm(y~x),col=red,lwd=1.5)
hth.
Am 13.01.2011 09:35, schrieb wangxipei:
Dear R users,
I am a new R user. My problem is very simple: I want to add a linear
regression line to the plot(type=p), codes are as below:
x-c(10,20,40,80)
Hi,
if it should be lines so you can do that
xy.lm - lm(y~x)
lines(x, xy.lm$coeff[1] + x*xy.lm$coeff[2], col=blue, lwd=3)
Regards
ep
--
View this message in context:
http://r.789695.n4.nabble.com/add-a-linear-regression-line-to-the-plot-tp3215455p3216099.html
Sent from the R help mailing
7 matches
Mail list logo