简体   繁体   English

鉴于我可以访问 R 的“摘要”输出,如何在 Excel 中从 R 复制预测函数

[英]How to replicate the predict function from R in Excel given I have access to "summary" output from R

I have run a 3rd order polynomial regression in R and have run the "summary" function, but I need to be able to replicate the "predict" function in Excel.我在 R 中运行了三阶多项式回归并运行了“汇总”函数,但我需要能够在 Excel 中复制“预测”函数。 I have my current working code below.我在下面有我当前的工作代码。 Thank you for your help!感谢您的帮助!

#Have access to this output:
AICFit <- lm(R60 ~ poly(M20, 3) + poly(M40, 3), data = mydata)
summary(AICFit)

#do not have access to output: 
predict(AICFit,data.frame(M20=0.972375241,M40=0.989086129,interval ="prediction")

Basically, I don't have access to R when I have access to these numbers: 0.972375241,0.989086129.基本上,当我可以访问这些数字时,我无法访问 R:0.972375241,0.989086129。

I believe this is the equation that is the basis for the predict function, but I don't know how to compute this in Excel incorporating order 1, 2 and 3:我相信这是作为 predict 函数基础的方程,但我不知道如何在 Excel 中结合顺序 1、2 和 3 计算它:

You do not have enough information from summary to calculate the prediction interval in Excel.您没有足够的summary信息来计算 Excel 中的预测区间。

So the simple answer is - it is not possible to do it without an access to variance-covariance matrix (however for orthogonal polynomials in your model it is diagonal) and raw data.所以简单的答案是 - 如果不能访问方差-协方差矩阵(但是对于模型中的正交多项式,它是对角线)和原始数据,就不可能做到这一点。 Moreover you need to extract orthogonal polynomial coefficients themselves, which are generated recursively and uniquely for each dataset you are fitting.此外,您需要自己提取正交多项式系数,这些系数是为您拟合的每个数据集递归且唯一生成的。

The formula you are referencing is for the univariate linear regression and it is not applicable for your case where you are doing multivariate polynomial regression for two variables: M20 and M40 .您引用的公式适用于单变量线性回归,不适用于您对两个变量进行多元多项式回归的情况: M20M40

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM