Fitting a curve given points

222 Views Asked by At

My set-up is the following, I have two variables $N$ and $TTR$, and I have these points for each variable:

$N$ = [35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

$TTR$ = [0.818, 0.812, 0.812, 0.804, 0.804, 0.798, 0.792, 0.793, 0.788, 0.784, 0.781, 0.778, 0.776, 0.771, 0.767, 0.767]

I want to fit these data to the following model:

$$TTR=D/N \cdot \left( \sqrt{1 + 2N/D} - 1\right)$$

where $D$ is the parameter that I want to find and is gives the best fit.

Based on the example I am taking this, D = 66 should be around the "optimal" parameter, plotting these results I get:

enter image description here

I am trying a brute force approach, where I vary D from 1 to 70 (since D is "limited" to this set of values), and finding the D with the least mean squared error, however I get $D_{optimal} = 28$, and the result of that is shown in the following figure:

enter image description here

which is not better than the real optimal value, at least visually. How can I address this problem?

1

There are 1 best solutions below

0
On BEST ANSWER

There are many ways of finding the optimal value. One is to express the value $D$, making a distribution $D=D(TTR,N)$ and then use some other technique of averaging. Basically you could take simply the average value but you can do a little bit better if you observe your data better.

You start: $TTR=\frac{D}{N}(\sqrt{1+\frac{2N}{D}}-1)$ and after some work you have $$D(TTR,N)=-\frac{TTR^2\cdot N}{2(TTR-1)}$$

If you calculate this for your data, you have got the distribution of the values for the assumed distribution. I have got 63.0875 for the average value, and with that the error is below 0.004 for each point.

Another way is to use the above relation and create a linear dependency

$$TTR^2\cdot N=-D(TTR,N)\cdot(2(TTR-1))$$

Now you can use various methods for linear interpolation and obtain $D(TTR,N)$. There are other methods but this should help.

You should set the goal and specify what you want to minimize and then calculate the constant based on that requirement.