您需要预测值为的新数据
temp
超出范围
200-450
。
请参见我的示例:
# predict with new data
df <- data.frame(yield = predict(md, data.frame(temp = seq(100, 600, 0.01))),
temp = seq(100, 600, 0.01))
# plot
ggplotly(
ggplot() +
geom_point(data = GasolineYield,
aes(x = temp, y = yield, fill = batch),
size = 4, shape = 21) +
xlim(100, 600) +
geom_line(data = df, aes(y = yield, x = temp), col="red") +
theme_classic())