由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 为什么不能把ABLINE加到散点图中了
相关主题
Is there any correlation between the two data set?请教:关于用R画regression line
[合集] 请教一个统计问题新手请教sas 能画吗:散点图,有连线连接起来,并且有regression 线
data prediction by regression or better ways看似简单,但是竟然不会做。
regression problem - go confused请教比较两个regression coefficient
紧急求助,问到MULTIPLE REGRESSION的题请问multi variate linear regression 选择risk factor 问题
2个初级的R问题: 包子答谢!突然对直线拟合的R不明白起来了
How to compute the area between my curve and diagonal line关于R的Simplex的错误信息
求助,怎么消除线性回归的multicollinearity如何把model fitting statistics 读出来(R)
相关话题的讨论汇总
话题: abline话题: fm话题: plot话题: lm话题: scatter
进入Statistics版参与讨论
1 (共1页)
d*******1
发帖数: 854
1
以前都是用lm(y~x), plot(y,x), abline(fm, col=4)
regression line 就自动加到scatter plot里了,
如下:
fm<- lm(y~x, data)
attach(data)
plot(y~x)
abline(fm, col=4)
但是现在只产生了SCATTER PLOT, ABLINE 加不上去。好象什么被turn off了, 请帮助
谢谢
S******y
发帖数: 1123
2
It works for me...
y<-rnorm(100)
x<-rnorm(100)
fm<-lm(y~x)
plot(y~x)
abline(fm, col=4)
d*******1
发帖数: 854
3
your example work for me too. however, i could not replicate this success in
my own data frame. i got perfect scatter plot and summary(lm(y~x,data))
looks perfect OK.However, the abline just refuses to show up!!!!! what a
frustration!

【在 S******y 的大作中提到】
: It works for me...
: y<-rnorm(100)
: x<-rnorm(100)
: fm<-lm(y~x)
: plot(y~x)
: abline(fm, col=4)

g********r
发帖数: 8017
4
把coefficient拿出来用abline试试,看看是不是lm object的格式问题?

in

【在 d*******1 的大作中提到】
: your example work for me too. however, i could not replicate this success in
: my own data frame. i got perfect scatter plot and summary(lm(y~x,data))
: looks perfect OK.However, the abline just refuses to show up!!!!! what a
: frustration!

d*******1
发帖数: 854
5
can you be more specific about takin out coefficient?
> class(fm)
[1] "lm"
the class of fm seems to be OK.

【在 g********r 的大作中提到】
: 把coefficient拿出来用abline试试,看看是不是lm object的格式问题?
:
: in

g********r
发帖数: 8017
6
abline(fm$coef)
另外检查一下fm$coef是不是对的。abline这种函数不应该出问题。我怀疑是
coefficient不对,所以线画到plot范围外边去了。

【在 d*******1 的大作中提到】
: can you be more specific about takin out coefficient?
: > class(fm)
: [1] "lm"
: the class of fm seems to be OK.

d*******1
发帖数: 854
7
好吧,我把Ripley书里的例子和我自己的数据side by side run 了一下。他的好好的
我的就是死活不行(abline(fm)和abline(fm$coef)应该都行的)
而且我的散点数据看上去很好的, 难道一个简单的regression 还会fit 错了?

【在 g********r 的大作中提到】
: abline(fm$coef)
: 另外检查一下fm$coef是不是对的。abline这种函数不应该出问题。我怀疑是
: coefficient不对,所以线画到plot范围外边去了。

d*******1
发帖数: 854
8
一看coefficient 就明白了, 真是把XY搞反了, 在plot里正过来就好了。 谢谢

【在 d*******1 的大作中提到】
: 好吧,我把Ripley书里的例子和我自己的数据side by side run 了一下。他的好好的
: 我的就是死活不行(abline(fm)和abline(fm$coef)应该都行的)
: 而且我的散点数据看上去很好的, 难道一个简单的regression 还会fit 错了?

1 (共1页)
进入Statistics版参与讨论
相关主题
如何把model fitting statistics 读出来(R)紧急求助,问到MULTIPLE REGRESSION的题
真心请教各位统计高手一个关联序列生成问题2个初级的R问题: 包子答谢!
求助,R 画图How to compute the area between my curve and diagonal line
这个是什么model模拟出来的,用R做的求助,怎么消除线性回归的multicollinearity
Is there any correlation between the two data set?请教:关于用R画regression line
[合集] 请教一个统计问题新手请教sas 能画吗:散点图,有连线连接起来,并且有regression 线
data prediction by regression or better ways看似简单,但是竟然不会做。
regression problem - go confused请教比较两个regression coefficient
相关话题的讨论汇总
话题: abline话题: fm话题: plot话题: lm话题: scatter