Tom-Alexander / regression-js

Curve Fitting in JavaScript.
http://tom-alexander.github.io/regression-js/
MIT License
940 stars 131 forks source link

4PL and 5PL curve fit #96

Open Zireael opened 4 years ago

Zireael commented 4 years ago

Hi, is it possible to use regressin-js to perform 4PL and 5PL curve fit? image

R code example for both: https://weightinginbayesianmodels.github.io/poctcalibration/calib_tut4_curve_background.html https://rdrr.io/cran/ELISAtools/src/R/Regression.R

Initial parameters (ABCDG) can be set as follows: 5PL or 4PL where: A: Minimum asymptote. In a bioassay where you have a standard curve, this can be thought of as the response value at 0 standard concentration. A = Min(y)

B: Hill's slope. The Hill's slope refers to the steepness of the curve. It could either be positive or negative. B = the slope of the line between highest and lowest point, for example Δy/Δx : (1.7914-0.130033)/(25-0.098)

C: Inflection point. The inflection point is defined as the point on the curve where the curvature changes direction or signs. C is the concentration of analyte where C=(D-A)/2

D: Maximum asymptote. In an bioassay where you have a standard curve, this can be thought of as the response value for infinite standard concentration. D = Max(y)

G: Asymmetry factor. When G=1 we have a symmetrical curve around inflection point and so we have a four-parameters logistic equation. G = 1

I've found examples to do the curve fit in R and Python but can't find a clear way to do it in Javascript.

Thanks in advance!

danielabyan commented 2 years ago

For more check this article https://www.brendan.com/5pl-curve-fitting/

simongiesen commented 1 year ago

I did a JavaScript 5PL. Please have a critical look: https://github.com/simongiesen/5PL