多重线性回归的实现
You have several predictor variables (e.g., u, v, and w) and a response variable (y). You believe there is a linear relationship between the predictors and the response, and you want to perform a linear regression on the data.
公卫考场
Use the lm function. Specify the multiple predictors on the righthand side of the for-
mula, separated by plus signs (+):
> lm(y ~ u + v + w) 公卫百科
> dfrm
y u v w
公卫考场
1 6.584519 0.79939065 2.7971413 4.366557
2 6.425215 -2.31338537 2.7836201 4.515084
3 7.830578 1.71736899 2.7570401 3.865557
4 2.757777 1.27652888 0.4191765 2.547935 公卫人
5 5.794566 0.39643488 2.3785468 3.265971
6 7.314611 1.82247760 1.8291302 4.518522
7 2.533638 -1.34186107 2.3472593 2.570884
8 8.696910 0.75946803 3.4028180 4.442560
公卫百科
9 6.304464 0.92000133 2.0654513 2.835248
10 8.095094 1.02341093 2.6729252 3.868573
.
. (etc.)
> lm(y ~ u + v + w, data=dfrm)
公卫论坛
Call:
lm(formula = y ~ u + v + w, data = dfrm)
Coefficients:
(Intercept) u v w 公卫论坛
1.4222 1.0359 0.9217 0.7261
附件列表
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
如果您认为本词条还有待完善,请 编辑
上一篇 简单线性回归的实现 下一篇 获得回归模型的统计量