📜  在 R 中的单点预测线性模型 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:14.355000             🧑  作者: Mango

代码示例1
df <- data.frame(meanValuesHeatingPower = c(1,4,3,7), 
                 meanValuesOutsideTemperature = c(4,3,4,7))

linearModel<-lm(meanValuesHeatingPower ~ meanValuesOutsideTemperature, data = df)

pred<-predict(linearModel, data.frame(meanValuesOutsideTemperature = c(1)))
print(pred)