Differences between Chart Trendline and LINEST 4th order polynomial

Movyk

New Member
Joined
May 1, 2018
Messages
2
Dear all,

I am currently processing 1D data formed by two vectors x,y. I have been calculating the 4th order polynomial that better fits the data. I have a matlab code (I am using polyfit3 function) which provides me with the polynomial equation, which matches with the Excel chart trendline obtained from Excel.

Data:

7,19982047,1570077,199827,199827,1962537,1605757,1962537,2069567,199827,1819817,1712787,1891177,2069567,1891177,1962537,167717,1891177,1534397,1819817,1819817,167717,1498717,1784147,199827,199827,167717,1712787,1498717,1819817,1855497,1712787,1748467,1784147,1855497,1891177,1712787,1962537,1855497,167717,1819817,1819817,199827,2033887,1819817,1427367,1712787,1391687,199827,1463037,1712787,1463037,2033887,2069567,1712787,1891177,1819817,1891177,1891177,1891177,1748467,1891177,1891177,1962537,1855497,1962537,1962537,1891177,1855497,1962537,1891177,1962537,1962537,2033887,1605757,1891177,1962537,1213297,1641427,1926857,1819817,1605757,13567,1712787,1962537,1498717,2069567,199827,2069567,1177617,103497,1141937,1213297,1391687,1284647,1356
0,0145462470,007980,0177410,0140180,013170,0079060,0156150,014610,0170490,0138970,0114630,0170620,0098420,0157520,0292940,0062420,0142030,0061180,0161050,0135640,0062420,0081350,0129950,0118970,0169390,0085390,009340,0077130,0151670,0138990,0127970,014450,0145150,0139120,015080,0140730,0141630,014110,0198840,015550,015550,0127010,0107080,0106610,0075440,0085830,0048670,0051340,0064160,0082210,0060280,0087730,007730,0157580,0120530,0256010,0138830,016430,0126390,0149570,0157980,016380,0134870,0149220,0132140,0128920,0160290,0159170,0148660,016380,0168630,0137620,011120,0078990,0126970,016650,007520,0120580,0102090,0088280,0071030,005850,0066410,0101940,0084220,0107030,0074920,0178390,0130320,0106350,0153630,007520,0056380,0066760,00585

<colgroup><col><col span="6"><col span="88"></colgroup><tbody>
</tbody>

Furthermore, the Rsquared from Matlab and Excel chart trendline match, at 42,4%.

The problem happens when I try to validate these data with LINEST.

LINEST is providing a 39,3% Rsquared, which I understood now is happening because LINEST is assuming one of the polynomial coefficients to be zero: (LINEST Equation: =LINEST(D34:CT34;D33:CT33^{1;2;3;4};TRUE;TRUE))

-10,35839856197,8485-1062,8209086,93
2,00717956738,33005205,864501759,467
0,3928788080,003456#N/A#N/A#N/A
19,6292337991#N/A#N/A#N/A

<colgroup><col><col span="4"></colgroup><tbody>
</tbody>
The same pattern occurs if I assume LINEST to provide me a 5th order polynomial: two of the coefficients are automatically assumed to be null.

The polynomial provided by both Matlab and Excel trendline chart has no null coefficients and are equal.

Does anybody knows why LINEST is assuming some of the coefficients to be zero?

I have validated this situation in both Excel 365 and Excel 2013.

Thank you very much

Mário Vieira
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
So, I think it is a problem with LINEST...

If I subtract 7,099922 to all the X values, the LINEST starts working perfectly.

Hope this helps someone.

Best regards
 
Upvote 0
I can replicate your issue, and your fix, but I can't explain it.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,752
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top