My Math Forum  

Go Back   My Math Forum > College Math Forum > Calculus

Calculus Calculus Math Forum


Thanks Tree3Thanks
  • 1 Post By CaptainBlack
  • 2 Post By CaptainBlack
Reply
 
LinkBack Thread Tools Display Modes
December 7th, 2014, 10:50 AM   #1
Newbie
 
Joined: Aug 2012

Posts: 17
Thanks: 0

Question What is the best fit for this data

Hi

I have one data set and I am looking for a function that could fit my data well. Preferably I am looking for something I can reproduce in excel and solve with solver. The function can have multiple constants, but not too many. It can also have IF-s or whatever. I am looking for the best possible fit and I am also looking for any limits (n->inf) on said function.
I tried what I could but I could not get a good fit.

My data can be found here:
https://dl.dropboxusercontent.com/u/.../data_long.csv

There's also a shorter and more accurate but less complete version, here:
https://dl.dropboxusercontent.com/u/...data_short.csv
In the later data set every row that is not included would have the value of the row that has the largest row number of all rows that are less than the one in question.

So for example:
GEN;FIT
56;0,064144345
127;0,06656979
Would mean that GEN 57 through 126 would have the value of 0,064144345

Any help would be much appreciated
nekdolan is offline  
 
December 8th, 2014, 04:09 AM   #2
Newbie
 
Joined: Aug 2012

Posts: 17
Thanks: 0

I made a graph with the data:
nekdolan is offline  
December 8th, 2014, 05:02 AM   #3
Senior Member
 
Joined: Apr 2014
From: Glasgow

Posts: 2,039
Thanks: 674

Math Focus: Physics, mathematical modelling, numerical and computational solutions
Can you try plotting it on a log scale? It seems like there's lots of exponential decays sort of stuck together.
Benit13 is offline  
December 8th, 2014, 12:06 PM   #4
Newbie
 
Joined: Aug 2012

Posts: 17
Thanks: 0

Sure:


I used this data for the graph. I duplicated every value so that it would be more faithful to the original dataset:
https://dl.dropboxusercontent.com/u/..._data_full.csv
nekdolan is offline  
December 8th, 2014, 12:45 PM   #5
Math Team
 
topsquark's Avatar
 
Joined: May 2013
From: The Astral plane

Posts: 1,570
Thanks: 613

Math Focus: Wibbly wobbly timey-wimey stuff.
It looks a bit like this.

-Dan
Attached Images
File Type: jpg Fit.jpg (22.2 KB, 7 views)
topsquark is offline  
December 8th, 2014, 08:27 PM   #6
Senior Member
 
Joined: Jan 2012
From: Erewhon

Posts: 245
Thanks: 112

Quote:
Originally Posted by nekdolan View Post
Hi

I have one data set and I am looking for a function that could fit my data well. Preferably I am looking for something I can reproduce in excel and solve with solver.
You should not be asking for someone to find a best/good fit as you are. This is not arbitrary data and therefore you should at least have some idea of the form that the fitting function should have. If you don't have any idea tell us where this data comes from so we can form our own opinion on what form the fitting function should take.

Failing that a low order Padé approximation should produce a very good fit, but I would not recommend this procedure. You need some theoretical or heuristic basis for the fitting function.

CB
Thanks from topsquark

Last edited by CaptainBlack; December 8th, 2014 at 08:29 PM.
CaptainBlack is offline  
December 8th, 2014, 11:45 PM   #7
Newbie
 
Joined: Aug 2012

Posts: 17
Thanks: 0

This is the result of an algorithm running for 10 hours. The algorithm starts with a square polygon and randomly adds and takes away points. The new polygon is tested than to see if it is more round (more like a circle) than the previous one was. If it is better, than the new polygon is kept, if not than it will be thrown out and the old one will be used again. The horizontal lines exist because sometimes no new points are found for a while. Also these lines will keep growing longer and longer since the more the polygon is round the less likely a new point can be integrated into it.

Here is the algorithm written in (node)js:
https://dl.dropboxusercontent.com/u/...node_script.js

Hope this helps
nekdolan is offline  
December 9th, 2014, 08:00 AM   #8
Senior Member
 
Joined: Jan 2012
From: Erewhon

Posts: 245
Thanks: 112

Quote:
Originally Posted by nekdolan View Post
This is the result of an algorithm running for 10 hours. The algorithm starts with a square polygon and randomly adds and takes away points. The new polygon is tested than to see if it is more round (more like a circle) than the previous one was. If it is better, than the new polygon is kept, if not than it will be thrown out and the old one will be used again. The horizontal lines exist because sometimes no new points are found for a while. Also these lines will keep growing longer and longer since the more the polygon is round the less likely a new point can be integrated into it.

Here is the algorithm written in (node)js:
https://dl.dropboxusercontent.com/u/...node_script.js

Hope this helps
I would go with a rational function model starting with the simple:

$$
Fit(n)=\frac{1+\alpha n}{\beta + \gamma n}
$$

or maybe:

$$
Fit(n)=\frac{1+\alpha \log(n)}{\beta + \gamma \log(n)}
$$

and only go for something of higher order if the fit is inadequate.

CB
Thanks from nekdolan and topsquark

Last edited by CaptainBlack; December 9th, 2014 at 08:11 AM.
CaptainBlack is offline  
December 10th, 2014, 01:36 AM   #9
Newbie
 
Joined: Aug 2012

Posts: 17
Thanks: 0

I'v gotten a 74% fit with the later function over 80% if I change the 1 into a constant.



So where would I go from here? I tried a few things but I had little to no luck.
It seems there is a periodic element to the data that is missing from the function but I'm not sure how I could add one to the it.
nekdolan is offline  
Reply

  My Math Forum > College Math Forum > Calculus

Tags
data, excel, fit, function



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Analysis DataGeek Real Analysis 1 January 25th, 2013 03:04 PM
Rolling 3 months YOY data to Monthly YOY data lumpa Real Analysis 0 October 19th, 2012 08:07 AM
FFT on sample data ramyy Applied Math 1 June 29th, 2009 04:49 PM
How to regress actual data towards projected data. BigLRIP Advanced Statistics 1 May 18th, 2009 10:01 AM
A Data Problem EddSjd Algebra 2 September 8th, 2007 10:06 AM





Copyright © 2017 My Math Forum. All rights reserved.