LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Recover a formula from a data table (https://www.linuxquestions.org/questions/programming-9/recover-a-formula-from-a-data-table-557785/)

 Telemako 05-30-2007 01:38 PM

Recover a formula from a data table

I have a table with data. Each row determines a value called X, that I also have. What I'll like to do is recover the formula that calculates this X value. I think this is called data interpolation but I don't know how to do it =/
I have a lot of this data so I can at least get an approximation to the original formula, but how can I automate that?

I have the data on an opencalc sheet, but I can adapt to any programming language. Any tips?

Example
Code:

```A      B      C      D      E      F      G        X 25        26        1        7        9        11        24        1,6 23        23        1        6        11        11        24        1,6 20        16        2        6        21        10        21        1,8 21        4        2        9        17        10        33        2 25        22        2        9        19        14        32        2 27        35        1        9        24        6        26        2 24        19        2        10        20        11        26        2 25        28        2        7        18        13        26        2 25        35        1        8        19        11        32        2,2 21        18        2        4        14        13        34        2,2 23        9        1        7        22        8        35        2,2 26        32        1        13        8        10        30        2,2```

 weibullguy 05-30-2007 04:05 PM

Presuming that X is a function of A-G, you are fitting a model to the data not interpolating. You can't really "recover" the formula that generated your data set. The best you can do is find the model that best describes your data. That model will be meaningless because there is no context within which to work; all you have is bunch of numbers. Generally we have some understanding of the phenomena we're investigating that will help us choose a model family rather than blindly stab in the dark.

There are many methods for fitting a model to your data. You may have been introduced to linear regression in the past. That may not be the most appropriate method, but would be a good place to start.

There is an application available in most Linux distro's repositories named R (http://www.r-project.org/). It is also available for Windows. It will do what you want.

 All times are GMT -5. The time now is 06:26 PM.