I need an algorithm to best-fit a curve

  • Context: Undergrad 
  • Thread starter Thread starter Jamin2112
  • Start date Start date
  • Tags Tags
    Algorithm Curve
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 4K views
Jamin2112
Messages
973
Reaction score
12
I'm making an applet for distance runners that predicts their finish time for any distance, using recent race times for any distance. For example, a user might enter 3 recent race times which are 16:37 for a 5k (5:21 min/mile pace), 27:42 for an 8k (5:34 min/mile pace), and 35:18 for a 10k (5:41 min/mile pace), then my "finish time calculator" could predict their finish time for a race of any distance. I've found that distance vs. pace follows a logistic curve like the one pictured below.


http://luna.cas.usf.edu/~mbrannic/files/pmet/image329.gif



Hence I want to predict their race finish times using a logistic function f(x) = C1(1/(1+C2e-C3x)). How do I do this, though?
 
Last edited by a moderator:
Physics news on Phys.org
Standard non-linear regression problem. Any statistics software (e.g. R) will let you fit the curve fairly easily.
 
Number Nine said:
Standard non-linear regression problem. Any statistics software (e.g. R) will let you fit the curve fairly easily.

I was actually going to recreate the algorithm in Javascript since I'm putting this "finish time calculator" on a site.
 
You could try Lagrange Interpolation.
Although it may have divergence, it will certainly pass through those points.