I need an algorithm to best-fit a curve

In summary, the conversation discusses creating an applet for distance runners that predicts their finish time for any distance using recent race times. The applet follows a logistic curve and the user can enter their recent race times to get a prediction for any distance. To predict the finish time, the algorithm of non-linear regression can be used, which can easily be implemented in statistics software or recreated in JavaScript using the Gauss-Newton algorithm or Lagrange Interpolation.
  • #1
Jamin2112
986
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:
Mathematics news on Phys.org
  • #2
Standard non-linear regression problem. Any statistics software (e.g. R) will let you fit the curve fairly easily.
 
  • #3
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.
 
  • #5
You could try Lagrange Interpolation.
Although it may have divergence, it will certainly pass through those points.
 

What is a curve fitting algorithm?

A curve fitting algorithm is a mathematical method used to find the best curve that represents a set of data points. It involves finding the optimal parameters of a mathematical function that can best describe the data.

Why do I need an algorithm to best-fit a curve?

In many cases, a set of data points do not perfectly fit a known mathematical function. Therefore, an algorithm is needed to find the best curve that can represent the data and make predictions or extrapolations.

What are the different types of curve fitting algorithms?

There are several types of curve fitting algorithms, including linear regression, polynomial regression, non-linear regression, and spline interpolation. Each type has its own advantages and is suitable for different types of data.

How do I choose the best algorithm for my data?

The choice of algorithm depends on the type of data and the goal of the analysis. For example, linear regression is suitable for data with a linear relationship, while non-linear regression is better for data with a non-linear relationship. It is important to understand the characteristics of your data before choosing an algorithm.

What are the steps involved in using a curve fitting algorithm?

The steps involved in using a curve fitting algorithm include:

  1. Choosing the type of algorithm and the appropriate mathematical function
  2. Collecting and organizing the data points
  3. Estimating the parameters of the function using the data points
  4. Evaluating the goodness of fit of the curve to the data
  5. Adjusting the parameters if necessary and repeating the process until a satisfactory fit is achieved

Similar threads

Replies
10
Views
2K
  • Introductory Physics Homework Help
Replies
8
Views
4K
  • STEM Educators and Teaching
Replies
21
Views
4K
Back
Top