troubleshooting Question

Finding a Best-Fit Logarithmic Regression Equation Using SQL

Avatar of dresdena1
dresdena1 asked on
MySQL ServerMath / Science
18 Comments2 Solutions1480 ViewsLast Modified:
I have a table in one of my MySQL databases with two columns of data that are correlated with each other.  I'm trying to find out how to create the best-fit logarithmic equation of the form y = A * ln(x) - B for this data, basically trying to calculate A and B.

The data is below, and Excel says that the equation should be y = 0.021ln(x) - 0.089, but I want to calculate it inside MySQL since I'll have a lot of these and I'd like it to automate the process.

Any help would really be appreciated.  Thanks!

01  |  -0.23
02  |  -0.04
03  |  -0.05
04  |  -0.05
05  |  0.03
06  |  -0.01
07  |  -0.05
08  |  0.00
09  |  -0.03
10  |  -0.03
11  |  -0.04
12  |  -0.04
13  |  0.01
14  |  -0.03
15  |  -0.04
16  |  -0.02
17  |  0.01
18  |  -0.03
19  |  -0.05
20  |  -0.01
21  |  -0.04
22  |  -0.07
23  |  0.00
24  |  -0.06
25  |  0.02
26  |  -0.04
27  |  -0.01
28  |  -0.08
29  |  0.00
30  |  -0.03
31  |  0.01
32  |  0.02
33  |  -0.18
34  |  -0.12
35  |  0.02
36  |  0.06
37  |  0.02
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros