Properties
Category
English
Similar Topics
Statistics
Comments
4
Participants
3
Subscribers
0
Votes
1
Views
1408
Share
Bug in Trendexp
New
Is there an explanation why there are 2 different results for Fit?
Liste1 = {A, B, C, D}
f(x) = FitExp[Liste1]
g(x) = a ℯ^(b x)
h(x) = Fit[Liste1, g]
f and h should be the same?!
Andreas
ggb 4.2.28
Files:
Trend_exp.png
 GeoGebra
 Help
 Partners

Contact us
 Feedback & Questions
 This email address is being protected from spambots. You need JavaScript enabled to view it.
 +43 677 6137 2693
© 2023 International GeoGebra Institute
IANAGGP (I am not a GeoGebra programer), but I think I can explain what is probably going on. In a nutshell, they use two different algorithms.
The FitExp[] command linearizes the data by taking the natural log of the y values and then finding the bestfit line from all the (x,ln(y)) points. The process for doing this type of regression is very simple and fast. This bestfit line will produce results that will be fairly close to the actual bestfit exponential curve. This is what your calculator's ExpReg command does.
The Fit[] command attempts to find the bestfit curve based on the given function without doing any linearizing. It's a much more complicated process, but if done correctly will result in a curve that is the actual bestfit curve. I don't know what GG does, but the method usually involves systematically trying different values for a,b,c... until the sum of the squares of the differences between the actual and predicted y values is a minimum (the method of leastmeansquares). (If I'm not mistaken, I think that your calculator's Logistic Regression uses a similar technique which is why it takes so long to calculate.)
If you plug the data points you gave into a calculator and use ExpReg, the calculator will give you an equation equivalent to FitExp[] and report that the r^2 = 0.89318. But this is the r^2 of the line using the linearized points. If you calculate the r^2 of the suggested exponential curve, you get r^2 = 0.89459. However, if you find the r^2 of the exponential curve from Fit[], you get r^2 = 0.92381.
In other words, Fit[] gives you a better "fit" than FitExp[].
Hope this helps,
Wes L
Did you try g(x) = a e^(b x) without the minus sign? It shouldn't matter but maybe this is what throws off the more complicated algorithm fot Fit[]?
Have you tried other comparisons, like linear, polynomial, trigonometric, logistic...?
Yes, I have tried g(x) = a e^(b x)  same result as for g(x) = a e^(b x).
Andreas
IANAGGP (I am not a GeoGebra programer), but I think I can explain what is probably going on. In a nutshell, they use two different algorithms.
The FitExp[] command linearizes the data by taking the natural log of the y values and then finding the bestfit line from all the (x,ln(y)) points. The process for doing this type of regression is very simple and fast. This bestfit line will produce results that will be fairly close to the actual bestfit exponential curve. This is what your calculator's ExpReg command does.
The Fit[] command attempts to find the bestfit curve based on the given function without doing any linearizing. It's a much more complicated process, but if done correctly will result in a curve that is the actual bestfit curve. I don't know what GG does, but the method usually involves systematically trying different values for a,b,c... until the sum of the squares of the differences between the actual and predicted y values is a minimum (the method of leastmeansquares). (If I'm not mistaken, I think that your calculator's Logistic Regression uses a similar technique which is why it takes so long to calculate.)
If you plug the data points you gave into a calculator and use ExpReg, the calculator will give you an equation equivalent to FitExp[] and report that the r^2 = 0.89318. But this is the r^2 of the line using the linearized points. If you calculate the r^2 of the suggested exponential curve, you get r^2 = 0.89459. However, if you find the r^2 of the exponential curve from Fit[], you get r^2 = 0.92381.
In other words, Fit[] gives you a better "fit" than FitExp[].
Hope this helps,
Wes L
Well, it helped me at least. Thanks for a clear and concise explanation.
:)
Comments have been locked on this page!