I need to be able to extrapolate, using 2-n data points, a curved trend line which can then be ‘queried’. In my head it would look a bit like this (the blue line):

This is for a ‘calories calculator’ – I have data points regarding the amount of calories burned for an activity based on a certain weight: e.g. if you’re 65kg, you’ll burn around 420 calories, if you’re 70kg, you’ll burn 480 calories, if you’re 75kg, you’ll burn 550 calories, etc. etc. One axis would be for calories, the other for weight.
Obviously if I wanted to find out the amount of calories burned for a weight where I don’t have a data point, I would need a trend line to ‘query’, which brings me on to the second part of my question: how would I go about doing this?
In summary:
- How do I extrapolate a trend line in Python?
- How do I ‘query’ this trend line to get estimates based on a point on this trend line?
numpy and scipy contain routines that let you fit expressions to data points. once you have an expression you can plot it for any range of time you like.
this answer – Nonlinear e^(-x) regression using scipy, python, numpy – contains an example of non-linear regression (it’s an exponential, like in your question, but one with negative exponent – in general, fitting and extrapolating exponentials with positive exponents is a bad idea because the extrapolation is so sensitive to noise / uncertainty that it quickly becomes meaningless).