I have to use Excel's LINEST function to compute error in my linear regression. I was hoping to reproduce the results using Numpy's polyfit function. I was hoping to reproduce the following LINEST usage:

LINEST(y's, x's,,TRUE)

with polyfit. I'm not sure how I can get the two functions to produce the same values because nothing I've tried gives similar results.

I tried the following:

numpy.polyfit(x,y,3)

and various other values in the third position.

有帮助吗?

解决方案

This question is actually a result of my misunderstanding of NumPy's polyfit function and LINEST. Doing the following:

 numpy.polyfit(x,y,1)

gave me the correct result because it performs a linear regression using the sample x and y values like LINEST.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top