ELISA_4PL function takes as input three variables: x, y and yhat. The function uses the drc and nplr R-packages to fit a curve to the input data and return the parameters of the fitted curve. In addition, the function calculates the value of x corresponding to a specified value of y (yhat) using the inversion of the fitted curve.
ELISA_4PL<-function(x,y,yhat) {
#x:independent variable (e.g., concentration, dose)
#y:response variable
#yhat:a reference value of the curve for which we want to estimate the corresponding xhat value
library(drc)
library(nplr)
DF<-data.frame(x,y)
mod0<-drm(y~x,fct=LL.4(names=c("Slope","Lower","Upper","EC50")),type="continuous",data=DF)
Tab1<-summary(mod0)
B<-as.numeric(coef(mod0)[1])#slope of the curve
C<-as.numeric(coef(mod0)[2])#min value that can be obtained
D<-as.numeric(coef(mod0)[3])#max value that can be obtained
E<-as.numeric(coef(mod0)[4])#inflection point
DF2<-data.frame(B,C,D,E)
colnames(DF2)<-c("Slope","Bottom","Top","Inflection point")
#Inversion
fun<-expression(E*((D-C)/(yhat-C)-1)^(1/B))
xhat<-eval(fun)
#plot
plot(mod0,xlab=expression(bold("Concentration")),ylab=expression(bold("Titer")))
grid()
points(xhat,yhat,pch=16,col="red")
return(list(Summary=Tab1,Parameters=DF2,invY=xhat))
}
->->
Subscribe to:
Post Comments (Atom)
Understanding Anaerobic Threshold (VT2) and VO2 Max in Endurance Training
Introduction: The Science Behind Ventilatory Thresholds Every endurance athlete, whether a long-distance runner, cyclist, or swimmer, st...

-
Definition If you are interested in statistics or probability, you may have encountered the Owen's function , a special function t...
-
1. Introduction The assessment of assay accuracy is critical in analytical chemistry, particularly when facing the challenge of variable...
No comments:
Post a Comment