我正在執行多元迴歸以找到預測價格的最佳模型。有關R控制檯中的輸出,請參閱以下內容。R-如何將控制檯數據保存到行/矩陣或數據框中以供將來使用?
我想將第一列(Estimates)存儲到行/矩陣或數據框中以供將來使用,例如使用R shiny在Web上部署。
*(價格= 698.8 + 0.116 *電壓 - 70.72 * VendorCHICONY -36.6 * VendorDELTA-66.8 * VendorLITEON-14.86 * H)*
有人可以請告知??提前致謝。
Call:
lm(formula = Price ~ Voltage + Vendor + H, data = PSU2)
Residuals:
Min 1Q Median 3Q Max
-10.9950 -0.6251 0.0000 3.0134 11.0360
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 698.821309 276.240098 2.530 0.0280 *
Voltage 0.116958 0.005126 22.818 1.29e-10 ***
VendorCHICONY -70.721088 9.308563 -7.597 1.06e-05 ***
VendorDELTA -36.639685 5.866688 -6.245 6.30e-05 ***
VendorLITEON -66.796531 6.120925 -10.913 3.07e-07 ***
H -14.869478 6.897259 -2.156 0.0541 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 7.307 on 11 degrees of freedom
Multiple R-squared: 0.9861, Adjusted R-squared: 0.9799
F-statistic: 156.6 on 5 and 11 DF, p-value: 7.766e-10
[掃帚(https://github.com/dgrtwo/。掃帚)可能是有用的 – hrbrmstr
感謝您的回覆,但我不明白,你會解釋更詳細?謝謝。 – Samoth
'coef(模型)'會給你估計。如果您將模型(使用'save')保存到.RData對象中,稍後可以導入它並使用'predict'根據您的值預測價格。 –