小编use*_*394的帖子

R语言,非线性模型公式预测

我用一组数据 (x, y) 拟合指数公式。然后我想根据公式计算 y 值,其中 x 值超出实际数据集。它不起作用,总是打印实际 x 值的 y 值。这是代码。我做错了什么?我的 R 语言任务的解决方案是什么:

data <- data.frame(x=seq(1,69), y=othertable[1:69, 2])
nlsxypw <- nls(data$y ~ a*data$x^b, col2_60, start=list(a=2200000, b=0))
predict(nlsxypw)
#here I want to calculate the y values for x = 70-80
xnew <- seq(70, 80, 1)
predict(nlsxypw, xnew)

#it doesn't print these values, still the actual values for x=1~69.
Run Code Online (Sandbox Code Playgroud)

r nls predict

2
推荐指数
1
解决办法
864
查看次数

标签 统计

nls ×1

predict ×1

r ×1