least square fitting to a non-linear curve

91 Views Asked by At

The model is already proved to be correct for a previous simulation. Trying to apply the same for a new set of data. There are few constants, couple parameters with X. Both X and Y are derived from valid experiments. These parameters are what I want to fit, predict, simulate.

I wrote a code in R to fit the values to this model by providing initials values from the previous simulation. The curve shape comes right. However when applied simple limits to the equations, e.g. lim-> infinity, lim->0, then the value for Y doesn't match the actual.

I do have basic derivatives knowledge and understand somewhat what least square fitting is trying to achieve. But I am not sure the whole chunk that I am missing in order to connect the dots, to simplify for a better solution.

Following is the equation:

$$y = p2 +\frac{p2-p1}{(1 + \frac{exp(cons1*p3*exp(cons2*p4*x^2))}{x})}$$

Data sets: blob = exponential functions

if limits of blob become really large, $$y = P2$$ if blob becomes 0, $$y = \frac{p2 + P1}{2}$$