Message Font: Serif | Sans-Serif

No. of Recommendations: 0
IIRC, you are a bit of a math wiz. I have a bit of a math problem which I will try to explain.

I am trying to find out if there is a formula to estimate "best fit" values for an equation in the following form:

a(x^b)l + c(y^d)m + e(z^f)n + k = j

a, b, c, d, e, f = unknowns
k, l, m, n, x, y, z = knowns
j = value attempting to estimate.

I will have a table of multiple values for the knowns, and I am looking for a way to determine the best fit for the unknowns, which will be constant across the set of equations, such that "j" will be closest to the actual values in the set of equations.

For example, I will have a table similar to the following:
` k   l   m   n   x   y   z   j 1   2   3   4   5   6   7   8 9   0   1   2   3   4   5   6 7   8   9   0   1   2   3   4 5   6   7   8   9   0   1   2 3   4   5   6   7   8   9   0`

I need a means of determining the single best values of a-f, such that when plugging in the values of k-n, and x-z on any given row, into the above equation, the subsequent computed values for j will be as close as possible to the actual value of j on that row.

Thanks,

FF
No. of Recommendations: 1
I am trying to find out if there is a formula to estimate "best fit" values for an equation in the following form:

a(x^b)l + c(y^d)m + e(z^f)n + k = j

A polynomial will fit absolutely any data you want to fit, given enough terms. Your equation will do a pretty good job of fitting anything with two obvious curves in it.

You need to use a curve fitting program. Excel is probably good enough. It picks some values for the variables, plots a line, compares the predictions with the data, changes a parameter, compares again and if the error between the prediction and the data decreases, it changes the parameter again in the same direction. When the error starts to grow, it reverses direction and then moves on to other parameters.

In the blink of an eye.

Rick
No. of Recommendations: 0
a(x^b)l + c(y^d)m + e(z^f)n + k = j

A polynomial will fit absolutely any data you want to fit, given enough terms. Your equation will do a pretty good job of fitting anything with two obvious curves in it.

A graphing caculator will fit the curve to one set of data. However, you miss the point; I need to determine values for the unknown constants a-f to be the same with multiple values for the independent variables k-n and x-z such that across all sets of values of the independent variables, the dependent variable j is most closely approximated to its actual value.

FF
No. of Recommendations: 0
You are right, I miss your point. Still.

Rick
No. of Recommendations: 0
You are right, I miss your point. Still.

Okay, let me try explaining it a different way. It is my hypothesis that a system behaves in a way that closely follows the formula

f(x) = a(x^b)l + c(y^d)m + e(z^f)n + k

where a-f are constants and k-n, x-z variables. I have done 1000's of experiments where I have varied the values of k-n and x-z. In each experiment, I have obtained a result "j". I am attempting to find what values should be used for the constants a-f. How can I determine the best value of each constant (a-f) such that f(x) will be as close as possible to the experimental values, j?

Also, I will be using a stand-alone program to do the computations; a built in excel function, therefore, won't work.

FF
No. of Recommendations: 0
Finsternis:Gwen, I doing math over here, get me a gin and tonics, please. And if you see Mr. Tesla ask him to join us.

Finsternis: Not a math guru, FF, but algebraicly, you're out of luck.

One needs as many equations as variables

Z.B.

a+b=3
a-b=1

We can see that a=2 and b=1.

Merely saying that a+b=3 doesn't tell you anything. It could be 2+1 or 7+-4.

NT: That said, if you know something about the system an iterative process can be used to to determine roughly what each constant is. Vich is say, that if 0<a<20, 3<b<7, sort of thing then it can be done. Current, you seem to have infinite possibilities.

Finsternis: What 6 variable system are you studying, anyway?
No. of Recommendations: 0
Not a math guru, FF, but algebraicly, you're out of luck.

One needs as many equations as variables

My problem is the opposite one. I have more equations, by a couple of orders of magnitude, then I have equations. I want the solution that results in the least total error.

Finsternis: What 6 variable system are you studying, anyway?

I'm actually studying a system with millions of variables and trying to obtain a rough approximation of it with 6 variables. The system? The stock market.

FF
No. of Recommendations: 0
"My problem is the opposite one. I have more equations, by a couple of orders of magnitude, then I have equations. I want the solution that results in the least total error."

Huh?

I think you mean variables.

Back to iterations, I would probably be comfortable confining your exponents to values < 10.

Finsternis
No. of Recommendations: 0
"My problem is the opposite one. I have more equations, by a couple of orders of magnitude, then I have equations. I want the solution that results in the least total error."

Huh?

I think you mean variables.

Actually, I meant, I have more data, by a couple of orders of magnitude to plug into the variables, than I have equations.

