0
I have 2 vectors 
days = c(1, 2, 3, 4, 5, 6, 7)
pct_used = c(22.3, 22.1, 22.1, 22.1, 55.660198413, 56.001746032, 55.988769841)

fit <- lm(days ~ poly(pct_used,2,raw=TRUE))
prediction <- predict(fit, data.frame(pct_used=85))
days_remain <- (prediction - tail(days,1)) 

pct_used 基本上是磁盘空间。所以这段代码预测磁盘空间何时达到 85。
返回的预测值为 325。我觉得这很奇怪。这是否意味着需要 325 天才能达到 pct_used = 85 ?
我哪里错了?

4

1 回答 1

1

试试这个看看发生了什么:

plot(pct_used, days)
lines(pct_used, predict(fit

在此处输入图像描述

plot(pct_used, days, xlim=c(min(pct_used), 85) ,ylim= c(-50,350))
lines(seq(min(pct_used), 85, length=50), predict(fit, newdata=data.frame( 
                                        pct_used=seq( min(pct_used), 85, length=50))))

在此处输入图像描述

于 2013-02-15T01:57:27.070 回答