简单线性回归的实现
You have two vectors, x and y, that hold paired observations: (x1, y1), (x2, y2), ..., (xn, 公卫论坛
yn). You believe there is a linear relationship between x and y, and you want to createa regression model of the relationship.
The lm function performs a linear regression and reports the coefficients:
公卫论坛
> lm(y ~ x)
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
17.72 3.25
附件列表
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。