I'm not using R or any other stats framework, I'm trying to implement myself an algorithm to optimize the fitting curve and to calculate the EC50 confidence intervals.
Problem I have is my lack of knowledge in this field, so almost everything I find is to do it using R and for the rest appears to be different approaches so I don't know if its the correct one.
I think I did pretty well fitting the curve using the Gauss-Newton method, I plotted the curve and its looking good.
Trying to calculate EC confidence intervals using this formula:

SE = sqrt(SUM((Y-Y')^2)/(N-2))

Where N is my number of scores, Y actual score of sample data, and Y' the prediction.

About confidence interval formula:

CI = Y +- crit.tvalue * SE * sqrt( (1/N-2) + ((EC50-xm)^2/SSx) )

Where SE is the formula above for standard error, n-2 are deegress of freedom, EC50 is the approximated EC50 value for what I'm calculating the confidence interval, "xm" is the mean of all x values and SSx is:

SSx= SUM((Xi-Xm)^2)

Is it correct? If not, what is the best approach?


1 Answer 1


The quantity

$$ E \propto \sum_{i}(y-\hat{y})^2$$

is actually an estimate of the variability left in the data once you're removed the structural part. In other words, $E$ is proportional to the noise in the data and not a good way to get confidence intervals for your fit. Confidence intervals don't deal with variability in the data, they deal with variability in the estimated parameters. That's different.

I'm assuming that you're using least squares, and so that means you are using a Gaussian likelihood (not important to you, just setting up some theory). Getting confidence intervals for a non-linear fit is kind of tricky because you have to:

  • Estimate the hessian of your loss
  • Use the delta method to get estimates of the variance of the non-linear curve.

Are you using software at all for this?

  • $\begingroup$ Yes, Im using software, but my own software. And yes, im using least squares. Its hard to me to undestand that E its not a good way to estimate confidence intervals but its a valid way? How its this? My curve its always a sigmoidal curve, what maybe it simplifies a bit the problem. Thanks $\endgroup$
    – borja
    Commented Feb 27, 2020 at 7:14
  • $\begingroup$ This is the video from where i got the formulas:youtube.com/watch?v=q8ldtlm8BbA $\endgroup$
    – borja
    Commented Feb 27, 2020 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.