FF
No. of Recommendations: 0
Actually, I meant, I have more data, by a couple of orders of magnitude to plug into the variables, than I have equations.

P.S. What I am looking for I think would be a least squares fit for the data.

FF
No. of Recommendations: 0
P.S. What I am looking for I think would be a least squares fit for the data.

Which is exactly what I *described* to you. I didn't use a term or definition for it, I described it.

You don't listen to others so good.

Rick
No. of Recommendations: 0
Which is exactly what I *described* to you. I didn't use a term or definition for it, I described it.

You stated:

A polynomial will fit absolutely any data you want to fit, given enough terms. Your equation will do a pretty good job of fitting anything with two obvious curves in it.

I took this to mean that you were describing a situation where there would be a perfect fit, in other words, 6 equations to get an exact value for the 6 "unknowns". If there were more than 6 equations I would need more terms, which is not an option.

That aside, I can't use Excel for this project. To much data to fit.

FF
No. of Recommendations: 0
I took this to mean that you were describing a situation where there would be a perfect fit, in other words, 6 equations to get an exact value for the 6 "unknowns". If there were more than 6 equations I would need more terms, which is not an option.

FF, I am expert in this kind of thing. If you don't want advice or opinions on this kind of thing, don't ask.

Rick
No. of Recommendations: 0
FF, I am expert in this kind of thing. If you don't want advice or opinions on this kind of thing, don't ask.

Rick,

Let me try this again. I misunderstood what you were suggesting. I acknowledged that. I did not mean to insult you, irritate you, or annoy you. Although I have taken some advanced math, I am not an expert on this type of thing which is why I asked for help. When I read what you wrote, I misunderstood what you were saying.

There was a miscommunication, probably due to my ignorance of the subject. I have never had to deal with "best fit" type of math ever. All the math that I have ever done involved either (a) producing exact results, such as the amount of thrust needed to transfer an object from low earth orbit into geosynchronous orbit, or (b) black box stuff such as plugging in a bunch of numbers into a subroutine and having it spit out a least squares best-fit for m and b in the y=mx+b equation.

Do I want help, yes. I posted this on another board and was pointed to PRAXIS which I am checking out; maybe this will work, but if you have another suggestion (as I said, Excel won't work for me), let me know.

Meanwhile - tell Gwen your next drink's on me.

FF
No. of Recommendations: 0
What I am looking for I think would be a least squares fit for the data.

For MI-related stuff, I would guess?
Does this help at all? Or is it completely unrelated?

http://boards.fool.com/Message.asp?mid=15141924
http://boards.fool.com/Message.asp?mid=15166402
No. of Recommendations: 0
For MI-related stuff, I would guess?

Yes.

Does this help at all? Or is it completely unrelated?

It is related, but not that helpful. It describes how do a least square fit assuming a linear function. I am not dealing with a linear function.

FF
No. of Recommendations: 1
FF:

I like math, but it is not my profession nor am I formally educated in the field, so take what I say with a grain of salt. Having said that, I agree that what you are trying to do is a least squares type of problem. And since you are using a linear combination of polynomials a linear programming tool should do the trick. Depending upon your exact goals, a decent tool might be the Solver Add-in in Excel. This may be what Trick was describing.

Here is quick and dirty model I made from what you provided. I set your variables a-f in cells A1-F1 and assigned them dummy values of 1 (Solver will change them later). In cells A6:H10, I posted the data from your example table. In column I, I placed the formula you provided referencing the variables a-f and the values from the table for each row (except variable j, which is the formula output). I then added another formula in cells J6:J10 that represented the squared difference between the formula output (col I) and the target output (variable j in column H) for each row. In cell J11, I summed all the squared differences from the individual rows (J6:J10). The goal is to minimize the value of this cell by changing the values in cells A1:F1.

Using solver, I set the target cell to J11, set it to minimize and set the changing cells to A1:F1. The only thing left to do is to set the constraints which are dependent upon what it is you are trying to do. For example, is it OK for the values of A1:F1 to be <0? non-integer? >100? etc. Once the constraints are entered, hit Solve.

As a linear programming tool, Solver isn't very robust. The one issue I ran into is Excel doesn't like to raise 0 to a power and so if Solver tries 0 as a base it chokes and stops without returning an answer. So, if it doesn't work for you, you can check out other linear programming utilities. However, I have no advice for you in that realm as I have never used anything else.

Hope this helps!

--FW
No. of Recommendations: 0
Also, I will be using a stand-alone program to do the computations; a built in excel function, therefore, won't work.

Oops... didn't see that before I hit submit. I'm not afamiliar with stand-alone Linear Programming software but that is what you want.

--FW

No. of Recommendations: 0
To all those who posted on this thread - thanks.

Gwen - drinks for all of them.

FF