价格(lm( Qsales ~enter image description here))我用这个函数来画一条线,其中在Qsales中是因变量,价格是自变量。在R studio中,abline(lm(Qsales ~ Price))此命令运行时没有错误,但图形中没有绘制直线
发布于 2019-12-14 18:59:39
在线性模型中,响应变量出现在"~“之前,这通常是yaxis。请参见示例:
fit = lm(mpg ~ wt,data=mtcars)
with(mtcars,plot(wt,mpg))
abline(fit)因此,您需要将其转换为abline(lm(Price ~ Qsales))。
https://stackoverflow.com/questions/59334341
复制相似问题